Jump to content

Script execution order, maybe timing issue?


Recommended Posts

I am trying to automate a website. Had an issue where clicking a button was to bring up a dialog box where you select a file to upload. The script successfully opened the dialog box, but would not enter the name of the file I wanted to upload. If I manually closed the window and reopened it, the script then was able to see the window and enter the file name. I cannot figure out why its not seeing it the first time. Here is part of the script. I added a bunch of write lines to a text file for debugging purposes. I included that after. So..

...the script part...

filewriteline($file,"looking for: btnNewPresenter")

$tempObj=_IEGetObjByName($oIE,"btnNewPresenter")

_IEAction($tempObj,"click")

_IELoadWait($oIE)

filewriteline($file,"looking for: fleUpload")

$tempObj=_IEGetObjByName($oIE,"fleUpload")

filewriteline($file,"found fleUpload, clicking")

_IEAction($tempObj,"click")

filewriteline($file,"clicked fleUpload")

filewriteline($file,"looking for: Choose File to Upload window")

WinWait("Choose File to Upload")

WinActivate("Choose File to Upload","")

filewriteline($file,"found window, sending presenterImage.jpg file path")

Send("C:UsersjigpigDesktoppresenterImage.jpg{ENTER}")

filewriteline($file,"sent file path")

...this stops with the upload dialog box open but does not proceed. Without stopping the script I check the debug file and this is what's in it...

looking for: btnNewPresenter

looking for: fleUpload

found fleUpload, clicking

It obviously processes the click command as the upload dialog box opens, but it never gets to the writing out the "clicked fleUpload" to the debug file, unless I close the dialog box manually and reopen it, then the script continues correctly. I did using the autoitinfo tool to get the window title. I tried winwaitactive function first, same issue. Also tried using "[CLASS:#32770]" in both functions as that is what the info tool returned as well. Same issue. Any suggestions?

Edited by jiggypiggy
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...