G Aksland

Edit file name during a file save as

3 posts in this topic

I'm attempting to have micro express rename a JPEG file.

Current file name  test.jpg, I want to add CR to the end of the name of file name test. testCR.jpg

<WINDOW ACTIVATE Title="*.jpg" Exact_Match="FALSE" Wildcards="TRUE" _IGNORE="0x0006"/>
<TEXT TYPE Action="0" Text="<CTRLD><SHIFTD>"/>
<TEXT TYPE Action="0" Text="S"/>
<DELAY Flags="\x02" Time="1000"/>

what I am trying to do is insert the 2 letters CR at the end of the file name before the .jpg

this works fine but when I get to the point where I need to move to the end of the file extension, and then arrow left for spaces then I want to enter the 2 letters CR. What's happening as soon as the command text equals S executes the JPEG file is in the file save as mode. With the file name highlighted. The problem I am encountering as soon as I do the next line that says arrow right that would take me to the outside of the file extension JPG, the text in the JPEG file becomes on highlighted and micro-express seems to go into never never land. The way I can get it back is to do a Ctrl-Alt-Del and then cancel and then I can get control again and cancel the step-by-step test run that I am doing. When I try to move to the end of the highlighted filename so I can arrow back for spaces and add CR. All I'm trying to do is add the CRat the end of the file name before the  .jpg.
<TEXT TYPE Action="0" Text="<ARROW RIGHT>"/>
<DELAY Flags="\x02" Time="1000"/>

Share this post


Link to post
Share on other sites

I don't have time right now for an in-depth response but I suggest using the MEP file rename command. Much more reliable. And MEP can parse the file name for you. Depending on your use the way we tell MEP where the file is would be the only part not determined. But if you can I recommend not using Windows File Explorer at all. Also look into Repeat with Folder. 

Share this post


Link to post
Share on other sites

It's unclear from your description exactly what you are trying to do, but let me take a stab at it.

 

It sounds like you want to save a file with a new name, xxx.jpg to xxxCR.jpg.

 

In many "Save As" dialogs, you do not need to include the file extension in the file name. If no extension is specified, the extension is added automatically when you save.

 

Assuming the file name field has focus, you might be able to do this (in pseudo code):

TEXT TYPE <END>   // Move cursor to the end of the line

TEXT TYPE <BACKSPACE><BACKSPACE><BACKSPACE><BACKSPACE> // Delete the three-letter extension and the period

TEXT TYPE "CR" // Add the letters C and R

TEXT TYPE <ENTER> // Pressing Enter activates the "Save" button in many "Save As" dialog boxes.

An alternative to the last line might be something like this:

TEXT TYPE <TAB><TAB><TAB><TAB><ENTER>  // Tab to the "Save" button, and activate it by pressing Enter

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now