AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

If var is [not] type - Add type:Hotkey

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
infogulch



Joined: 27 Mar 2008
Posts: 103
Location: KC, MO

PostPosted: Tue May 13, 2008 3:25 pm    Post subject: If var is [not] type - Add type:Hotkey Reply with quote

If var is [not] type

Supported types:
...
float
number
alpha
...
Hotkey ?? -|- True if var exists on the current keyboard layout. [etc. etc.]

How about it?
_________________
Back to top
View user's profile Send private message
SomeGuy



Joined: 21 Apr 2008
Posts: 94
Location: somewhere

PostPosted: Tue May 13, 2008 4:14 pm    Post subject: Reply with quote

you can check it yourself, Like this:
Code:
Hotkey = a
If !IsHotkeyValid(Hotkey)
   MsgBox % Hotkey . "  :`n`n" . HK_Error
Hotkey = Tab
If !IsHotkeyValid(Hotkey)
   MsgBox % Hotkey . "  :`n`n" . HK_Error
Hotkey = F24
If !IsHotkeyValid(Hotkey)
   MsgBox % Hotkey . "  :`n`n" . HK_Error
Hotkey = F25
If !IsHotkeyValid(Hotkey)
   MsgBox % Hotkey . "  :`n`n" . HK_Error

exitapp

IsHotkeyValid(Hotkey){
   global HK_Error := ""
   Hotkey, %Hotkey%, Dummy, UseErrorLevel
   If ErrorLevel {
      If ErrorLevel = 1
         HK_Error = The Label parameter specifies a nonexistent label name.
      Else If ErrorLevel = 2
         HK_Error = The KeyName parameter specifies one or more keys that are either not recognized or not supported by the current keyboard layout/language.
      Else If ErrorLevel = 3
         HK_Error = Unsupported prefix key.
      Else If ErrorLevel = 4
         HK_Error = The KeyName parameter is not suitable for use with the AltTab or ShiftAltTab actions.
      Else If ErrorLevel = 5
         HK_Error = The command attempted to modify a nonexistent hotkey.
      Else If ErrorLevel = 6
         HK_Error = The command attempted to modify a nonexistent variant of an existing hotkey.
      Else If ErrorLevel = 50
         HK_Error = The command completed successfully but the operating system refused to activate the hotkey.
      Else If ErrorLevel = 51
         HK_Error = The command completed successfully but the hotkey is not supported on Windows 95/98/Me.
      Else If ErrorLevel = 98
         HK_Error = Creating this hotkey would exceed the 700-hotkey-per-script limit.
      Else If ErrorLevel = 99
         HK_Error = Out of memory.
      Else
         HK_Error = Unknown Error.`nErrorLevel = %ErrorLevel%
      return 0
      }
   Hotkey, %Hotkey%, Off
   return 1
   Dummy:
   return
   }

Back to top
View user's profile Send private message
infogulch



Joined: 27 Mar 2008
Posts: 103
Location: KC, MO

PostPosted: Tue May 13, 2008 6:36 pm    Post subject: Reply with quote

SomeGuy wrote:
you can check it yourself, Like this:
...

I see. I guess that other than being a little easier to use, a hotkey type wouldn't do much. And it wouldn't give as much info back as the function you made either. Thanks. Smile
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group