Jump to content

Recommended Posts

Posted

I'm trying to use AutoIt to automate an application.  So far my script "Run"s the app and the intial window opens.  I'm trying to click "File" "Open" but can't get the app to do anything. 

I'm running AutoIt Window Info and can get the hWnd and Command Id's on a toolbar but can't seem to trigger them.

Are there any examples  to show how to do this?

Posted (edited)

Add a 5 second sleep after the WinWait.  Just to test if the window needs more time to become ready to accept commands.

; Script Start - Add your code below here
#include <MsgBoxConstants.au3>

Local $pId = Run("C:\Program Files (x86)\Equis\The DownLoader\Dlwin.exe")
Sleep(4000)  ; Wait for splash screen
Local $hWnd = WinWaitActive("The DownLoader", "", 10)
Sleep(5000); ADDED LINE TO PAUSE SCRIPT 5 SECONDS
MsgBox($MB_SYSTEMMODAL, "hWnd", $hWnd)
ControlClick($hWnd,"","[ID:57601]")

 

Edited by Xandy
Posted

I can't get the menu items, but I tried some of the notepad examples and same thing.

I can get Commad ID of a toolbar but can't simulate click.

Posted
3 minutes ago, Xandy said:

Add a 5 second sleep after the WinWait.  Just to test if the window needs more time to become ready to accept commands.

; Script Start - Add your code below here
#include <MsgBoxConstants.au3>

Local $pId = Run("C:\Program Files (x86)\Equis\The DownLoader\Dlwin.exe")
Sleep(4000)  ; Wait for splash screen
Local $hWnd = WinWaitActive("The DownLoader", "", 10)
Sleep(5000); ADDED LINE TO PAUSE SCRIPT 5 SECONDS
MsgBox($MB_SYSTEMMODAL, "hWnd", $hWnd)
ControlClick($hWnd,"","[ID:57601]")

 

Still nothing.

Posted
2 hours ago, jdelaney said:

You didn't look into 'accelerators' as I advised!   go back and try again.

By accelerator I'm assuming you mean &File and so on.  I did try accelerators but those didn't work either.

Posted
4 hours ago, Au3Builder said:

Put this code after WinWaitActive. It should invoke a menu item (File) in the app. I know it works with notepad.

Send("{ALT}+F")

Success.  But it seems this is trial and error try ControlClick, try WinMenuSelectItem, try Send.

Posted

I'm still trying to understand what some of these commands do.  What's wrong with the following code excerpt.

; Open file from toolbar
$iStartTime = _Timer_Init()
Local $vResult = ControlCommand($hWnd,"",59394,"SendCommandID",57601)
MsgBox($MB_SYSTEMMODAL, "",_Timer_Diff($iStartTime))

; Open dialog appears but the next command doesn't see it
$iStartTime = _Timer_Init()
$vResult = WinWait("Open","",10)
MsgBox($MB_SYSTEMMODAL, "",_Timer_Diff($iStartTime))

; MsgBox appears 10 seconds after I close Open file dialog

Posted
3 minutes ago, jdelaney said:

You'll need to start a second process to do the controlcommand.  your script is deadlocked.

ControlCommand works and a dialog box with title "Open" appears.  My interpretation of WinWait is to make sure the dialog has opened.

What do you mean by and how do I start a second process?

Posted (edited)

The window opens, but you are waiting on the parent window to return success.   which won't happen until the popup is closed.   in the helpfile, search command line variables for examples of running a line of script as a second process.

 

You can verify this by putting a msgbox right after the control command call.  the msgbox won't come up until you close the window.   then your script waits 10 seconds while failing to find the already closed window.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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
  • Recently Browsing   0 members

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