Jump to content

HotKeySet - some questions


tamir
 Share

Recommended Posts

i have 2 questions about HotKeySet:

1) if i want it to do a function like func($var_a, $var_:idiot:, how i aim the HotKeySet to it? i can only type the function's name

2) is it possible to do hotkey for t AND s? coz if i type HotKeySet("ts", "") it will work for pressing "s"

Edited by tamir
Link to comment
Share on other sites

oh, sorry mi mistake :D

hmzzzzz i tryed and my code doesnt work :lol::idiot: i cant help

HotKeySet("a", "FuncName('test title', 'test text')")

func FuncName($value_a, $value_b)

msgbox(0, $value_a, $value_b)
endfunc

while (1)
sleep(100)
wend

i think that in part: HotKeySet("a", "FuncName('test title', 'test text')"), the 'test title' and 'test text' will always be constant, so try to use something like

HotKeySet("a", "FuncName")

func FuncName()
$value_a='test title'
$value_b='test text'
msgbox(0, $value_a, $value_b)
endfunc

while (1)
sleep(100)
wend
Edited by Einzeinbleth
Link to comment
Share on other sites

ehh....

as i already said, i know how to make a function, but when i have this function:

Func func($var)

MsgBox(0, "", $var)

EndFunc

and i want to make a hotkey for it, i need to specifiy the $var, but i cant write HotKeySet("s", "func(text)") coz i need to write only the name of the func.

so what can i do?

Link to comment
Share on other sites

????

ok, say i have a function like this:

Func func($var)

MsgBox(0, "", $var)

EndFunc

if i write func("text") it will display a msgbox with the word "text".

now, i want to make these hotkeys:

ctrl+a - write "abc" = func("abc")

ctrl+b - write "def" = func("def")

so how i do it with HotKeySet?

Link to comment
Share on other sites

Tamir you can't use parameters in a HotKeySet function callback.

You can ONLY use the function, sorry. It works that way for a lot of things, you just have to be clever and figure a way around it, I suppose.

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Wow. So much misinformation in this thread, it's almost mind boggling.

Not until post #13 did any real information make it's way through.

Er, wait, post #5 does have one thing going for it.

If you want to have a function work on two different keys (ie 't' and 's') then do two seperate calls to HotKeySet, as post #5 suggested.

HotKeySet("t", "FuncName")
HotKeySet("s", "FuncName")

If people actually tried their methods before posting them, it would go a long way towards not confusing people.

*Edit: Just thought of something. If you're looking to do a hotkey for pressing T and S at the same time, I don't believe it can be done. I'm pretty sure you can only combine the modifier keys (Alt, Shift, Ctrl, Windows).

Just thought I'd mention that in case it was what you were really looking for.

Edited by Saunders
Link to comment
Share on other sites

*Edit: Just thought of something. If you're looking to do a hotkey for pressing T and S at the same time, I don't believe it can be done. I'm pretty sure you can only combine the modifier keys (Alt, Shift, Ctrl, Windows).

Just thought I'd mention that in case it was what you were really looking for.

<{POST_SNAPBACK}>

it was what i was looking for...
Link to comment
Share on other sites

PLEASE check the HELPFILE before you post man......

WinGetClassList

--------------------------------------------------------------------------------

Retrieves the classes from a window.

WinGetClassList ( "title" [, "text"] )

Parameters

title The title of the window to read.

text [optional] The text of the window to read.

Return Value

Success: Returns a string containing the window classes read.

Failure: Returns numeric 1 and sets @error to 1 if no window matches the criteria.

Remarks

Class names are linefeed (@LF) separated. WinGetClassList works on both minimized and hidden windows. Up to 64KB of text can be retrieved. If multiple windows match the criteria, the classes are read from the most recently active window.

Related

WinGetText, ControlCommand

Example

$text = WinGetClassList("Untitled -", "")

MsgBox(0, "Text read was:", $text)

WinGetHandle

--------------------------------------------------------------------------------

Retrieves the internal handle of a window.

WinGetHandle ( "title" [, "text"] )

Parameters

title The title of the window to read.

text [optional] The text of the window to read.

Return Value

Success: Returns a string containing the window handle value.

Failure: Returns "" (blank string) and sets @error to 1 if no window matches the criteria.

Remarks

This function is for use with the advanced WinTitleMatchMode options that allow you to use classnames and handles to specify windows rather than "title" and "text".

Once you have obtained the handle you can access the required window even if its title changes.

Related

WinTitleMatchMode (Option)

Example

; Identify the Notepad window that contains the text "this one" and get a handle to it

; Change into the WinTitleMatchMode that supports classnames and handles

AutoItSetOption("WinTitleMatchMode", 4)

; Get the handle of a notepad window that contains "this one"

$handle = WinGetHandle("classname=Notepad", "this one")

If @error Then

    MsgBox(4096, "Error", "Could not find the correct window")

Else

    ; Send some text directly to this window's edit control

    ControlSend($handle, "", "Edit1", "AbCdE")

EndIf

Most questions can be answered by searching in the helpfile for just classname of classnameid or whatever. Please do so first. No offense.....

AutoIt Smith

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...