# HotKeySet Bug, Or?

## Recommended Posts

The following code when run from SciTE will sometimes produce an error on the resetting of the hotkey to nothing, and sometimes not. However, I always get the error when running from the command line, as a compiled script, or running the script from the explorer context menu.

The error is "Unknown function name" on the HotKeySet("{F3}", "") line. If I put a function name in there instead of nothing, of course it works fine. At first I thought it had to do with spaces or tabs before the line because that's what was in my original code, but doesn't seem to be consistent with that. Also, when running from SciTE does error, sometimes uncommenting the Sleep line will cause the error to go away. But again that's not consistent. Can anybody verify? Thanks.

Tested with latest BETA & Production releases, on XP PRO SP2, & Windows 2000

HotKeySet("{F3}", "_CtrlF")
;Sleep(1000)
HotKeySet("{F3}", "")

Func _CtrlF()
Return
EndFunc

##### Share on other sites

shouldn't that be?:

HotKeySet("{F3}", "_CtrlF")
;Sleep(1000)
HotKeySet("{F3}")
Func _CtrlF()
Return
EndFunc  ;==>_CtrlF

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites

shouldn't that be?:

HotKeySet("{F3}", "_CtrlF")
;Sleep(1000)
HotKeySet("{F3}")
Func _CtrlF()
Return
EndFunc ;==>_CtrlF
Ermmm. I guess you're right. But has that behavior changed? I was resurectting some old code from about a year ago that I'm sure used to run fine. But, maybe not... and before I posted I did double check the help file and it says

function [optional] The name of the function to call when the key is pressed. Leave blank to unset a previous hotkey.

So of course I left it "blank" as in "", and not "out" as in not there at all. Rewording required on help file? (for dummies like me) :">

Also, I don't understand why sometimes SciTE will return the error when running it and sometimes not...

##### Share on other sites

Also, I don't understand why sometimes SciTE will return the error when running it and sometimes not...

I get the AU3check error for both the latest Production and Beta version....

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites

I get the AU3check error for both the latest Production and Beta version....

More testing reveals that if I run it the first time, it catches the error, subsequent times it lets the error by, but only on My Windows 2000 machine, my XP system always catches it.

What happens on the 2000 rig is that the first time, the Au3Check error window will pop up with the details, then of course the SciTE output panel will have the error details as well, including "ERROR: (): undefined function". Subsequent runs will not pop up the Au3Check window, and the ouput only provides the "AU3Check ended.rc:2" to indicate the error. (see below).

>"D:\PROGRAM FILES\far\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /beta /ErrorStdOut /in "D:\PROGRAMMING\@MBIZ\HistViewer\ttest2.au3" /autoit3dir "D:\Program Files\Far\AutoIt3\beta" /UserParams

+>14:17:42 Starting AutoIt3Wrapper v.1.9.3

>Running AU3Check (1.54.9.0) from : D:\Program Files\Far\AutoIt3\beta

!>14:17:42 AU3Check ended.rc:2

>Running:(3.2.9.0): D:\Program Files\Far\AutoIt3\beta\autoit3.exe "D:\PROGRAMMING\@MBIZ\HistViewer\ttest2.au3"

->14:17:43 AutoIT3.exe ended.rc:1

+>14:17:44 AutoIt3Wrapper Finished

>Exit code: 1 Time: 1.911

So I guess SciTE/Au3Check is always catching the error, just not fully? Or is my Scite4AutoIt installation suspect?

##### Share on other sites

JdeB

function [optional] The name of the function to call when the key is pressed. Leave blank to unset a previous hotkey.

It is not correct, and that's why they came here and ask unnecessary questions.

There should be something like this:

To unset a previous hotkey use only one parameter.

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

My Work...

Spoiler

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating )

* === My topics === *

==================================================

==================================================

AutoIt is simple, subtle, elegant. © AutoIt Team

##### Share on other sites

i think those ho new to AutoIt confused when they read..

...

It is not correct, and that's why they came here and ask unnecessary questions.

Well, I'm not new to AutoIt, but I will admit to the occasional "asking of unnecessary questions"

I agree though that the helpfile should be updated...

##### Share on other sites

I agree though that the helpfile should be updated...

poor excuse

I have changed the Helpfile to read: "Not specifying this parameter will unset a previous hotkey."

Live for the present,
Dream of the future,
Learn from the past.

##### Share on other sites

poor excuse

I have changed the Helpfile to read: "Not specifying this parameter will unset a previous hotkey."

Thanks JdeB, and if you'll pardon the wordplay, I like to think that most of my excuses are pretty rich

## Create an account

Register a new account

×

• Wiki

• Back

• Git