bucky002 Posted February 17, 2006 Posted February 17, 2006 (edited) I Don't know how to work hot keys very well though. I wanna have it so whenever my sister, brother etc pushes o(open cd tray) or c(close cd tray) that it will do that. This code might help alittle.if StringInStr ($con, "pc1") > 0 Then Select Case StringInStr ($con, "opencd") > 0 CDTray ( "d:", "open" ) Case StringInStr ($con, "closecd") > 0 CDTray ( "d:", "close" ) Thanks. Edited February 17, 2006 by bucky002
Valuater Posted February 17, 2006 Posted February 17, 2006 maybe this could help Global $Paused, $CDTray HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("{F9}", "ShowMessage") ;;;; Body of program would go here;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() If $CDTray Then CDTray ( "d:", "close" ) If Not $CDTray Then CDTray ( "d:", "open" ) $CDTray = NOT $CDTray EndFunc 8)
bucky002 Posted February 17, 2006 Author Posted February 17, 2006 Okay, thanks I'll try it later cause I gatta go. Any more help would be appreciated.
bucky002 Posted February 20, 2006 Author Posted February 20, 2006 Can I make a letter instead of f9? Global $Paused, $CDTray HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("{F9}", "ShowMessage") ;;;; Body of program would go here;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() If $CDTray Then CDTray ( "d:", "close" ) If Not $CDTray Then CDTray ( "d:", "open" ) $CDTray = NOT $CDTray EndFunc
cdkid Posted February 20, 2006 Posted February 20, 2006 (edited) change HotKeySet("{F9}", "ShowMessage") to HotKeySet("a letter goes here", "ShowMessage") ~cdkid Edited February 20, 2006 by cdkid AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
bucky002 Posted February 20, 2006 Author Posted February 20, 2006 Thanks I thought I tried that, but yours worked. Thanks.
bucky002 Posted February 20, 2006 Author Posted February 20, 2006 How can I make this work on all users? Global $Paused, $CDTray HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("e", "ShowMessage") ;;;; Body of program would go here;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() If $CDTray Then CDTray ( "d:", "close" ) If Not $CDTray Then CDTray ( "d:", "open" ) $CDTray = NOT $CDTray EndFunc
Valuater Posted February 20, 2006 Posted February 20, 2006 (edited) it works with ... any user.... using it you can also compile it into an exe file 8) Edited February 20, 2006 by Valuater
bucky002 Posted February 20, 2006 Author Posted February 20, 2006 I want it to run on my name so I can switch user then if my sister gets on her name that if will be effective on hers.
Valuater Posted February 20, 2006 Posted February 20, 2006 (edited) place it in the start-up for all users @StartupCommonDir 8) Edited February 20, 2006 by Valuater
bucky002 Posted February 20, 2006 Author Posted February 20, 2006 So it should look like this? @StartupCommonDir Global $Paused, $CDTray HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("e", "ShowMessage") ;;;; Body of program would go here;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() If $CDTray Then CDTray ( "d:", "close" ) If Not $CDTray Then CDTray ( "d:", "open" ) $CDTray = NOT $CDTray EndFunc
Valuater Posted February 20, 2006 Posted February 20, 2006 no... just compile it and put a shortcut in that directory 8)
greenmachine Posted February 20, 2006 Posted February 20, 2006 (edited) Replace the first line (@startupcommondir) with this: FileCreateShortcut (@ScriptFullPath, @StartupCommonDir & "\" & @ScriptName) Actually, more specifically so it doesn't try to run the script as an au3 file: If StringInStr (@ScriptName, ".exe") Then FileCreateShortcut (@ScriptFullPath, @StartupCommonDir & "\" & @ScriptName) EndIf Edited February 20, 2006 by greenmachine
bucky002 Posted February 20, 2006 Author Posted February 20, 2006 (edited) So this would work? If StringInStr (@Script, ".exe") Then FileCreateShortcut (@ScriptFullPath, @StartupCommonDir & "\" & @ScriptName) EndIf Global $Paused, $CDTray HotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") HotKeySet("e", "ShowMessage") ;;;; Body of program would go here;;;; While 1 Sleep(100) WEnd ;;;;;;;; Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Func ShowMessage() If $CDTray Then CDTray ( "d:", "close" ) If Not $CDTray Then CDTray ( "d:", "open" ) $CDTray = NOT $CDTray EndFunc Edited February 20, 2006 by bucky002
greenmachine Posted February 20, 2006 Posted February 20, 2006 (edited) Looks good to me. Almost.. got the first line a little off again. If StringInStr (@Script, ".exe") Then FileCreateShortcut (@ScriptFullPath, @StartupCommonDir & "\" & @ScriptName) EndIf Should be: If StringInStr (@ScriptName, ".exe") Then FileCreateShortcut (@ScriptFullPath, @StartupCommonDir & "\" & @ScriptName) EndIf Edited February 20, 2006 by greenmachine
bucky002 Posted February 20, 2006 Author Posted February 20, 2006 Hmm.. It still doesn't seem to work. It works on mine, but not anyone elses.
greenmachine Posted February 20, 2006 Posted February 20, 2006 (edited) Is the location of the script in a place that anyone can access? Also, I think startup means computer startup. I could be wrong though. Edited February 20, 2006 by greenmachine
bucky002 Posted February 20, 2006 Author Posted February 20, 2006 It's on MY Desktop. Should I put it somewhere else?
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