Sign in to follow this  
Followers 0
seres

functions and hotkeysset

7 posts in this topic

is it possible to make something like this . so when i press ^+!1 it calls the funct new and if i press ^+!2 it calls the funct new2

HotKeySet("^+!1", "new")

HotKeySet("^+!2", "new2")

While 1

Sleep(100)

WEnd

func new()

HotKeySet("^+!a", "now")

While 1

Sleep(100)

WEnd

func now()

anything

endfunc

end funct

func new2()

HotKeySet("^+!a", "something")

While 1

Sleep(100)

WEnd

func something()

anything

endfunc

end funct

Share this post


Link to post
Share on other sites



On the right track... Try this :)

HotKeySet("^+!1", "new");CTRL + SHIFT + ALT + 1
HotKeySet("^+!2", "new2");CTRL + SHIFT + ALT + 2

While 1
    Sleep(100)
WEnd


Func new()
    HotKeySet("^+!a", "now");CTRL + SHIFT + ALT + A
    MsgBox (0, "", "New was called")
EndFunc  ;==>new

Func now()
    MsgBox (0, "", "Now was called")
;anything
EndFunc  ;==>now

Func new2()
    MsgBox (0, "", "New2 was called")
    HotKeySet("^+!a", "something");CTRL + SHIFT + ALT + A
EndFunc  ;==>new2

Func something()
    MsgBox (0, "", "Something was called")
EndFunc  ;==>something

Share this post


Link to post
Share on other sites

hello thanks for the answer, but i have a problem with the functions.

how do i close a function when i change the function with the hotkeysets.

and how do i put in a message box something like this

jsajlsdjf

sjdfjsl

sdjfjlsdl

sdjklf

Share this post


Link to post
Share on other sites

Not sure what you mean by 'close the function'. Once the code is run it's done until you call it again. As for the msgbox ... I guess this...

MsgBox(0,'My msgbox','jsajlsdjf' & @CRLF & 'sjdfjsl' & @CRLF & @CRLF & 'sdjfjlsdl' & @CRLF & @CRLF & 'sdjklf')

Share this post


Link to post
Share on other sites

thanks.

about the end func what i mean is that i have assined some letters but when i change the function the letters that r not in the other function stills active

for example

hotkey 1

hotkey 2

func 1

hotkey a

hotkey b

hotkey c

hotkey d

endfunct

funct 2

hotkey a

hotkey b

hotkey c

endfunct

so here if i call the funct 1, then the funct 2 the hotkey d stills active,

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

thanks.

about the end func what i mean is that i have assined some letters but when i change the function the letters that r not in the other function stills active

for example

hotkey 1

hotkey 2

func 1

hotkey a

hotkey b

hotkey c

hotkey d

endfunct

funct 2

hotkey a

hotkey b

hotkey c

endfunct

so here if i call the funct 1, then the funct 2 the hotkey d stills active,

If you redefine a HotKeySet with a blank function, it clears that hotkey. Your example is poor pseudo-code because the functions being assigned are not shown. However since the hotkey functions for a, b, and c are redefined in both functions 1 and 2, you don't have to worry about those. The hotkey for d that is defined in function 1 presumably needs to be cleared in function 2. So function 2 needs HotKeySet("d", "") in it to clear that hotkey.

You will have to keep that stray "t" out of "funct". Download SciTE and use it for all your AutoIt work, it will make things MUCH easier.

:)

Edited by PsaltyDS

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

Share this post


Link to post
Share on other sites

thanks for the help, i worte it like that cause it was to much code to put on so i thought that by writing it with a , b things it will be easier to understand and to give an answer,

thanks for the help

Share this post


Link to post
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
Sign in to follow this  
Followers 0