Jump to content

windows startup sciript


S4nder
 Share

Recommended Posts

Hello,

I'am new to AutoIt and trying to make a script that backups employees certificates when the startup.

This can be done by the "cipher /x" command.

I want to use AutoIt to press enter at this screen:post-32906-1204292167_thumb.jpg and after that press 2 times enter in the dos/command screen: post-32906-1204292544_thumb.jpg

Sometimes the script works perfect but sometimes i experience a problem.

The window got pushed to the background (not active anymore) because other programs are starting as well and the right window wont activate anymore and .

Is there some kind of trick to keep activating a window until ok/enter is pressed?

This is what i got now:

Run ("cipher /x C:\efsbackup\personal")
WinWaitActive ("[CLASS:#32770]", "")
Send ("{ENTER}")
WinWaitActive ("[CLASS:ConsoleWindowClass]", "")
Send ("{ENTER}")
Send ("{ENTER}")

I also tried to do it this way but no results:

Run ("cipher /x C:\efsbackup\personal")
Sleep (100)
If WinExists("[CLASS:#32770]", "") Then
    If WinActive("[CLASS:#32770]", "") <> 0 Then
        WinActivate("[CLASS:#32770]", "")
    EndIf
    WinWaitActive ("[CLASS:#32770]", "")
    Send ("{ENTER}")

    If WinActive("[CLASS:ConsoleWindowClass]", "") <> 0 Then
        WinActivate("[CLASS:ConsoleWindowClass]", "")
    EndIf
    WinWaitActive ("[CLASS:ConsoleWindowClass]", "")
    Send ("{ENTER}")
    Send ("{ENTER}")
Endif

I tried the normal names of the windows but didnt select them, selecting by class works for me.

I also tried it with a While...WEnd and Do...Until but didnt work.

If there is any missing information or ideas please let me know :)

I've searched this forum with no luck.

Edited by S4nder
Link to comment
Share on other sites

yes i tried that before and also works, but the problem is it deactivates the first "ok"-"cancel" window so i dont even get to the dos prompt.

With deactivating i mean its gray in the taskbar/ not active

I think the solution is some kind of loop which keep activating the popup (see picture above) and pressing enter untillit doesnt exists anymore

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