AutoHotkey Community

It is currently May 27th, 2012, 11:24 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: July 13th, 2009, 11:29 pm 
Offline

Joined: May 29th, 2009, 8:05 am
Posts: 17
How to execute a script when computer is locked, any idea anyone? :roll:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 1:05 am 
You can't. And you shouldn't be able to, it's locked.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 1:49 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
yopu can but your going to have to be much more specific about your desired actions

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 7:13 am 
Offline

Joined: May 29th, 2009, 8:05 am
Posts: 17
yeah suppose it will execute a script when pwer or ntwork cable is unplugged while windows is locked. possible? :?:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 7:19 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Not tested!
Code:
Loop {
   If !DllCall("Wininet.dll\InternetGetConnectedState", Str, "0x40","Int",0)
      Continue
   else
      Run, C:\WINDOWS\system32\rundll32.exe powrprof.dll SetSuspendState
}
ExitApp

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 7:55 am 
Offline

Joined: May 29th, 2009, 8:05 am
Posts: 17
errm, How do I link a .ahk file to it so that it is executed when workstation is locked


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 8:17 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
This is only to test :)
1. take out the network cable
2. start script
3. lock workstation
4. plug in network cable and see if computer hibernates

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 8:40 am 
Duh. For that you need access, both physical, and a login.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 12:32 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
I just tried and rundll32 will cause an error while workstation is locked.

Here a working test:
1 Disconnect network cable
2 Start Script (you will see Tooltip showing 1)
3 Lock workstation
4 connect cable and leave it for a 10 seconds or so.
5 Disconnect cable and unlock workstation
As you see ToolTip counted so code was executed :)
Code:
Loop{
   ToolTip % A_Index
   Loop
      If DllCall("Wininet.dll\InternetGetConnectedState", Str, "0x40","Int",0)
         Break
}

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 2:40 pm 
Offline

Joined: May 29th, 2009, 8:05 am
Posts: 17
thanks babe, i think it is getting closer to wat i want. now im tryna make it work for a .ahk file dat i want to b executed only when workstation is locked ;[


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 2:50 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
Wouldn't a script run while the computer is locked if it were compiled and run as a service?

I've never done this, but may soon have a need for it, so if it is possible (and I think I've seen some AHK as Service threads) I'd be interested in details.

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 3:00 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
Yes but this script does run while locked
this user now wants to ensure the script is running locked or unlocked but only executes while locked and the cable is removed
if the cable is removed while its not locked nothing happens

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 3:23 pm 
Offline

Joined: May 2nd, 2006, 11:16 pm
Posts: 800
Location: Greeley, CO
I guess I misunderstood;
So the script ran while locked, but it was started while unlocked;
Does the script need to actually start while in locked state?

If so, a Service would likely still be in order.

Here's the thread I was remembering...
http://www.autohotkey.com/forum/viewtopic.php?t=38593.

Anyway, I feel like I'm probably muddying the waters here, so I'll let those that have more experience in this field continue to work it out.

I'll be watching for final results, though;
This is an interesting thread.

_________________
Image
SoggyDog
Dwarf Fortress:
"The most intriguing game I've ever played."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 3:46 pm 
Quote:
but only executes while locked and the cable is removed
So the script/box will shout for someone out there to reconnect the cable?? :lol:
TBH, the whole thing is kinda suspicious. Well, nobody is interested to get the whole story ... :!:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 5:29 pm 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
nope i write code all the time designed to run while machine is locked there are a ton of legit reasons none the least include secure unattended jobs.
I would be more concerned with "invisible processes" or scripts that try passwords from a "list " and do this if it fails and that if ti doesnt

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group