bahtea Posted October 7, 2010 Share Posted October 7, 2010 As a sequel to my previous thread "_PathSplit without the backslashes" My linkWhen I run this Send("(" & $sNewDir_1 & ", " & $szFName & ", \1, '")in a While loop, sending the characters to Notepad++'s Replace "Find what" box the first round comes out OK--with any file--and I get sth like: (40, 9, 1, ' (40, 9, 2, ' (40, 9, 3, 'which is as desired.However, with the next file/tab (for I have about a dozen txt files open), the values/characters ($szFName) sent, are obviously supposed to change, say(40, 8, 1, 'but, the same '9' comes again. Same thing with the rest. So, even where it's supposed to be (40, 7, 1, '(40, 6, 1, '(40, 5, 1, 'only (40, 9, 1, 'which is the first string used in the operation, gets sent. The only solution I can think of is inserting Sleep() here and there! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 7, 2010 Moderators Share Posted October 7, 2010 bahtea, Well the error is obvious - it is in Line 45623498537! My crystal ball says so! M23 P.S. If you do not post any code - how are we supposed to help. 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...
jaberwacky Posted October 7, 2010 Share Posted October 7, 2010 (edited) Are you using a loop? If so, are you decrementing the variable Yeah what M23 says. Edited October 7, 2010 by jaberwocky6669 Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
bahtea Posted October 7, 2010 Author Share Posted October 7, 2010 (edited) If you horrible guys insist on looking at a mendicant's patchwork, here we go expandcollapse popup...Dims... WinActivate("[CLASS:Notepad++]", "") $fPath = WinGetTitle("[CLASS:Notepad++]", "") _PathSplit($fPath, $szDrive, $szDir, $szFName, $szExt) $sNewDir_1 = StringtrimRight(StringTrimLeft($szDir, 14), 1) While WinActive($WindowTitle) Send("^{HOME}") ;launch Replace Dialog Send("^h") ;Set RegEx Send("!g") ;Activate "Find" box Send("!f") Send("{DEL}") Sleep(500) ;Search for this regex Send("{^}(\d{+}) ") Sleep(500) ;Now, the "Replace with" field Send("!l") Sleep(500) ;Give Windows GUI a chance Send("{DEL}") ;A! Windows is a slowpoke, eh? Sleep(500) ;Here's the replacement: Send("(" & $sNewDir_1 & ", " & $szFName & ", \1, '") ;<--THE PROBLEMATIC LINE Sleep(500) ;Replace All Send("!a") Sleep(500) ;Close the OK Dialog box Send("{ESC}") ;Sleep(500) ;Close the Replace dialog box Send("{ESC}") ;Sleep(500) Send("!x") Sleep(500) Send("!n") ;'cause I'm experimenting Sleep(500) WEnd Exit And...that was the story of The Sleeps! Edited October 7, 2010 by bahtea Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 7, 2010 Moderators Share Posted October 7, 2010 bahtea,the values/characters ($szFName) sent, are obviously supposed to change, saySo where in that bit of script you posted do you change the value of $szFName? 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...
bahtea Posted October 7, 2010 Author Share Posted October 7, 2010 (edited) I do not change the value of $szFName myself; it is supposed to change eventually when the script acts on the next file. But that changed value does not get reflected on that next run of this lineSend("(" & $sNewDir_1 & ", " & $szFName & ", \1, '") Edited October 7, 2010 by bahtea Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 7, 2010 Moderators Share Posted October 7, 2010 bahtea,I presume you use this:$fPath = WinGetTitle("[CLASS:Notepad++]", "") _PathSplit($fPath, $szDrive, $szDir, $szFName, $szExt)to get the title of the currently active file from the window title. How is the script supposed to run through the various tabs that you have open so that it knows what the other files are? Somewhere in your script you have to change the active tab in your editor so that the new file name is in the title - then you can use that to reset the path variables by using WinGetTitle & _PathSplit again. You currently only do this once. Either you have more code than that to show or you are expecting AutoIt to read your mind as to what you want it to do rather than do what you tell it to do. Guess what AutoIt actually does! 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...
bahtea Posted October 7, 2010 Author Share Posted October 7, 2010 M23! Very good advice given that was. I re-ordered the lines thus: While WinActive($WindowTitle) $fPath = WinGetTitle("[CLASS:Notepad++]", "") _PathSplit($fPath, $szDrive, $szDir, $szFName, $szExt) $sNewDir_1 = StringtrimRight(StringTrimLeft($szDir, 14), 1) ;Place cursor at the beginning of the page Send("^{HOME}")Now the code runs smooth. You're a charm! Big thanks all the way! 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