AutoHotkey Community

It is currently May 27th, 2012, 7:35 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Shutdown
PostPosted: March 11th, 2004, 7:46 am 
Offline

Joined: March 2nd, 2004, 10:10 pm
Posts: 443
Location: SLC, Utah
To be able to use the Shutdown command to have the computer go to Suspend / Hibernate mode. Low priority suggestion.

thanks,
beardboy


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2004, 2:50 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
You might want to try "Send, {Sleep}" with the latest version. I think it's the equivalent of pressing the sleep button on your keyboard or computer (if it has one). You might also be able to change what the Sleep button does (hibernate, suspend, etc.) using an OS setting, which I think I remember seeing somewhere.

I'd be interested to know if this is at all helpful. If it is, I will update the docs to mention it in the Shutdown notes.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2004, 4:22 pm 
Offline

Joined: March 2nd, 2004, 10:10 pm
Posts: 443
Location: SLC, Utah
The "Send, {Sleep}" does not work on my laptop. I found a website that has multiple excutables for instant suspend / hibernate.

hibernate(forced).exe
hibernate(neverforce).exe
Hibernate(waitthenforce).exe
suspend(forced).exe
suspend(nerverforce).exe
Suspend(waitthenforce).exe

So I just used the FileInstall to include the file in the AutoHotkey executable.

thanks,
beardboy


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 11th, 2004, 5:28 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Even so, I'll put it further down on the to-list. It's something some people would probably want, so hopefully someday it will get done.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 12th, 2004, 3:05 am 
Offline

Joined: March 8th, 2004, 6:24 am
Posts: 3
The 37KB file Wizmo provides standby, hibernate, logoff, reboot, and shutdown plus other stuff 8)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 9th, 2004, 11:01 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
had a look at this thread by chance... i'm sure the shutdown question is already solved, i'll still suggest some neat alternatives:

try these commands (sleep / hibernate still elusive to me):

Exit Windows
Run("RUNDLL32.EXE","USER.EXE,ExitWindows")

Restart Windows
Run("RUNDLL32.EXE","USER.EXE,ExitWindowsExec")

Logoff Windows 98 and run Explorer after relogon:
Run("RUNDLL32.EXE",SHELL32.DLL,SHExitWindowsEx 4")

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 10th, 2004, 2:22 pm 
I guess what beardboy has recommended (but doesn't want to share with me :lol: ) was this: Suspend.zip


Report this post
Top
  
Reply with quote  
 Post subject: Suspend commands
PostPosted: November 14th, 2004, 9:24 pm 
Eheh. I should've looked here before I posted. http://www.autohotkey.com/forum/viewtop ... 1d762#7592
Just a note though, the rundll32 commands are outdated in XP (They're still necessary in 9x, ME), shutdown.exe can be used instead. As for suspending, all you need is some vbscript. See my post in the linked thread. Btw, can vbscript be run from inside AHK scripts?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 15th, 2004, 1:15 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Quote:
can vbscript be run from inside AHK scripts?
If the .vbs extension is associated with something, you should be able to launch it as a normal document:

Run, something.vbs

For some reason, my XP system appears to be lacking VBS support, so I can't test it.

By the way, thanks for joining the forum Jonny. As an apparent guru, you're a welcome addition.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 15th, 2004, 4:23 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
Actually, what I meant was can the extraneous vbs file be bypassed altogether? Can you actually put the code into the script and have it run internally, or is it still necessary to have the vbs file? And if it still is, then is there a way to amalgamate it using the AHK compiler?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 15th, 2004, 4:43 pm 
Quote:
For some reason, my XP system appears to be lacking VBS support, so I can't test it


Maybe you've disabled the WHS options for secuity reasons :?:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 15th, 2004, 4:47 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
jonny wrote:
Actually, what I meant was can the extraneous vbs file be bypassed altogether? Can you actually put the code into the script and have it run internally
Not currently, but it is a planned feature.

Quote:
is there a way to amalgamate it using the AHK compiler?
You could use FileInstall to include a .vbs file with an EXE. I know its rather awkward.

BoBo wrote:
Maybe you've disabled the WHS options for secuity reasons
Thanks for the tip.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 15th, 2004, 6:04 pm 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
FileInstall... (drooling)... Is there anything AHK can't do? :D Still, I'll be watching for that vbscript inclusion feature.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2004, 3:56 am 
Offline

Joined: July 12th, 2004, 3:51 am
Posts: 51
Location: Fife,Wa
I create *.vbs using FileAppend, just replace your <cr>'s with (`n)
i.e. (this is a GoSub)

VBScript:
FileAppend, Set objFM = WScript.CreateObject ("FMPRO.Application")`nobjFM.Visible=True `nSet objFMfiles = objFM.Documents.Open("%FileNamePath%"`,"")`nobjFMfiles.DoFMScript ("%ScriptName%")`nobjFM.Quit, C:\VBsAhkTest.vbs
Run, C:\VBsAhkTest.vbs
Sleep, 750
FileDelete, C:\VBsAhkTest.vbs

Don

I forgot to add, doing it this way, you can pass variables into the .vbs, as you can see in the above.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 16th, 2004, 11:47 am 
:shock: OMG I never thought of that! That's awesome! Time to go brainstorm the implications...

Aha! People of the AutoHotkey forum, I give you: The vbs2ahk converter! It's really not significant enough to warrant it's own thread, but hey, maybe someone will find it useful. If someone actually cares, I can spiff it up a bit, maybe add support for multiple files at once, and then release it.

Code:
; vbs2ahk script by jonny (copyright everyone)
;
; This script will convert a vbs file into an ad hoc ahk script.
; This does NOT embed the code or convert the code itself to AHK,
; it merely runs the script internally.
;
; It can be run by running the script alone, using dialogs, or
; through the command line. If you use the command line, you must
; include all the parameters or the script will commit honorable
; seppuku. These parameters are,
;
; 1) The input vbs. This can be a relative or absolute path.
; 2) The output ahk. This, too, can be relative or absolute.
; 3) Time in milliseconds to wait for the vbs script to run.
;
; Example: vbs2ahk.exe Shutdown.vbs Shutdown.ahk 1000
;
; No registration required. :-D

If 0 > 0
{
vbs_from = %1%
vbs_to = %2%
vbs_wait = %3%
}
Else
{
FileSelectFile, vbs_from, 3,, Choose the vbs to convert., VBScript (*.vbs)
If vbs_from =
ExitApp
Else
{
InputBox, vbs_to, vbs2ahk, Choose a name for the output ahk.
InputBox, vbs_wait, vbs2ahk, Specify a time in milliseconds to wait for the script to run.`nThis may vary with the size of the script.
}
}
FileAppend, FileAppend`,, %vbs_to%
Loop, Read, %vbs_from%
{
FileAppend, %A_LoopReadLine%``n, %vbs_to%
}
FileAppend, `, 9temp9.vbs`nRun`,9temp9.vbs`nSleep`,%vbs_wait%`nFileDelete`,9temp9.vbs`nReturn,%vbs_to%
Return


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 7 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