Jump to content

HotKeySet issues


Sodori
 Share

Go to solution Solved by bogQ,

Recommended Posts

Hi,

Why does this always run _Login() regardless of my button presses, and quite ignores me when I actually command it to start the function?

Global $LoginID = FileRead(@ScriptDir & "\LoginID.txt")
If @error Then
   Global $LoginID = InputBox("What is your user ID?", "Please specify a user ID!")
   If @error Then Exit
   Local $MsBox = MsgBox(4, "Do you want to save your user ID?", "Would you like to save user ID in a file so it won't ask you again?")
   If $MsBox = 6 Then
      Local $fFile = FileOpen(@ScriptDir & "\LoginID.txt", 8 + 2)
      FileWrite($fFile, $LoginID)
   EndIf
EndIf

HotKeySet("^!u", _Login()) ;CTRL + ALT + U

While 1
   Sleep(500)
WEnd



Func _Login()
   Local $MsBox = MsgBox(1, "Signing in or out!", "We will sign in or out for you now, is that OK?", 10)
   If $MsBox = 2 Then Return
EndFunc

Also, if the second MessageBox times out, how can I see that? Will $MsBox = -1? Or maybe @error will be set to a none zero??

Edited by Sodori
Link to comment
Share on other sites

  • Solution

its

HotKeySet("^!u", "_Login") ;CTRL + ALT + U
not
HotKeySet("^!u", _Login()) ;CTRL + ALT + U
 
for second question
 
Failure: $IDTIMEOUT (-1) if the message box timed out.

so it shud return -1 if timeouted

so "If $MsBox = -1 Then MsgBox(16,'','something something something dark side')" should work 

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...