ShutdownWindows

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
mrh32
Newbie
Posts: 13
Joined: Thu Feb 20, 2003 3:06 pm

ShutdownWindows

Post by mrh32 » Fri Feb 28, 2003 8:32 pm

Hi, I was looking through the reference file today and noticed an interesting command called ShutdownWindows. I would like to use this command along with the getCursor position command to make my scripts run more securely (i.e. if a person moves the mouse when no one is supposed to be at the machine, the machine will stop doing whatever it is doing and immeadiately log out). I tried the following lines of code and have recieved mixed results

wait>5.0
mousemove>800,600
label>mouseCheck
wait>0.5
getcursorpos>x,y
if>x=800,checkY,mouseBad
label>checkY
if>y=600,mouseCheck,mouseBad
label>mouseBad
timestamp>c:\logon.txt,I had to shutdown because the mouse got moved
ShutDownWindows>3

At first I tried using ShutDownWindows>2, which would log me off instead of shutting everything down. This is really the functionality that I want, but unfortunately if any Microsoft applications are running a little Dialogue box pops up telling me that I should quit out of all Microsoft applications before logging off, and the log off command doesn't finish, leaving the intruding person with full access to the machine. I figured I would try ShutDownWindows>3 instead because this is supposed to ignore these windows (which it does) and just shut down. The first time I ran this, it worked perfectly and instantly logged me out, even with Microsoft Apps running (it didn't shut the system down as I expected it would, but this doesn't really bother me because I didn't really want the system to shut down anyways, just to lock itself). Unfortunately after the first good test run I have been unable to replicate these results (I have tried so many times now that I am left wondering if the first test run wasn't just a figment of my imagination). Now it quits out of open applications, but leaves the machine in a kind of limbo state where you can browse through the system, but if you try to open any new application it gives you a dialogue box saying that windows is shutting down and you aren't allowed to open any new apps. I end up having to push the physical power button to make it restart and it doesn't prevent users from browsing around your harddrive (though they can't open anything that they may find, they can still browse around and find stuff). If you have any ideas as to why this little macro isn't working the way it was any more, or of a way to do something similar to what it is intended to do please clue me in. Thanks.

--Matt

Lumumba

Post by Lumumba » Sat Mar 01, 2003 12:57 am


armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sat Mar 01, 2003 11:17 pm

Hi Matt,

Your narrative sound likes a fierce competition of taking control between Macro Scheduler and Windows. In this case, the drastic measure of pressing power switch isn't necessary. All you need is to quit Macro Scheduler by:
1. right-clicking "Gear" icon in the system tray;
2. clicking "quit" (4th choice from the top).
Now Windows should resume normality.

Shutting down Windows isn't a simple business as we might imagine. There are many factors and situations you may have to consider respectively case by case, pc by pc,..... Questions like:
1. Is your PC online?
2. Is your PC connected to LAN and/or WAN?
3. Are there any unsaved XLS files?
4. Are there any actively running Macro scripts?
5. Does the sound card handle shutdown gracefully?
6. And many more...

Having said that, you may wish to try out a freeware app POWEROFF from http://users.pandora.be/jbosman/applications.html written by a Belgium gentleman, Jorgen Bosman http://users.pandora.be/jbosman/index.htm).

Please keep posting and sharing your Macro scripting experiences with us.

mrh32
Newbie
Posts: 13
Joined: Thu Feb 20, 2003 3:06 pm

Thanks

Post by mrh32 » Mon Mar 03, 2003 2:40 pm

That article that Lumumba referenced was perfect! If I replace the line

Shutdown>3

with

Run Program>rundll32 user32.dll,LockWorkStation

It works exactly the way I want it to, locking out of the workstation instantly, even with Microsoft programs running. In case anyone else ever reads this thread, please note that this was done using Windows 2000 and that the command will probably be different for different OSes. Thanks again guys, especially Lumumba.

--Matt

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Tue Mar 04, 2003 12:19 am

Lumumba & Matt,

Thanks a lot for your valuable scripting tips.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts