slightly_abnormal Posted March 20, 2006 Share Posted March 20, 2006 (edited) I've been messing with a hotkey which would hide tray when alt+t is pressed and then appear when alt+t is pressed again, but it just hides the tray, this is loosely based of Andrew Sparkes's code http://www.autoitscript.com/forum/index.php?showtopic=23371 i have no idea of any other ways, or why it doesn't work..Global $trayiconhide="0" HotKeySet("!t","_traytog") Func _Traytog() While 1 If $trayiconhide="0" Then opt("trayiconhide",1) If $trayiconhide=1 Then $trayiconhide="0" Exitloop EndIf If $trayiconhide="1" Then opt("trayiconhide",0) If $trayiconhide=1 Then $trayiconhide="1" Exitloop EndIf WEnd EndFunc while 1 sleep(200) wend Edited March 20, 2006 by slightly_abnormal Link to comment Share on other sites More sharing options...
GaryFrost Posted March 20, 2006 Share Posted March 20, 2006 Global $trayiconhide = 0 HotKeySet("!t", "_Traytog") HotKeySet("{ESC}", "_Terminate") While 1 Sleep(200) If $trayiconhide = 1 Then Opt("trayiconhide", 1) Else Opt("trayiconhide", 0) EndIf WEnd Func _Traytog() $trayiconhide = Not $trayiconhide EndFunc ;==>_Traytog Func _Terminate() Exit EndFunc ;==>_Terminate SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 20, 2006 Author Share Posted March 20, 2006 Global $trayiconhide = 0 HotKeySet("!t", "_Traytog") HotKeySet("{ESC}", "_Terminate") While 1 Sleep(200) If $trayiconhide = 1 Then Opt("trayiconhide", 1) Else Opt("trayiconhide", 0) EndIf WEnd Func _Traytog() $trayiconhide = Not $trayiconhide EndFunc ;==>_Traytog Func _Terminate() Exit EndFunc ;==>_Terminate ha, thanks gary! Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 20, 2006 Share Posted March 20, 2006 I've been messing with a hotkey which would hide tray when alt+t is pressed and then appear when alt+t is pressed again, but it just hides the tray, this is loosely based of Andrew Sparkes's code http://www.autoitscript.com/forum/index.php?showtopic=23371 i have no idea of any other ways, or why it doesn't work.. Global $trayiconhide="0" HotKeySet("!t","_traytog") Func _Traytog() While 1 If $trayiconhide="0" Then opt("trayiconhide",1) If $trayiconhide=1 Then $trayiconhide="0" Exitloop EndIf If $trayiconhide="1" Then opt("trayiconhide",0) If $trayiconhide=1 Then $trayiconhide="1" Exitloop EndIf WEnd EndFunc while 1 sleep(200) wend Maybe take the quotes off the numeric value in your If statements, and I'm not sure I follow your logic: ; Assuming $trayiconhide is only 0 or 1 Func _Traytog() If $trayiconhide=0 Then opt("trayiconhide",1) $trayiconhide=1 Else opt("trayiconhide",0) $trayiconhide=0 EndIf EndFunc I didn't understand why you needed the While() loop in your hotkey function. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
GaryFrost Posted March 20, 2006 Share Posted March 20, 2006 I noticed the problems with the quotes also, here's a shortend version Global $trayiconhide = 0 HotKeySet("!t", "_Traytog") HotKeySet("{ESC}", "_Terminate") While 1 Sleep(200) WEnd Func _Traytog() $trayiconhide = Not $trayiconhide Opt("trayiconhide", $trayiconhide) EndFunc ;==>_Traytog Func _Terminate() Exit EndFunc ;==>_Terminate SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 20, 2006 Share Posted March 20, 2006 I noticed the problems with the quotes also, here's a shortend version Global $trayiconhide = 0 HotKeySet("!t", "_Traytog") HotKeySet("{ESC}", "_Terminate") While 1 Sleep(200) WEnd Func _Traytog() $trayiconhide = Not $trayiconhide Opt("trayiconhide", $trayiconhide) EndFunc ;==>_Traytog Func _Terminate() Exit EndFunc ;==>_Terminate Nice, tight _Traytog() function! I'm always too wordy in mine... old dog... new tricks... etc. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
slightly_abnormal Posted March 20, 2006 Author Share Posted March 20, 2006 (edited) I put while 1, so it wont exit out. yeah.. very compact.. suprised at all the ways you can do one function Edited March 20, 2006 by slightly_abnormal 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