Jump to content

Cant get autoit to send the keystrokes


Recommended Posts

; Script Start - Add your code below here
Opt("TrayIconDebug", 1)

run("Setup")
winwait("hold","hold",5);wait so i can move mouse over autoit in system tray
WinWaitactive("PowerDVD Setup","Welcome to the InstallShield")
send("!n")
WinWaitActive("PowerDVD Setup","License Agreement")
send("!y")
WinWaitActive("PowerDVD Setup","Installing Following Programs")
send("!n")
WinWaitActive("PowerDVD Setup","Customer Information")
send("user")
send("{TAB}")
send("user")
send("{TAB}")
send("xxxxxxxxxxx")

I am trying to make an auto install to Cyberlink PowerDVD 5.0.

If I mouse over the icon in system tray it will step thru to the next line in code but it does not seem to register the keystrokes to press next. So at that point Autoit is sitting at next line of code the winwaitactive but I still need it to hit !N. If I hit alt N myself it will move to the screen autoit is waiting to see then Autoit moves to next winwaitactive screen.

I am sure it is something simple that I have not done but any input about what that is would be greatly appreciated.

Thanks,

Brad

Link to comment
Share on other sites

From the help file under Send():

N.B. Some programs are very choosy about capital letters and ALT keys, i.e. "!A" is different to "!a". The first says ALT+SHIFT+A, the second is ALT+a. If in doubt, use lowercase!

Your script has lower case !n, but your comments discuss upper case !N. This may be one of those 'choosy' apps.

:shocked:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

From the help file under Send():

Your script has lower case !n, but your comments discuss upper case !N. This may be one of those 'choosy' apps.

:shocked:

tried it both ways did not seem to help any other thoughts?

send("!n")

send("!N")

Link to comment
Share on other sites

Opt("TrayIconDebug", 1)

run("Setup")

winwait("hold","hold",5)
WinWaitactive("PowerDVD Setup","Welcome to the InstallShield")
;winwait("hold","hold",5)
controlsend("PowerDVD Setup","",52,"!N")
send("!n")
send("!N")
;winwait("hold","hold",5)
WinWaitActive("PowerDVD Setup","License Agreement")

also switched it to controlsend and it still moves on to next winwaitactive without moving forward on the install.

Link to comment
Share on other sites

tried it both ways did not seem to help any other thoughts?

send("!n")

send("!N")

I don't have the powerquest installer to test with, but maybe a better approach would be to use the au3info tool (ctrl+F6 from scite, works only if you are working on a script that was already saved due to scite limitations) to find out the control names in the installer, and then use ControlSend to click them. This will make it more reliable too.

Cheers.

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

Sometimes this snippet by JdeB shows a different result than Window Info. Run it and hover over a control. In the display at the bottom of the edit it will show what control has focus.

While 1

ConsoleWrite('ControlGetFocus("") = ' & ControlGetFocus("") & @crlf )

sleep(1000)

WEnd

Link to comment
Share on other sites

Get the control IDs with AutoIt Window Info tool and use those.

And by the way:

winwait("hold","hold",5)
Is this a substitute for:

Sleep(5000)

?

:shocked:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I don't have the powerquest installer to test with, but maybe a better approach would be to use the au3info tool (ctrl+F6 from scite, works only if you are working on a script that was already saved due to scite limitations) to find out the control names in the installer, and then use ControlSend to click them. This will make it more reliable too.

Cheers.

ok

Press CTRL-ALT-F to freeze the display.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<

Title: PowerDVD Setup

Class: #32770

Size: X: 260 Y: 194 W: 504 H: 380

>>>>>>>>>>> Mouse Details <<<<<<<<<<<

Screen: X: 621 Y: 546

Cursor ID: 15

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<

RGB: Hex: 0x000000 Dec: 0

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<

Size: X: 323 Y: 319 W: 75 H: 23

Control ID: 1

ClassNameNN: Button1

Text: &Next >

Style: 0x50030001

ExStyle: 0x00000004

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<

>>>>>>>>>>> Visible Window Text <<<<<<<<<<<

&Next >

Cancel

< &Back

PowerDVD's playback performance depends on the power of your system's hardware.

A system with Pentium II 350 or above or any AMD Athlon CPU is highly recommended.

Welcome to the InstallShield Wizard for PowerDVD

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

C

is what i get when i mouse over the next button on first window so i set the control send to

controlsend("PowerDVD Setup","Next",1,"!n")

still does not move forward any other thoughts?

Link to comment
Share on other sites

...

is what i get when i mouse over the next button on first window so i set the control send to

controlsend("PowerDVD Setup","Next",1,"!n")

still does not move forward any other thoughts?

Note that the ampersand '&' is significant if you want to match text on '&Next'. And you want to ControlClick on the button. Try:

ControlClick("PowerDVD Setup","&Next",1)
; Or
ControlClick("PowerDVD Setup","&Next","Button1")

:shocked:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Note that the ampersand '&' is significant if you want to match text on '&Next'. And you want to ControlClick on the button. Try:

ControlClick("PowerDVD Setup","&Next",1)
; Or
ControlClick("PowerDVD Setup","&Next","Button1")

:shocked:

Opt("TrayIconDebug", 1)

run("Setup")

winwait("hold","hold",5)
WinWaitactive("PowerDVD Setup","Welcome to the InstallShield")
;winwait("hold","hold",5)
controlsend("PowerDVD Setup","&Next >",1,"!N")
controlsend("PowerDVD Setup","&Next",1,"!n")
ControlClick("PowerDVD Setup","&Next",1)
ControlClick("PowerDVD Setup","&Next","Button1")
send("!n")
send("!N")
;winwait("hold","hold",5)
WinWaitActive("PowerDVD Setup","License Agreement")
send("!y")

Ok i added the control click into the code and it keeps steping thru the first winwaintactive and goes to the next one so it is going thru the conrolsends and control clicks but no such luck on haivng it change to the License agreement screen.

Link to comment
Share on other sites

I am not sure if this will be any help. But I had some issues setting up installers in Autoit as well. I wound up throwing in some sleep(s) here and there after my Send("!n") and it seemed to work. I would throw them in and figure out where/what was causing the issue with it hanging and then fix it. It worked for me at least. I would throw in five or six second sleeps and that would get me through the install. I would then shorten and gradually remove them one at a time to at least figure out right where I was having the issue. Like I said it worked for me and hopefully will help you out.

EDIT: Spelling

Edited by Wolffe
Link to comment
Share on other sites

Wait, why did you switch to using the text from the button? Why not:

Opt("TrayIconDebug", 1)

run("Setup")
WinWaitactive("PowerDVD Setup","Welcome to the InstallShield")
Sleep(500)
controlclick("PowerDVD Setup","Welcome to the InstallShield",1)
WinWaitActive("PowerDVD Setup","License Agreement")
Sleep(500)
ControlClick("PowerDVD Setup","License Agreement",1) ; May have to tweak control ID for 'Yes' button

:shocked:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Wait, why did you switch to using the text from the button? Why not:

Opt("TrayIconDebug", 1)

run("Setup")
WinWaitactive("PowerDVD Setup","Welcome to the InstallShield")
Sleep(500)
controlclick("PowerDVD Setup","Welcome to the InstallShield",1)
WinWaitActive("PowerDVD Setup","License Agreement")
Sleep(500)
ControlClick("PowerDVD Setup","License Agreement",1) ; May have to tweak control ID for 'Yes' button

:shocked:

hum also no go i used the ; to comment out all my code i had and put in the above code that you posted still sitting waiting at winwaitactive license agreement untill i click the next button or alt n.

Link to comment
Share on other sites

hum also no go i used the ; to comment out all my code i had and put in the above code that you posted still sitting waiting at winwaitactive license agreement untill i click the next button or alt n.

Now wait a cotton pickn' minute! In your code previously, hitting !N was the reply to "Welcome to the InstallShield". The reply to "License Agreement" was !y (alt-y). If it went on to the License window, then the !N worked. I put a comment in my last that the control ID might not be 1 on the presumed 'Yes' button.

:shocked:

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Now wait a cotton pickn' minute! In your code previously, hitting !N was the reply to "Welcome to the InstallShield". The reply to "License Agreement" was !y (alt-y). If it went on to the License window, then the !N worked. I put a comment in my last that the control ID might not be 1 on the presumed 'Yes' button.

:shocked:

Ok here is what i have

Yes first window you come to says

(Title) PowerDVD Setup

(Text in window)
Welcome to the InstallShield Wizard for PowerDVD

PowerDVDs Playback performance depends on the power of your system hardware.
A system with a Pentium II 350 or above or any AMD Athlon CPU is highly recommended

(control choices)
<Back   Next>  Cancel

Second window

(title) Power DVD Setup

(text in window)
License Agreement
Please read ghe following License agreement carefully

(control Choices)
<Back  Yes   No

So I have WinWaitactive("PowerDVD Setup","Welcome to the InstallShield")

Then I have send !n (alt n) or controlsend

After this it has another winwaitactive that says

WinWaitActive("PowerDVD Setup","License Agreement")

It goes thru the first winwaitactive because that was true then it would hit the send alt n or using the controlsend ect. The script has to have done all of sends I have ask it to because if you mouse over the icon in the task bar it says it is waiting at the next winwaitactive in code. (The one that is waiting on the words License agreement).

If I click next or hit alt n the script would then move on to next line because it would now be on Window 2. (The one that has License Agreement on it) At that point I have deleted / commented out rest of the code below this part so the script would finish out.

I keep copying in parts of code people have posted as suggesting on how to make this work. Before the post you last posted I had about 4 types of sends, 3 controlssends and another 2 controlclicks in a row none of them hit the first Next for me to get me out of the first window and into the second. Each time I run it I can mouse over the autoit in the system tray and it will be stuck at the WinWaitActive("PowerDVD Setup","License Agreement"). So I exit it out of system tray change something in script.au3 file save it rerun the script au3 file.

Thanks for all the suggestions and help btw.

Link to comment
Share on other sites

Just a couple of long shots from a fella who is still making lots of mistakes.

1. When you use Window Info click the border of the window first to be sure it is focused. Same happens if you actually click the button. This probably not the case as what you are seeing looks like the correct window.

2. Freeze the Info Window while you are hovering over the control and highlight and copy the control info and copy into your text. This way you get the number of blanks, etc right. Sometimes I Agree is actually 'I &Agree' not '&I Agree'.

3. If all else fails get the window focused and try Send('{Enter}').

jh

Link to comment
Share on other sites

I don't have myself the PowerDVD to play with ... but .. I'm thinking that when you reach the "Licence Agreement", in 99% of the cases you have something like 2 radio buttons (one for accepting the agreement and one for not accepting) or maybe a checkbox ... anyway - something to show that you agree so the setup can continue. The reason is: you can't install the product if you don't agree to terms.

So - to make a summary: maybe there is another control which needs to be checked in order to enable the "Next" button. If the button is disabled then obviously nothing can work.

Anyway ... it is only an idea.

Another idea: take a screenshot of this "Licence Agreement" and post it here ... that will help alot.

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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