sbrady Posted October 22, 2012 Share Posted October 22, 2012 I have a need to create a script that will rename files in a folder. Here is code that I know works to rename. $original_name = "D:\Promos\AR123 Smith, Bob v1 - FULL MIX.jpg" $text = StringReplace("AR123 Smith, Bob v1 - FULL MIX.jpg"," - FULL MIX","");AR123 Smith, Bob v1 $new_file_name = StringReplace("AR123 Smith, Bob v1"," v1", " FULL MIX v1.jpg") ;AR123 Smith, Bob FULL MIX v1 $new_filename_path = "D:\Promos\" FileCopy ($original_name, $new_filename_path & $new_file_name) Here is what I need: 1. The user may have more than 1 window open. 2. The script will need to be able to navigate to the correct window somehow 3. The files in the window will look like this AR123 Smith, Bob v1 - Full Mix AR123 Smith, Bob v1 - SOT Mix AR123 Smith, Bob v1 - M&E Mix So, how do I go about this. 1. Can I select the 3 "mix" files and tell the script to rename them 2. Can I tell the script to look in the frontmost of active window, I am not sure how AutoIT will handle this. 3. Is there some other way I dont know about???? 4. Be advised the v1 may be v2, v3, v4, v5, v6, v7 , v8.............but the words full mix, SOT mix, and M&E mix wlll be there. Thanks for any ideas. Link to comment Share on other sites More sharing options...
sbrady Posted October 23, 2012 Author Share Posted October 23, 2012 is there a function that gets the items that are selected or highlighted in a folder. I need to rename files at my work all day long. I think it would be easiest if I could get the items that are selected in a window, if not here is what I am thinking. 1. get the name or path of the window that contains the files to be renamed. (winList come to mind) 2. get an array of files whose name contains "mix" (_FIleListToArray comes to mind here) 3. rename the files. (this step I can do successfully) any help would be appreciated Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 23, 2012 Moderators Share Posted October 23, 2012 sbrady, How about sticking to one topic at a time. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
sbrady Posted October 23, 2012 Author Share Posted October 23, 2012 is there a function that gets the items that are selected or highlighted in a folder. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 23, 2012 Moderators Share Posted October 23, 2012 sbrady,Please do not be so impatient - you might think it urgent, but I can assure you that no-one else does. You might want to look at this post. Or you might want to look at my ChooseFileFolder UDF which will let you select files in an Explorer-like treeview. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now