twax462 Posted August 30, 2014 Share Posted August 30, 2014 I'm trying to make a script work that will put my HTPC into sleep/standby mode on a particular keypress (cntrl+alt+s in this instance). I found the following code online, but unfortunately it doesn't seem to work. I don't have any experience writing scripts and am pretty unfamiliar with the syntax so I googled around to find an answer or an alternate script but so far have been unable to make anything work. Creating a windows shortcut won't work in this instance, it has to be a script. I'd appreciate any help that anyone could provide. Thanks in advance! ;Sleep system: (ctrl+alt+s)^!s::DllCall("PowrProfSetSuspendState", "int", 0, "int", 0, "int", 0)return Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 30, 2014 Moderators Share Posted August 30, 2014 twax462,Welcome to the AutoIt forums. That does not look like AutoIt syntax, more like AutoHotKey - are you sure you are in the right place? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
twax462 Posted August 30, 2014 Author Share Posted August 30, 2014 twax462, Welcome to the AutoIt forums. That does not look like AutoIt syntax, more like AutoHotKey - are you sure you are in the right place? M23 You're absolutely right. I had misread the post that I got the code from and made the mistake of thinking it was an autoit script as opposed to AutoHotKey. That's what hours spent configuring Flirc, a logitech remote, and XBMC have done to my brain. My apologies...but thank you for the quick respose. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 30, 2014 Moderators Share Posted August 30, 2014 twax462,No problem. But are you sure you do not want to use AutoIt rather than its inferior spin-off? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
twax462 Posted August 30, 2014 Author Share Posted August 30, 2014 twax462, No problem. But are you sure you do not want to use AutoIt rather than its inferior spin-off? M23 Haha. At this point in time I'm inclined to use whatever gets the job done. I was able to get that code working as-is in AHK, but if someone feels inclined to come up with something equivalent for me with AutoIt that will work then I'd be happy to give that a try. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 30, 2014 Moderators Share Posted August 30, 2014 twax462,It looks as if this should work (untested): #include< AutoItConstants.au3> HotKeySet("^!s", "_Standby") While 1 Sleep(10) WEnd Func _Standby() Shutdown($SD_STANDBY) EndFuncM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now