Jump to content

Running AutoIT covertly


dazza
 Share

Recommended Posts

Hmmm.

This Splashscreen fn doesn't work. This is blocking the mouseclicks, controlclicks etc. on the application beneath, so nothing is being done and the script just hangs.

<sigh>

Thanks for the suggestion... anymore? :)

Link to comment
Share on other sites

The splash screen way should work if you use controlclick and controlsend (which are preferred anyways) but not mouseclick and send

If you absolutely must use mouseclick and send, an ugly way might be to force the power to the monitor off. You would have to do this after every step as every mousemove or keypress will wake it up, but if you're fast enough it will turn it off before it fully woke up. As well if you have any long "sleep" periods the user might be able to wake it up. An alternative to this might be to create a separate script that will just keep shutting off the monitor in a fairly tight loop, and then terminate when told by the main script.

Here's a link on powering off the monitor http://www.autoitscript.com/forum/index.ph...c=10831&hl=

Here's some sample code:

$WM_SYSCOMMAND = 274
$SC_MONITORPOWER = 61808
$POWERON = -1
$POWEROFF = 2

Opt('WinTitleMatchMode', 4)
$hwnd = WinGetHandle('classname=Progman')

DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int', $SC_MONITORPOWER, 'int', $POWEROFF)

Sleep(1000)

Run("notepad")
WinWaitActive("Untitled - Notepad")
Send(".....")
DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int', $SC_MONITORPOWER, 'int', $POWEROFF)
send("!f")
DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int', $SC_MONITORPOWER, 'int', $POWEROFF)
send("x")
DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int', $SC_MONITORPOWER, 'int', $POWEROFF)
Sleep(5000)
DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int', $SC_MONITORPOWER, 'int', $POWERON)

You could keep a splash screen up for functions that work with it, then remove it and shut the monitor off for parts that need direct send and mouseclick.

Looking at how TightVNC reacts on one of my computers, I'm quite sure the "Blank screen on client connections" just continuously turns the monitor off.

Edited by TurionAltec
Link to comment
Share on other sites

Many thanks.

The transfer from MouseClicks to ControlClicks and Sends to ControlSends is my first port of call; however the controls I need to click and send to are not standard it seems. The ID is always unique, and the ClassNN reads (for example) TTreeView2. I tried:

ControlSend("window name", "", "[CLASSNN:TTreeview2]", "{ENTER}")

ControlClick("window name", "", "[CLASSNN:TTreeview2]", "right", 1)

And none work...

Do I have to get the handle of the control first and then reference it?

:)

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