Jump to content

Script Failing -> Here


Recommended Posts

Hey,

I'm attempting to automatically 'Register' a program called Yenka(http://www.yenka.com/), version 3.4.0.

Script:-

Run("C:\Program Files (x86)\Yenka\Software\Yenka.exe")

WinWait("Subjects","choose",10)

ControlSend("Subjects", "", "", "{TAB 8}")

ControlSend("Subjects", "", "", "{SPACE}")

WinWait("Licences","Licences",10) ;<- Script Fails Here

ControlClick("Licences","Licences","[CLASS:QWidget; INSTANCE:13]")

WinWait("Online Activation","",10)

I have found that this program uses Qt, and QWidgets and at the 'Licences' window there isn't a 'usable' title or handle. Can anyone shed some light on this?

Thanks.

Link to comment
Share on other sites

First off I'd try:

Run("C:\Program Files (x86)\Yenka\Software\Yenka.exe")
WinWait("Subjects","choose",10)
ControlSend("Subjects", "", "", "{TAB 8}")
ControlSend("Subjects", "", "", "{SPACE}")
WinWait("Licences","Licences",10) ;<- Script Fails Here
WinActivate("Licences","Licences")
ControlClick("Licences","Licences","[CLASS:QWidget; INSTANCE:13]")
WinWait("Online Activation","",10)

Just because the window exists doesn't mean it has focus - WinActivate() will sort this. Sometimes tho, I have seen a few odd things with WinWait() in the past whereby it just seems to fail. I have had some success with Do/Until, so if the above doesn't work, maybe try this.

Run("C:\Program Files (x86)\Yenka\Software\Yenka.exe")
WinWait("Subjects","choose",10)
ControlSend("Subjects", "", "", "{TAB 8}")
ControlSend("Subjects", "", "", "{SPACE}")
Do
  WinWait("Licences","Licences",10) ;<- Script Fails Here
  WinActivate("Licences","Licences")
Until WinExists("Licences","Licences")
ControlClick("Licences","Licences","[CLASS:QWidget; INSTANCE:13]")
WinWait("Online Activation","",10)

Also, try removing the 10sec timeout from the offending line

Edited by shornw

[font='Comic Sans MS']Eagles may soar high but weasels dont get sucked into jet engines[/font]

Link to comment
Share on other sites

Try MouseClick ( "button" [, x, y [, clicks [, speed ]]] ) copied from help file :graduated:

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

I've tried mouse click, but unfortunately some computers have different screen resolutions and fail.

You can get the position of any window and then use mouseclick to adjust for any difference in screen resolutions. Look at WinGetPos in 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...