Jump to content
tezari

Error when running the .exe on another computer.

Recommended Posts

tezari

Hi, 

I have been using AutoIt for some time, I have always found the answers to my questions in the forum (Thanks God!!:)) but I wasnt able to get an answer for the one Im going to detail below. So If you can help me GREAT!!

********

 

I have the following code, basically is a tool that automatize a process in my daily work. In my computer, where I have AutoIt installed, its running great, 0 issues. I tried to send the file to a friend but when he tries to run the .exe is getting this error:

http://i.imgur.com/7R0S9iE.jpg

 

Here is the code that Im using:

 

#include <GUIConstants.au3>
#include <GuiListView.au3>
#include <GuiListBox.au3>
#include <ImageSearch.au3>
#include <GuiDateTimePicker.au3>

Local $hWnd = "WBS Element Summary"
Local $y = 0, $x = 0,$sMessage =""

Local $hGUI =GUICreate("ZK32 Extract", 300, 450)
Local $iList = GUICtrlCreateList("", 10, 10, 275, 200)
Local $btnAdd = GUICtrlCreateButton("Add WBS:", 10, 220, 100)
Local $btnRemove = GUICtrlCreateButton("Remove Selected WBS", 10,250,150)
Local $extract = GUICtrlCreateButton("Get ZK32",10,350,280)
Local $iInput = GUICtrlCreateInput("", 130, 220, 100)
Local $SelectPath = GUICtrlCreateButton ("Select Path",180,250,100)

GUICtrlCreateLabel("From:",10,290,30)
GUICtrlCreateLabel("To:",10,315,30)
Local $From = GUICtrlGetHandle(GUICtrlCreateDate($hGUI, 50, 285, 120))
Local $To = GUICtrlGetHandle(GUICtrlCreateDate($hGUI,50,310,120))
; Set the display format

_GUICtrlDTP_SetFormat($From, "MM.dd.yyyy")
_GUICtrlDTP_SetFormat($To, "MM.dd.yyyy")
GUISetState()

Local $sRead
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $btnAdd
$sRead = GUICtrlRead($iInput)
If $sRead <> '' Then GUICtrlSetData($iList, $sRead)
Case $btnRemove
      $sName = GUICtrlRead($iList)
      $item2delete = ControlCommand ( "", "", "ListBox1", "FindString", $sName)
      ControlCommand ( "", "", "ListBox1", "DelString", $item2delete)
Case $SelectPath
      Local $sFileSelectFolder = FileSelectFolder("Select a folder", "")
Case $Extract
    Local $hLB = ControlGetHandle("", "", $iList)
    Local $iCnt = _GUICtrlListBox_GetCount($hLB)
    Local $sMsg = ""
    Local $FromDate = ""
    Local $Todate = ""
    Local $WBSx,$WBSy
    Local $ControlTimer = 0
    $FromDate =_GUICtrlDTP_GetSystemTime($From)
    $ToDate = _GuiCtrlDTP_GetsystemTime($To)
             WinActivate($hWnd)
            Local $aClientSize = WinGetPos ($hWnd)
         ;Remove Focus
         Local $search = _ImageSearch('Ini.png', 0, $x, $y, 100)
         If $search = 1 Then
         MouseClick("Left",$x+100,$y)
         EndIf
         ;End Remove Focus

         Local $search = _ImageSearch('WBSLocation.png', 0, $WBSx, $WBSy, 100)
         If $search = 1 Then
         EndIf

         ;First Pull
         $sMsg = _GUICtrlListBox_GetText($hLB, 0)
         MouseClick("Left",$WBSx+150,$WBSy)
         sleep(500)
         Send("{BS 8}")
         send($smsg,1)
         sleep(250)
         send("{TAB}")
         Send("{DEL 3}")
         send('USD',1)
         sleep(250)
         send("{TAB}")
         Sleep(500)
         Send("{DEL 10}")
         send($FromDate[2] & "." & $FromDate[1] & "." & $FromDate[0])
         send("{TAB}")
         sleep(500)
         Send("{DEL 10}")
         send($ToDate[2] & "." & $ToDate[1] & "." & $ToDate[0])
         send("{F8}")
         Local $search = _ImageSearch('WaitExecute.png', 0, $x, $y, 100)
         $ControlTimer = TimerInit()
         Sleep(250)
         While $Search = 0  and TimerDiff($ControlTimer) < 10000
         Local $search = _ImageSearch('WaitExecute.png', 0, $x, $y, 100)
         wend
         Sleep(250)
         send("{ALT}")
         send("{DOWN}{DOWN}{RIGHT}{DOWN}{DOWN}")
         Send("{ENTER}")
         Sleep(250)
         Local $search = _ImageSearch('WaitSave.png', 0, $x, $y, 100)
         $ControlTimer = TimerInit()
         While $Search = 0  and TimerDiff($ControlTimer) < 10000
         Sleep(250)
         Local $search = _ImageSearch('WaitSave.png', 0, $x, $y, 100)
         wend
         Send("{ENTER}")
         Sleep(1000)
         Local $search = _ImageSearch('WaitSave2.png', 0, $x, $y, 100)
         $ControlTimer = TimerInit()
         While $Search = 0  and TimerDiff($ControlTimer) < 10000
         Local $search = _ImageSearch('WaitSave2.png', 0, $x, $y, 0)
         wend
         sleep(1000)
         MouseMove($x,$y)
         send($smsg & ".txt")
         Send("{ENTER}")
         sleep(2500)
         Send("{ESCAPE}")
         sleep(1000)
         Send("{ESCAPE}")
         Sleep(1000)
         ;End First Pull

For $n = 1 To $iCnt - 1
        $sMsg = _GUICtrlListBox_GetText($hLB, $n)
         ;Process in SAP
         ;Enter WBS
         MouseClick("Left",$WBSx+150,$WBSy)
         sleep(500)
         Send("{BS}{BS}{BS}{BS}{BS}{BS}")
         send($smsg,1)
         ; End Enter WBS
         Sleep(250)
         send("{F8}")
         Local $search = _ImageSearch('WaitExecute.png', 0, $x, $y, 100)
         $ControlTimer = TimerInit()
         While $Search = 0  and TimerDiff($ControlTimer) < 10000
         Local $search = _ImageSearch('WaitExecute.png', 0, $x, $y, 100)
         wend
         Sleep(250)
         send("{ALT}")
         send("{DOWN}{DOWN}{RIGHT}{DOWN}{DOWN}")
         Send("{ENTER}")
         Sleep(250)
         Local $search = _ImageSearch('WaitSave.png', 0, $x, $y, 100)
         While $Search = 0  and TimerDiff($ControlTimer) < 10000
         Local $search = _ImageSearch('WaitSave.png', 0, $x, $y, 100)
         wend
         Send("{ENTER}")
         Sleep(1000)
         Local $search = _ImageSearch('WaitSave2.png', 0, $x, $y, 100)
         While $Search = 0  and TimerDiff($ControlTimer) < 10000
         Local $search = _ImageSearch('WaitSave2.png', 0, $x, $y, 100)
         wend
      Sleep(250)
         send($smsg & ".txt")
         Send("{ENTER}")
         sleep(2500)
         Send("{ESCAPE}")
         sleep(1000)
         Send("{ESCAPE}")
         Sleep(1000)

    ;End Process in SAP
    Next




EndSwitch
WEnd


Thank you very much!

Share this post


Link to post
Share on other sites
water

That message means that you try to access an element of an array that does not exist. Seems that $FromDate or $ToDate have not been set properly.
Check the value of this arrays.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
AutoBert

The error maybe affected by different screen-sizes/resolutions. MouseMove is a ugly way to automate a applcation. Tell the name of application, that's helping us to help you, mostly there are better solutions possible.

Share this post


Link to post
Share on other sites
tezari

I Solved the issue, it was an error with the images. The path where my friend was putting the pictures was different from what I had in my machine.

 

Thank you all for repliying!

 

Regards

Share this post


Link to post
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

×