This thread is coming closest (so far in my lengthy search) to what I am trying to do.
I'm working on a script that renames folders based upon the current name of the folder. What it does is change a numeric date stamp (part of the folder name) that I have been using, such as 062706 (for June 27, 2006) to my newer format 06_0627. ( When you have a lot of folders beginning with different date codes, this works better when Windows sorts the folders by name. It makes them fall into groups by year, then by month and day).
I have the script so it does the renaming very nicely on a single folder. Now I want to step back and script the operation to start selecting the next folder name down the list and run the same script. Once I get that accomplished, I can set it up to do a large number of folder names in sequence, without my intervention. But I haven't yet found a way to tell the mouse to right-click the next folder name after the script has moved down to it and highlighted it.
I am using the Send, {Down} command at the end of my current script, and it drops the blue highlight down to the next folder name. But if I press the hotkey for the script again, it renames the folder I just came from, because the mouse is still focused there. I guess I need a "focus the mouse where the highlighted text is" command.
Any suggestions?
Here is the script I am using so far:
Code:
; RECEIPT DATE CHANGER SCRIPT
;
; This script will, when applied to highlighted text,
; change my older date format i.e. 010206 (Jan 2nd, 2006) to my new format i.e. 06_0102
;
^0:: ;Set this script's hotkey to CTRL+0
Clipboard = ;Clear the Clipboard
Sleep, 500 ;wait 0.5 second
; This next section deals strictly with Folder navigation! Although the script works in a text document, it is ;
designed for use in renaming Paperport record folders and files.
; MANUALLY HIGHLIGHT THE FIRST FOLDER NAME IN THE TREE
; +++++++++++++++++++++++++++++++++++++++++++++++
MouseClick, Right ;Right-Click the current highlighted folder name
Sleep, 1000
Send, {Up}{Up} ;select the Rename submenu item - Counting down from the top, Rename
;can get relocated depending upon menu additions by installed programs
;but the last 2 in the last are all standard Windows XP items, so I
;counted up from the bottom instead.
Sleep, 1000
Send, {Enter} ;activate selected Rename option
Sleep, 1000
;++++++++++++++++++++++++++++++++++++++++++++++++
{
Send, ^C ;Copy the highlighted text to the clipboard
OLD_DATE = %Clipboard% ;Save the copied text into the variable named OLD_DATE
StringLeft, WORK_ZONE, OLD_DATE, 6 ;place the first 6 chars. of the OLD_DATE var. into
;a new variable named WORK_ZONE
StringRight, YEAR, WORK_ZONE, 2 ;Place the last 2 char of WORK_ZONE into
;a new variable named YEAR
StringLeft, DAY_MON, OLD_DATE, 4 ;place the first 4 char. of the OLD_DATE var, into
;a new variable named DAY_MO
NEW_DATE = %YEAR%_%DAY_MON% ;compile the new date string by adding YEAR, an underscore char.,
;and DAY_MON
StringTrimLeft, CUTOFF, OLD_DATE, 6 ;trim the first 6 char. (the old format date) from OLD_DATE
Converted = %NEW_DATE%%CUTOFF% ;the new var. Converted now holds the NEW_DATE plus the remaining
;Characters from the original highlighted text
Clipboard = %Converted% ;load the clipboard with the contents of the var. Converted
Sleep, 500 ;0.5 sec. delay
Send, ^V ;Paste the clipboard content back to replace the originally
;higlighted text.
Send, {Enter} ;Finish renaming
Sleep, 1000
Send, {Down} ;Move down and highlight the next folder in the viewed tree
SoundBeep,1500, 150
}
Return