Jump to content

Script does not execute


Recommended Posts

I could use some help with the followins script:

#include <GuiMenu.au3>
#include <Misc.au3>
#include <GUIConstantsEx.au3>
#include <GuiToolbar.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>

Global $CommandID = 0, $gui_CommandID, $Paused


Opt("WinTitleMatchMode", 1)


HotKeySet("^q", "Terminate")

WinWaitActive("Siemens  -  E:\Projektai\cargo\PLC\2024-07-11\Cargo\Cargo","")


For $i = 1 to 5
    MouseClick("right",851,372,1,5) ; open menu
    Sleep(1000)
    MouseClick("left",896,382,1) ; click "open editor"
    Sleep(5000)
    MouseClick("left",947,219,1) ; click "Retain
    Sleep(500)
    MouseClick("left",1878,79,1,5) ; close screen
    Sleep(500)
    MouseClick("left",1884,1095,1,5) ; scrol
    Sleep(500)
Next

Func Terminate()
    Exit 0
EndFunc

 

It compiles succesfully, however, when I try to run it nothing happens, no error codes are given, there is no indication that it is beeing executed. Also, I  need to kill it manyally. Any sugjestions on what I'm doing wrong?

 

Edited by Jos
Link to comment
Share on other sites

try

HotKeySet("^q", "Terminate")

Local $hWnd = WinWaitActive("Siemens  -  E:\Projektai\cargo\PLC\2024-07-11\Cargo\Cargo", "", 5)
If $hWnd Then
    ConsoleWrite("$hWnd=" & $hWnd & @CRLF)

    WinActivate($hWnd)
    For $i = 1 To 5
        MouseClick("right", 851, 372, 1, 5) ; open menu
        Sleep(1000)
        MouseClick("left", 896, 382, 1) ; click "open editor"
        Sleep(5000)
        MouseClick("left", 947, 219, 1) ; click "Retain
        Sleep(500)
        MouseClick("left", 1878, 79, 1, 5) ; close screen
        Sleep(500)
        MouseClick("left", 1884, 1095, 1, 5) ; scrol
        Sleep(500)
    Next
Else
    ConsoleWrite("! Window not found" & @CRLF)
EndIf

ConsoleWrite("End" & @CRLF)

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

:welcome: to forum

how-to-post-code-on-the-forum

 

Edit:

first try without compiled
and put some ConsoleWrite in the script so you can monitor the stream

Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

Seems to me that the WinWaitActive is waiting forever to find the window.  Try a WinActivate before, and check if it is finding the right handle...

Also you may want to replace your MouseClick with WinMenuSelectItem (see help file)

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