Jump to content

Interact with certain windows on a locked machine


Recommended Posts

I've read through the documentation and the forum trying to figure out how to run a process completely in the background or rather on a machine that will be locked, so there is no interaction with the desktop. I haven't really seen a full solution to this problem on the forums unfortunately. My process currently can go out to a website and initiate a download (thanks to Dale). Here is the code once it gets to the "File Download" window.

CODE
AutoItSetOption("WinTitleMatchMode", 4)

$handle = WinGetHandle("classname=#32770", "Do you want to open or save this file")

$worked=ControlFocus ($handle, "", "Button2")

Controlclick($worked, "", "Button2",5)

ControlSend($worked,"","Button2","{ENTER}")

WinSetState("File Download","",@SW_MINIMIZE)

The IE window will disappear and I'm left with a "File Download" window and the script quits. At this point I run another script and while it sleeps I lock the PC. When I come back after it has ran I do find the "File Download" window minimized. So I do have some hope left, but I'm still somewhat frustrated.

CODE

sleep(3000)

WinSetState("File Download","",@SW_MINIMIZE)

I'm stuck at this point. With the machine unlocked I can have the script download the file just fine so I know I'm not confused completely. I understand that the documentation says that the Control functions sometimes need to have window focus. Is this possible to manage control clicks or control sends without a view of the desktop?

Any help would be much appreciated.

Thanks,

fract4l

Edited by fract4l
Link to comment
Share on other sites

Instead of

ControlSend($worked,"","Button2","{ENTER}")

try

ControlFocus($worked, "", "Button2")
Controlclick($worked, "", "Button2")

I'm using this way on locked stations with no problems for automatic background imports/exports from/to some app.

Thanks for the reply Zedna. I'm still sorta of stuck however. It looks like the suggestion you made will put focus on the "Save" Button in the "File Download" window from IE, but it can't seem to click the button. It does get the dotted rectangle around it which give me some hope, but I'm still not 100% there yet.
Link to comment
Share on other sites

So I got the sends to work while the machine is unlocked. If i run the same exact script while the machine is locked however it doesn't ever click the Save button. I'm wondering if microsoft has built a feature in that doesn't allow you to download files from IE when your machine is locked because the script is the same whether I am locked or not. :)

Edited by fract4l
Link to comment
Share on other sites

I may be one of the newbies, but I learn pretty fast. :)

Try using InetGet(). You can download directly from a website or ftp without having to mess around with windows and such.

I tested this on a locked machine and it works like a champ. Give it a try.

Have a good one,

- Pas

Link to comment
Share on other sites

Thanks for the reply Zedna. I'm still sorta of stuck however. It looks like the suggestion you made will put focus on the "Save" Button in the "File Download" window from IE, but it can't seem to click the button. It does get the dotted rectangle around it which give me some hope, but I'm still not 100% there yet.

So try:

ControlFocus($worked, "", "Button2")
ControlSend($worked,"","Button2","{ENTER}")
Link to comment
Share on other sites

Thanks for all the suggestions thus far.

Zedna I have tried to do a controlSend and alomst every other combination I can think of but it just doesn't work. I get the same problem it will work if I'm running it unlocked but if I lock it it won't work. I can only assume it is part of an XP firewall security sorta thing considering how much people love to exploit IE. I would love to try to run this in firefox, but i need IE.au3.

GreenHouse: You make a very good suggestion, however the part of the script which I didn't share, only because it is irrelevant, is the IE.au3 script which interacts with the java/html form to produce the download window since the URL is hidden.

If anyone is curious just go to Cnet Winrar download page in IE. Keep the download window open. Then start this script and then immediately lock your PC and see if it works, which I'm assuming it won't. then run it with the PC unlocked and it will work just fine.

CODE
sleep(6000)

AutoItSetOption("WinTitleMatchMode", 4)

$handle = WinGetHandle("classname=#32770", "Do you want to run or save this file")

ControlFocus ($handle, "", "Button2")

ControlClick ($handle, "", "Button2")

sleep(6000)

controlsend($handle, "", "Button2", "{ENTER}")

controlsend($handle, "", "Button2", "{ENTER}")

controlsend($handle, "", "Button2", "{ENTER}")

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