Jump to content
Sign in to follow this  
guimenez

Script to send keystroke "ENTER" or "Alt+f" to device manager drivers installed

Recommended Posts

guimenez

Hello

i want to make a script that when the device manager finish to install the drivers, the script do the "Enter" or "alt+f" key, because after driver installation it asks for click finish.

i'see that the device manager is "mmc.exe"

i hope someone can help me

many thanks

Edited by guimenez

Share this post


Link to post
Share on other sites
PsaltyDS

Hello

i want to make a script that when the device manager finish to install the drivers, the script do the "Enter" or "alt+f" key, because after driver installation it asks for click finish.

i'see that the device manager is "mmc.exe"

i hope someone can help me

many thanks

Look at ControlSend() in the help file.

:)


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

Share this post


Link to post
Share on other sites
guimenez

hi again

i've made this progrss

WinWaitActive("Assistente de actualização de hardware")

Send("{ENTER}")

but just do one time in the first dialog. i want to loop forever till a close the script

thanks

Share this post


Link to post
Share on other sites
PsaltyDS

i want to loop forever till a close the script

Look at While/WEnd or Do/Until in the help file.

:)


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

Share this post


Link to post
Share on other sites
guimenez

Please help me

i know 0% about programming, please give me the code to make that

i want every time that the window appear it press enter.

please

Share this post


Link to post
Share on other sites
PsaltyDS

Please help me

i know 0% about programming, please give me the code to make that

i want every time that the window appear it press enter.

please

I am trying to help. Writing scripts for you is not what we do here. We help people learn and use AutoIt, learning it in the process also, in my case. You start learning AutoIt from the AutoIt3.chm help file that came with it. There are basic tutorials in there and example scripts attached to almost every function listed.

Try the tutorials, then experiment with the examples under While/WEnd. You'll be coding loops in no time!

If you get stuck, post your code here for more help/explanation.

If you just want someone to write it for you, go to Rent-A-Coder in my sig.

:)


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

Share this post


Link to post
Share on other sites
guimenez

hi

you are right, i need to try it.

ok now its almost working

this is my code:

$i = 0

Do

WinWaitActive("Assistente de actualização de hardware")

Send("{ENTER}")

$i = $i + 1

Until $i = 100

it works very well, the main problem its that it just work if the window is active, i think it the WinWaitActive - do you know what

is the command to do that without waiting for the active window?

many thanks, now i'm liking programming

Share this post


Link to post
Share on other sites
PsaltyDS

hi

you are right, i need to try it.

ok now its almost working

this is my code:

$i = 0

Do

WinWaitActive("Assistente de actualização de hardware")

Send("{ENTER}")

$i = $i + 1

Until $i = 100

it works very well, the main problem its that it just work if the window is active, i think it the WinWaitActive - do you know what

is the command to do that without waiting for the active window?

many thanks, now i'm liking programming

Yes, ControlSend() has the parameters to specify the target window, even if it's minimized, and should generally be used in place of Send() because it is more reliable:
ControlSend("Assistente de actualização de hardware", "", "", "{ENTER}")
Check it out in the help file.

P.S. You probably want a Sleep(250) inside that loop to keep it from sucking up all your CPU cycles.

:)

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

Share this post


Link to post
Share on other sites
guimenez

Thanks a lot, it work like a charm :)

thanks

the worst problem its that when xp install and appears the drivers, it doesn't permit run the exe before the drivers, so my experience doesn't work.

But many thanks, because now i'm learning something about programming

Share this post


Link to post
Share on other sites
guimenez

Hi

Unfortunately, it won't work 100% :)

ok this is my code now

$i = 0

Do

WinWaitActive("Assistente de novo hardware encontrado")

Send("!s")

WinWaitActive("Assistente de novo hardware encontrado")

Send("{ENTER}")

$i = $i + 1

Until $i = 10000

The Enter its not a good point, because sometimes it return to previous window.

How can i know what is the button (Finish) and (Next)

may be i can use the button like this

WinWaitActive("Assistente de novo hardware encontrado")

Send("Next button")

WinWaitActive("Assistente de novo hardware encontrado")

Send("Finish Button")

Please, hope anyone can help me with the buttons

Thanks

Share this post


Link to post
Share on other sites
PsaltyDS

The Enter its not a good point, because sometimes it return to previous window.

How can i know what is the button (Finish) and (Next)

may be i can use the button like this

WinWaitActive("Assistente de novo hardware encontrado")

Send("Next button")

WinWaitActive("Assistente de novo hardware encontrado")

Send("Finish Button")

Please, hope anyone can help me with the buttons

Thanks

Use the AU3Info.exe tool to examine the windows involved. You should see control information for the buttons. If the buttons are created with the window, their text may be visible in WinGetText(). Again, the AutoIt Window Info tool will show you what is there. If "Next" has the "N" underlined to indicate the Alt-n hot key, then the text for the button might be "&Next", or "&Finish". You can then test for it with something like:
WinWait("Assistente de novo hardware encontrado")
$sWinText = WinGetText("Assistente de novo hardware encontrado")
If StringInStr($sWinText, "&Next") Then
    ControlSend("Assistente de novo hardware encontrado", "", "", "!n")
ElseIf StringInStr($sWinText, "&Finish") Then
    ControlSend("Assistente de novo hardware encontrado", "", "", "!f")
EndIf

:)


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

Share this post


Link to post
Share on other sites
faire

Look up "WinZip Installation" in the help file. It's a great tutortial to learn the basics on window automation.

Share this post


Link to post
Share on other sites
guimenez

Thanks for all traying to help me

ok, i will try it in the afternoon

The problem its that the Finish don't have the F underlined, but i will try it.

many thanks

Share this post


Link to post
Share on other sites
guimenez

ok

this is what i did, but doesn't make nothing :)

$i = 0

Do

WinWait("Assistente de novo hardware encontrado")

$sWinText = WinGetText("Assistente de novo hardware encontrado")

If StringInStr($sWinText, "$Seguinte") Then

ControlSend("Assistente de novo hardware encontrado", "", "", "!s")

ElseIf StringInStr($sWinText, "Concluir") Then

ControlSend("Assistente de novo hardware encontrado", "", "", "ENTER")

EndIf

$i = $i + 1

Until $i = 10000

this are the 2 screenshots of my windows

screenshot 1st windows: http://img186.imageshack.us/my.php?image=window1hj9.jpg

screenshot 2st windows: http://img329.imageshack.us/my.php?image=window2ef9.jpg

thanks

Share this post


Link to post
Share on other sites
PsaltyDS

If StringInStr($sWinText, "$Seguinte") Then

ControlSend("Assistente de novo hardware encontrado", "", "", "!s")

ElseIf StringInStr($sWinText, "Concluir") Then

ControlSend("Assistente de novo hardware encontrado", "", "", "ENTER")

EndIf

Don't put the variable name inside quotes unless you want to test for that literal string "$Seguinte". If that is button text with the "S" underlined then it is more likely "&Seguinte" you want.

The Send code for enter is "{ENTER}", what you have sends five letters: E N T E R

Try:

If StringInStr($sWinText, "&Seguinte") Then
    ControlSend("Assistente de novo hardware encontrado", "", "", "!s")
ElseIf StringInStr($sWinText, "Concluir") Then
    ControlSend("Assistente de novo hardware encontrado", "", "", "{ENTER}")
EndIf

If that was supposed to be a variable, then:

If StringInStr($sWinText, $Seguinte) Then

:)

Edit: added more info

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

Share this post


Link to post
Share on other sites
guimenez

Hi people, finally i'm almost done

it work flawless but now i have a 3rd window, please how can i do to

keep the auto click option

this is my working code:

$i = 0

Do

WinWait("Assistente de novo hardware encontrado")

$sWinText = WinGetText("Assistente de novo hardware encontrado")

If StringInStr($sWinText, "Seguinte") Then

ControlSend("Assistente de novo hardware encontrado", "", "", "!s")

ElseIf StringInStr($sWinText, "Concluir") Then

ControlSend("Assistente de novo hardware encontrado", "", "", "{ENTER}")

EndIf

$i = $i + 1

Until $i = 10000

My new window as the info "Alteração das definições do Sistema"

and the button says "Sim" with S underlined

thanks

Share this post


Link to post
Share on other sites
PsaltyDS

Hi people, finally i'm almost done

it work flawless but now i have a 3rd window, please how can i do to

keep the auto click option

this is my working code:

$i = 0

Do

WinWait("Assistente de novo hardware encontrado")

$sWinText = WinGetText("Assistente de novo hardware encontrado")

If StringInStr($sWinText, "Seguinte") Then

ControlSend("Assistente de novo hardware encontrado", "", "", "!s")

ElseIf StringInStr($sWinText, "Concluir") Then

ControlSend("Assistente de novo hardware encontrado", "", "", "{ENTER}")

EndIf

$i = $i + 1

Until $i = 10000

My new window as the info "Alteração das definições do Sistema"

and the button says "Sim" with S underlined

thanks

Just repeat the process that worked before:

1. Use AU3Info.exe to gather information on the Window/Control.

2. Make sure your script is referencing the correct window.

3. Make sure your script is referencing the correct control.

If you get stuck post the code for the part that doesn't work, but try to get it yourself first.

Like the Waterboy: "You can DOO IT!

:)


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

Share this post


Link to post
Share on other sites
guimenez

thanks once again

this is my new code

$i = 0

Do

WinWait("Assistente de novo hardware encontrado")

$sWinText = WinGetText("Assistente de novo hardware encontrado")

If StringInStr($sWinText, "Seguinte") Then

ControlSend("Assistente de novo hardware encontrado", "", "", "!s")

ElseIf StringInStr($sWinText, "Concluir") Then

ControlSend("Assistente de novo hardware encontrado", "", "", "{ENTER}")

EndIf

WinWait("Alteração das definições do sistema")

$aWinText = WinGetText("Alteração das definições do sistema")

If StringInStr($aWinText, "Sim") Then

ControlSend("Alteração das definições do sistema", "", "", "!s")

EndIf

$i = $i + 1

Until $i = 10000

but it seems that don't do the 3rd window that appears in the final

thanks

Share this post


Link to post
Share on other sites
PsaltyDS

thanks once again

this is my new code

$i = 0

Do
    WinWait("Assistente de novo hardware encontrado")
    $sWinText = WinGetText("Assistente de novo hardware encontrado")
    If StringInStr($sWinText, "Seguinte") Then
        ControlSend("Assistente de novo hardware encontrado", "", "", "!s")
    ElseIf StringInStr($sWinText, "Concluir") Then
        ControlSend("Assistente de novo hardware encontrado", "", "", "{ENTER}")
    EndIf
    
    WinWait("Alteração das definições do sistema")
    $aWinText = WinGetText("Alteração das definições do sistema")
    If StringInStr($aWinText, "Sim") Then
        ControlSend("Alteração das definições do sistema", "", "", "!s")
    EndIf

    $i = $i + 1
Until $i = 10000

but it seems that don't do the 3rd window that appears in the final

thanks

Please start using Tidy (Ctrl-t in SciTE) to format your script, and then put it in code tags. Makes it much easier to read... :)

The script you posted only has handlers for two windows, where does this third window show up in there?

:)


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

Share this post


Link to post
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
Sign in to follow this  

×