 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Thu Mar 11, 2004 6:46 am Post subject: Shutdown |
|
|
To be able to use the Shutdown command to have the computer go to Suspend / Hibernate mode. Low priority suggestion.
thanks,
beardboy |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Thu Mar 11, 2004 1:50 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Thu Mar 11, 2004 3:22 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Thu Mar 11, 2004 4:28 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
CyberSlug
Joined: 08 Mar 2004 Posts: 3
|
Posted: Fri Mar 12, 2004 2:05 am Post subject: |
|
|
The 37KB file Wizmo provides standby, hibernate, logoff, reboot, and shutdown plus other stuff  |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1718
|
Posted: Fri Apr 09, 2004 10:01 pm Post subject: |
|
|
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") _________________
 |
|
| Back to top |
|
 |
Beastmaster Guest
|
Posted: Sat Apr 10, 2004 1:22 pm Post subject: |
|
|
I guess what beardboy has recommended (but doesn't want to share with me ) was this: Suspend.zip |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Nov 14, 2004 8:24 pm Post subject: Suspend commands |
|
|
Eheh. I should've looked here before I posted. http://www.autohotkey.com/forum/viewtopic.php?p=7592&sid=e4b07ba99fdb951108161048a441d762#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? |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Mon Nov 15, 2004 12:15 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Mon Nov 15, 2004 3:23 pm Post subject: |
|
|
| 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? |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Mon Nov 15, 2004 3:43 pm Post subject: |
|
|
| 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  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10480
|
Posted: Mon Nov 15, 2004 3:47 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Mon Nov 15, 2004 5:04 pm Post subject: |
|
|
FileInstall... (drooling)... Is there anything AHK can't do? Still, I'll be watching for that vbscript inclusion feature. |
|
| Back to top |
|
 |
exhueydriver
Joined: 12 Jul 2004 Posts: 51 Location: Fife,Wa
|
Posted: Tue Nov 16, 2004 2:56 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
Guest
|
Posted: Tue Nov 16, 2004 10:47 am Post subject: |
|
|
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 |
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|