Jump to content

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


Recommended Posts

Sorry

there are just two windows, the first works well (Assistente de novo hardware encontrado) but the second

doesn't do nothing (Alteração das definições do sistema)

its not 3 but 2.

thanks

So what is the status of your conditions?

1. Does the window titled "Alteração das definições do sistema" appear when expected?

2. Does your WinWait() recognize it?

3. Does that window contain the text "Sim"?

4. Does it try but fail to send Alt-s, or not send it at all?

One thing to consider is that when the window is created, there may be some delay before all the text is added. Once AutoIt sees the window with WinWait(), it will be checking the text only a few milliseconds later. You might want to add a short delay, or test the text in a loop to avoid timing issues.

:)

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

ok

the problem its that the 1st windows appear lot of time like 20 times, and the 2nd window just appears in the final to restart the windows xp.

and it don't do nothing.

That explains the Do/Until loop around the whole thing. You might want to avoid WinWait() then, or at least set the timeout value to 1:
While 1; Loop forever
    If WinWait("Assistente de novo hardware encontrado", "", 1) Then; Waits for 1 second
        
    ; Do whatever this window requires
        
    EndIf

    If WinWait("Alteração das definições do sistema", "", 1) Then; Waits for 1 second
        
    ; Do whatever this window requires
        
        ExitLoop; Exit loop once this window is handled
    EndIf
WEnd

This will loop forever, handling the first window over and over until the second window appears. Once the second window is detected and handled, it exits the loop.

Hope that helps.

:)

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

this is my code now with your help

While 1

If WinWait("Assistente de novo hardware encontrado", "", 1) Then

    $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

    If WinWait("Alteração das definições do sistema", "", 1) Then

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

If StringInStr($aWinText, "Sim") Then

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

                ExitLoop;

    EndIf

WEnd

does it correct????

thanks

Link to comment
Share on other sites

this is my code now with your help

While 1

If WinWait("Assistente de novo hardware encontrado", "", 1) Then

$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

If WinWait("Alteração das definições do sistema", "", 1) Then

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

If StringInStr($aWinText, "Sim") Then

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

ExitLoop;

EndIf

WEnd

does it correct????

thanks

You are missing a couple of EndIf's, which Tidy would have flagged for you in about 0.25 seconds. Please put your code in ScitTE and run Tidy (Ctrl-t) and syntax checker (Ctrl-F5) before you post your code inside code tags. This will avoid most (not all) stupid mistakes and make your code much easier to read:
While 1
    If WinWait("Assistente de novo hardware encontrado", "", 1) Then
        $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
    EndIf
    If WinWait("Alteração das definições do sistema", "", 1) Then
        $aWinText = WinGetText("Alteração das definições do sistema")
        If StringInStr($aWinText, "Sim") Then
            ControlSend("Alteração das definições do sistema", "", "", "!s")
            ExitLoop 
        EndIf
    EndIf
WEnd

:)

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

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