Jump to content

AutoIt3.exe has encountered a problem.


Recommended Posts

Good folks,

I am new to using Autoit and have a problem. I run my script and come back in 30 to 60 minutes and have the Microsoft message "AutoIt3.exe has encountered a problem and needs to close". When I close it I get an error code on AutoIt Editor of Exit Code: - 1073741571. I am running XP Pro with SP1. Any help would be appreciated. Thanks, Kirk kwasson@entergy.com

Link to comment
Share on other sites

its because you are calling the function name with in the function, that = A BIG NO NO thats the reason loops were invented, with your msgbox its always going to return one i have no idea why you put in a check for 7 or for 2 and they dont do anything, thus the creation of else, dont use call unless your going to pass some paramaters even then you just plug them in

just use the function name for example getrecord()

ive cleaned it up a little but what are you trying to achieve it looks like you can accomplish it alot better with out just clicking

Global $stat, $a = 0 , $b, $c  = 0 , $SplitUp[4]


$file = FileOpen(FileOpenDialog("Select File",@DesktopDir,"CSV ( *.csv)"),1)
$file2 = FileOpen("CompletedRecords.txt",1)

; -------------------- Main Program -------------------------------------------
While 1 
    $c += 1
    $msg = msgbox(0,"Record = "& $c,"Please OK to exit!!!!!",4)
    If  $msg = 1 Then
        MsgBox(0,"", "Check 'Completed.txt' to see where to restart.")
        exit
    Else
    EndIf

    GetRecord()
    MsgBox (4096,$c,$SplitUp[1]&"-"&$SplitUp[2]&"-"&$SplitUp[3],2)
    ChangeRadioRecord()
    FileWrite ($file2,$SplitUp[1]&","&$SplitUp[2]&","&$SplitUp[3]&"," &$SplitUp[4]& $stat &","&$c&" "&@hour&":"&@min&" "&@mon&"/"&@mday&@CRLF)
    If $c = 99  Then
        $a += 1
        $c = 0
    Endif
WEnd

; ---------------------------- End Main Program -----------------------------------

func GetRecord ()
    If $file = -1 Then
        MsgBox(0, "Error", "Unable to open file.")
        Exit
    EndIf
    $line = FileReadLine($file,$c)
    $SplitUp = StringSplit($line, ',')
    if $SplitUp[1] = "End" Then
        MsgBox(0, "Success", "File Successfully Completed")
        FileClose ($file2)
        FileClose($file)
        Exit
    EndIf
Endfunc



func ChangeRadioRecord ()
    $stat = ",Done"         ; $stat is "done" unless changed below
    MouseMove(377,274)
    MouseDown("left")       ; put cusor in Radio ID field
    MouseUp("left")
    Sleep(500)
    Send("{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}")
    sleep(1000)
    Send($SplitUp[1])       ; sent the ID from the file
    MouseMove(765,109)
    MouseDown("left")       ; click FIND
    MouseUp("left")
    Sleep(5000)
    MouseMove(92,507)
    MouseDown("right")  ; menu
    MouseUp("right")
    Sleep(500)
    MouseMove(128,560)
    MouseDown("left")       ; highlight Open
    MouseUp("left")
    Sleep(500)
    MouseMove(400,188)
    MouseDown("left")
    MouseUp("left")
    Sleep(500)
    MouseMove(240,188)
    MouseDown("left")
    MouseMove(153,188)
    MouseUp("left")
    sleep (1000)
    ClipPut("")             ; check to see if record is there
    Sleep(1000)
    Send("{CTRLDOWN}c{CTRLUP}") ; copy to clipboard
    sleep(2000)
    $bak = ClipGet()        ; copy to variable $bak
    If $bak = "" then
        Sleep(1000)
        MouseMove(308,276)  ; highlight and delete ID
        MouseDown("left")
        MouseMove(213,278)
        MouseUp("left")
        Sleep(500)
        Send("{DEL}")   ; delete ID number
        Sleep(1000)
        MouseMove(268,252)  ; highlight SN field
        MouseDown("left")
        MouseUp("left")
        Sleep(500)
        Send($SplitUp[3])   ; send SN
        Sleep(1000)
        MouseMove(752,110)  ; click Find
        MouseDown("left")
        MouseUp("left")
        Sleep(10000)
        MouseMove(155,509)  ; highlight Record
        MouseDown("left")
        MouseUp("left")
        Sleep(1000)
        MouseMove(155,510)  ; right click for Menu
        MouseDown("right")
        MouseUp("right")
        Sleep(500)
        MouseMove(194,580)  ; click Delete
        MouseDown("left")
        MouseUp("left")
        Sleep(1000)
        Send("{ENTER}")
        Sleep(1000)
        MouseMove(535,252)  ; highlight SN field
        MouseDown("left")
        MouseMove(226,248)
        MouseUp("left")
        Sleep(500)
        Send("{DEL}")       ; delete SN
        Sleep(1000)
        NewRecord()  ;add new record routine
        return
    ElseIf $bak = $SplitUp[3] Then
        $stat = ",Done"
        sleep(1000)
        MouseMove(360,382)      ; click Cancel
        MouseDown("left")
        MouseUp("left")
        Sleep(1000)
        return
    EndIf
    Sleep(1000)
    Send($SplitUp[3])       ; populate SN field with SN from file
    Sleep (500)
    MouseMove(210,390)      ; click APPLY
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    If WinActive("Warning","") Then
        Sleep(1000)
        Send("{ENTER}")
        Sleep(1000)
        DeleteRecord()
        $c -= 1
    EndIf
    ;MouseMove(288,235)     ; click No changes made button if that occurs
    ;MouseDown("left")
    ;MouseUp("left")
    ;Sleep(1000)
    MouseMove(360,382)      ; click Cancel
    MouseDown("left")
    MouseUp("left")
    Sleep(500)
EndFunc

func NewRecord ()
    MouseMove(20,33)    ; click File
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    MouseMove(26,54)    ; click New
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    MouseMove(28,86)    ; click Basic tab
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    MouseMove(176,192)  ; click SN field
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    Send($SplitUp[3])       ; populate SN field with SN from file
    Sleep(1000)
    MouseMove(243,215)  ; click Radio ID field
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    Send($SplitUp[1])   ; populate ID field with ID from file
    Sleep(1000)
    MouseMove(271,281)  ; click Security Group field
    MouseDown("left")
    MouseMove(270,281)
    MouseUp("left")
    Sleep(1000)
    Send("MT-SYSTEM")   ; send security group
    Sleep(1000)
    MouseMove(361,195)  ; click back in SN field
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    MouseMove(97,89)    ; click Configuratio
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    MouseMove(258,256)  ; click Interconnect button
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    MouseMove(216,387)  ; click Apply
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    MouseMove(358,384)  ; click Cancel
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
EndFunc

func DeleteRecord ()
    MouseMove(358,384)  ; click Cancel
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    MouseMove(364,272)  ; highlight Radio ID field
    MouseDown("left")
    MouseMove(198,272)
    MouseUp("left")
    Sleep(1000)
    Send("{DEL}")   ; send Delete
    Sleep(1000)
    MouseMove(438,251)  ; highlight SN field
    MouseDown("left")
    MouseMove(237,250)
    MouseUp("left")
    Sleep(1000)
    Send($SplitUp[3])       ; populate SN field with SN from file
    Sleep(1000)
    MouseMove(763,112)  ; click Find
    MouseDown("left")
    MouseUp("left")
    Sleep(10000)
    MouseMove(186,513)  ; highlight Record
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    MouseMove(190,511)  ; right click for Menu
    MouseDown("right")
    MouseUp("right")
    Sleep(1000)
    MouseMove(235,591)  ; highlight Delete
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    Send("{ENTER}")
    Sleep(1000)
    MouseMove(395,249)  ; hightlight SN field
    MouseDown("left")
    MouseMove(209,243)
    MouseUp("left")
    Sleep(1000)
    Send("{DEL}")       ; delete SN from search
    Sleep(1000)
endfunc
Edited by thatsgreat2345
Link to comment
Share on other sites

Code is attached. You will notice I do not have much error handling in there.

Thanks for the help, Kirk

Thanks, that makes more sense. I will try it

This script is used on a Motorola SmartZone Radio system management terminal.

It pulls up radio records and compares them to a CSV of radios that have been field inventoried.

It changes the record in the Motorola DB to match the CSV.

Since some radio IDs may the assigned to other SNs, the record may have to be deleted and new record built.

I built most the script with the recorder and do not know much about the more complicated commands.

I will try the revised script and let you know how it works. Thanks, Kirk

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...