sanfrancrisko Posted October 22, 2010 Share Posted October 22, 2010 Hi, I'm relatively new to AutoIT and I've encountered an issue that is very strange and I cannot find the cause. Basically, there's an If block that doesn't appear to be executing the "else" statement. The bizarre thing is has gotten worse overnight, since I've shutdown my PC and restarted! Perhaps this is not an issue with the code, but with the AutoIT installation? If you notice below, I've put in two message boxes to debug. At least yesterday, I was getting the message box located at the end of the If statement, but today I'm not, despite doing nothing to the code. I've also tried ElseIf $RunStart = false then to see if that would work, but unfortunately not. Any help would be greatly appreciated. Thanks in advance! func purgeEmail() if $RunStart = true then Run("C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE") WinWait("Choose Profile", "", 5) If WinActive("Choose Profile") Then Send("{Enter}") Else Sleep($StartDelay) WinWaitActive("[CLASS:MsoCommandBar]", "", 5) Send("!g") Send("f") Sleep(1000) Send("bposautotest") Sleep(1000) Send("{ENTER}") WinActivate("BPOSAutoTest - Microsoft Outlook") Send("{UP 100}") Send("{DOWN}") Sleep(1000) $RunStart = false MsgBox(0, "Here", $RunStart, 5) EndIf else MsgBox(0, "Here", "At Else", 5) purgeBPOSAutoTest() purgeSentItems() purgeRecycleBin() TestReset() EndIf endFunc The code is below: Link to comment Share on other sites More sharing options...
MvGulik Posted October 22, 2010 Share Posted October 22, 2010 Start debugging/monitoring that $RunStart variable. If its always 'true' it would explain why your code is never running the 'else' part.The code is below:your sure about that? "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... Link to comment Share on other sites More sharing options...
sanfrancrisko Posted October 22, 2010 Author Share Posted October 22, 2010 Start debugging/monitoring that $RunStart variable. If its always 'true' it would explain why your code is never running the 'else' part.your sure about that?Sorry, the $RunStart boolean was included in that code snippet - very bad form of me! Apologies for that.Anyway, got the issue resolved - a colleague noticed that my If statement was incorrect - I should have put the other function calls and other code I wanted to execute outside the If statement, instead of in the "Else" statement - a rookie mistake, but then again, I am a rookie to programming in general, not just AutoIT.Thanks anyway! Link to comment Share on other sites More sharing options...
sanfrancrisko Posted October 22, 2010 Author Share Posted October 22, 2010 I can't see anywhere to "mark as solved" or "close" - is this only something admins can do? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 22, 2010 Moderators Share Posted October 22, 2010 sanfrancrisko,When you have a few more posts (I seem to remember 5 total), you will be able to edit your posts (a small button comes up at lower right). To change the title of a topic, edit the first post - but be sure to select the "Use Full Editor" button which will open the title for editing also. 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