Jump to content

Script crashes - cause unknown


Recommended Posts

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

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

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...