Jump to content

Recommended Posts

Posted

omg I would but I can't stop laughing.

I mean seriously dude?

MouseMove(460, 510)
MouseClick("left")

I mean it's probably no slower than

MouseClick("left",460, 510)

...but who write it the 1st way?

And what about

Run ( @ScriptDir & '\program.exe '  )
Sleep (5000)
Send("{enter}")
Sleep(25000)
WinActivate($ProgramName)

What is the 25 seconds for? Does ProgramName run in the background when it starts? Programs normally open and become active so all you need is...

WinWaitActive($ProgramName)

I could go on but you need to read the help file.

Edit: And for the Shutdown all you need is

Shutdown(6)

Edit 2: I assume that Send("{enter}") is maybe because windows asks you if you are sure you want to run it or something like that. If so just figure out what that windows title is and do a WinWaitActive() for that as well, but use the timeout parameter in case it doesn't ask.

Actually i know the window name and changed that in the script before posting. Yes the window ask if im sure thus the "enter" and the 25sec is to ensure the pc has fully booted and loaded the program before running the shutdown.Actually is is a reboot. This script is ran in startup folder.

muppet hands are so soft :)

Posted

But honestly, in order to help you better then you'll need to provide a clear explanation of exactly what you're trying to acheive with Autoit.

A numbered list will be nice.

Posted

Well, try this:

HotKeySet("{F10}", "exitNow")

Func exitNow()
    Exit
EndFunc ;==>exitNow

Global Const $ProgramName = "program name"

While 1
    ToolTip("F10: Exit", 0, 0)

    Sleep(10000)

    RunWait(@ScriptDir & "\program.exe")

    Send("{enter}")

    Sleep(25000)

    WinActivate($ProgramName)
    WinMove($ProgramName, '', 0, 0, 550, 570) ;first is width
    WinWaitActive($ProgramName)

    MouseMove(460, 510)
    MouseClick("left")

    If Not WinActive($ProgramName) Then
        Run("shutdown -r", @ComSpec, @SW_HIDE)
    EndIf

    Sleep(7200000) ; Sleep for two hours only to get up and do it all over again.
WEnd

I will run this, it looks like it will work. Thank you jaberwocky6669 you have been helping me.

muppet hands are so soft :)

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
×
×
  • Create New...