aleph01 Posted January 13, 2015 Share Posted January 13, 2015 (edited) Greetings, forum:I'm gettingError: "Next" statement with no matching "For" statement.I do have a For statement, followed by about 15 If / EndIf loops, then the Next statement. Is there any way to tell AutoIt to relink the For and Next? Is there a way to prevent this issue in the first place?My Code button is grayed out, as is my entire toolbar (don't know why), so please forgive me if this code doesn't post right.expandcollapse popupFor $sItems = 1 To $aItems[0] If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\Branch Manager\Client\branchManagerClient.exe") Then $BMClient = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\Branch Manager\Client\branchManagerClient.exe") If $BMClient > 0 Then Sleep (1); Don't sleep! Add the computername and version number to the correct Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\Branch Manager\Server\branchManagerSvc.exe" Then $BMSvc = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\Branch Manager\Server\branchManagerSvc.exe") If $BMSvc > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\ewlaunch\ewlaunch.exe") Then $ewLaunch = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\ewlaunch\ewlaunch.exe") If $ewLaunch > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\ewlaunch\ewlaunch.exe") Then $lptClient = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\lptone\lptclient\lptonesvc.exe") If $lptClient > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\ewlaunch\ewlaunch.exe") Then $lptJQE = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\lptone\lptjqe\lptJqe.exe") If $lptJQE > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\PC Reservation\Management Console\PCRes_MS.exe") Then $pcResMC = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\PC Reservation\Management Console\PCRes_MS.exe") If $pcResMC > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\PC Reservation\Client Module\PC Reservation Client Module.exe") Then $pcResClient = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\PC Reservation\Client Module\PC Reservation Client Module.exe") If $pcResClient > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\PC Reservation\Reservation Station\PCRes_RS.exe") Then $pcResRS = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\PC Reservation\Reservation Station\PCRes_RS.exe") If $pcResRS > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\STS\STS-L.exe") Then $STS = FileGetVersion ("\\" & $aItems[$sItems] & "c$\STS\STS-L.exe") If $STS > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\RFIDLink\ewRfidLinkSvc.exe") Then $rfidLink = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\RFIDLink\ewRfidLinkSvc.exe") If $rfidLink > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\StaffLink\ewStaffLink.exe") Then $staffLink = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\StaffLink\ewStaffLink.exe") If $staffLink > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\System Monitor\ewSystemMonitorClient.exe") Then $sysMonClient = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\System Monitor\ewSystemMonitorClient.exe") If $sysMonClient > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\System Monitor\ewSystemMonitorSvc.exe") Then $sysMonServer = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\System Monitor\ewSystemMonitorSvc.exe") If $sysMonServer > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\Scannx, Inc\ScanCenter 2.6.932\SxScanCenter.exe") Then $LDS = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\Scannx, Inc\ScanCenter 2.6.932\SxScanCenter.exe") If $LDS > 0 Then Sleep (1);add to Excel sheet EndIf If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files\EnvisionWare\OneStop\ewSelfCheck.exe") Then $oneStop = FileGetVersion ("\\" & $aItems[$sItems] & "c$\Program Files\EnvisionWare\OneStop\ewSelfCheck.exe") If $oneStop > 0 Then Sleep (1);add to Excel sheet EndIf NextAs you can see, I have some Excel work to do, so when this issue is resolved, I may be back if I have problems getting a spreadsheet populated. Thanks for any help you may bestow upon me._aleph_ Edited January 13, 2015 by Melba23 Added code tags Meds. They're not just for breakfast anymore. Link to comment Share on other sites More sharing options...
czardas Posted January 13, 2015 Share Posted January 13, 2015 (edited) I don't see where that error occurs in the code you posted. It may caused by a line earlier in the script. One thing though - you use a sleep value which is meaningless. I don't think you can actually Sleep less than 10 ms. Also, very small values for sleep tend to be inaccurate. This has nothing to do with your problem. Edited January 13, 2015 by czardas operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
aleph01 Posted January 13, 2015 Author Share Posted January 13, 2015 czardas,I just put the sleeps in there to end the If loops. They will be replaced by "populate the Excel spreadsheet" commands, but I just wanted not to have incomplete If statements throwing errors. A little background: I started the For loop and wrote the first If statement. Then I copied and pasted the If statement, changing the path using a copy and paste method via a third party tool called File Menu Tools, which allows you to right-click on an executable (or any file, as far as I now) and choose "copy path". This has never been a problem for me when writing AU3 code, but I wonder if I were to key out the entire For / Next loop if it would work out just fine. I'm just wondering if there's a way to avoid all that and just tell AutoIt that "this particular For" goes with "this particular Next."As for previous code being the problem, I don't think so, because line numbers for the error are given. There's nothing between my For and Next except for If/then loops, and the "connective" symbols to the left seem to show that the For and Next encompass all these and are linked.Still perplexed.Thanks for the response._aleph_ Meds. They're not just for breakfast anymore. Link to comment Share on other sites More sharing options...
BrewManNH Posted January 13, 2015 Share Posted January 13, 2015 You're missing a closing parentheses in line 7. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
aleph01 Posted January 13, 2015 Author Share Posted January 13, 2015 OMG, BrewmanNH, do you have a script for that? If not, I bet you have eye strain. That seems to have solved the problem there. Now I have an identical problem (identical error message) much further down in the code. I'll look for some simple syntax issue, but I really have a problem with it - the code where the issue is in in the GUI. I'm reusing code that Melba23 wrote for me, seeing how pitiful I was (and am) and being compassionate.., well it got done. Thanks, Melba 23! You're the best!Anyway, it's getting late for me now, but I'll look at it asap and post either my success or my plea for help.I thank the forum. Those of you who are the "Answerers" are doing a great service. Your efforts are truly appreciated here, and I'm sure by many others._aleph_ Meds. They're not just for breakfast anymore. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 13, 2015 Moderators Share Posted January 13, 2015 aleph01,When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. 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...
aleph01 Posted January 14, 2015 Author Share Posted January 14, 2015 Hi, Melba23. I know how to use the tools, but unfortunately, my toolbar is grayed out. Wait! I was in bbcode mode. Didn't even know it. Toolbar is available again and text looks formatted now. A joyous day! Thanks for pointing that out, Melba23, I hadn't a clue! Never heard of a toolbar with an on/off toggle switch for the toolbar itself. Future code I post will look much better. _aleph_ Meds. They're not just for breakfast anymore. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 14, 2015 Moderators Share Posted January 14, 2015 (edited) OMG, BrewmanNH, do you have a script for that? Yes, Au3Check (Ctrl+F5 in SciTe)... If FileExists ("\\" & $aItems[$sItems] & "c$\Program Files (x86)\EnvisionWare\Branch Manager\Server\branchManagerSvc.exe" Then ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ Edited January 14, 2015 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
aleph01 Posted January 14, 2015 Author Share Posted January 14, 2015 Wow! Thanks, SmOk_N! I was overlooking a very useful tool right at my fingertips! With this knowledge, I grow stronger, I tell you, STRONGER ! I am now looking into incrementing _Excel_RangeWrite so I'll start a new topic on that if/when the time comes. I haven't researched it yet, but there's no sense in having a topic with a title and then go off onto another topic unless closely related. Anyone with a suggestion for writing multiple entries (multiple lines) to an Excel spreadsheet, feel free to speak up. I'm learning a lot here. Feels good! _aleph_ Meds. They're not just for breakfast anymore. Link to comment Share on other sites More sharing options...
SorryButImaNewbie Posted January 14, 2015 Share Posted January 14, 2015 Wow! Thanks, SmOk_N! I was overlooking a very useful tool right at my fingertips! With this knowledge, I grow stronger, I tell you, STRONGER ! POWEEEER, UNLIMITED POWWEEEEEERRRRRRRRR!!!!!!! (sorry, had to) 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