Jump to content

Button Hotkeys


roby
 Share

Recommended Posts

Hello,

why, when I compile my script the underscore sign of hotkey in button desappear?

You see this problem compiling this example...

#include <GUIConstants.au3>

GUICreate("My GUI Button"); will create a dialog box that when displayed is centered

Opt("GUICoordMode",2)
$Button_1 = GUICtrlCreateButton ("&Run Notepad",  10, 30, 100)
$Button_2 = GUICtrlCreateButton ( "&Button Test",  0, -1)

GUISetState ()  ; will display an  dialog box with 2 button

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Button_1
            Run('Notepad.exe')  ; Will Run/Open Notepad
        Case $msg = $Button_2
            MsgBox(0, 'Testing', 'Button 2 was pressed')  ; Will demonstrate Button 2 being pressed
    EndSelect
Wend

Is it a bug or my error?

thank you

Roberto

Edited by roby
Link to comment
Share on other sites

Hi,

I guess this is windows. Press alt and the underscores appear again.

Search for this : Always show keyboard indicators

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

thx, but where can I find this? In autoit site??

Hi,

I guess TweakUI can do it for you. But why? You need to change that for every client your script will run on.

I suppose there is a RegKey for that setting.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

The underscores can be set on by default using the sysparametersifo setting SPI_SETKEYBOARDCUES and the current setting can be read using SPI_GETKEYBOARDCUES. If you search for them you should find something. I have used it turn underlining on but I have never been able to turn it off, so if you find out how to do both I would like to know how. The setting is a general Windows setting so all applications are affected until you reboot or find a way to turn it off.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Hi,

this seems to work .. at least for Scite:

#include <WinAPI.au3>
;~ ConsoleWrite(_setAccessKeys(1) & @CRLF)   ; _ on
;~ ConsoleWrite(_setAccessKeys(0) & @CRLF)   ; _ off

Func _setAccessKeys($opt = True)
    Local $SPI_SETKEYBOARDCUES = 0x100B
    Return _WinAPI_SystemParametersInfo($SPI_SETKEYBOARDCUES, 0, $opt, 0)
EndFunc

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

this seems to work .. at least for Scite:

#include <WinAPI.au3>
;~ ConsoleWrite(_setAccessKeys(1) & @CRLF)   ; _ on
;~ ConsoleWrite(_setAccessKeys(0) & @CRLF)   ; _ off

Func _setAccessKeys($opt = True)
    Local $SPI_SETKEYBOARDCUES = 0x100B
    Return _WinAPI_SystemParametersInfo($SPI_SETKEYBOARDCUES, 0, $opt, 0)
EndFunc

Mega

Yes thanks Mega. I don't understand it though because the MSDN info says that the third parameter should be a pointer to the boolean value. I tried with a pointer but it didn't work. If the last parameter is 0x02 (SPIF_SENDCHANGE) then the top level windows should update their menus. On one PC I tried your script on it only updated Scite or other programs if I minimized it then restored. On my trusty laptop, where I have failed before, it doesn't work, but that maybe because it has XP SP1.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Yes thanks Mega. I don't understand it though because the MSDN info says that the third parameter should be a pointer to the boolean value. I tried with a pointer but it didn't work. If the last parameter is 0x02 (SPIF_SENDCHANGE) then the top level windows should update their menus. On one PC I tried your script on it only updated Scite or other programs if I minimized it then restored. On my trusty laptop, where I have failed before, it doesn't work, but that maybe because it has XP SP1.

Hi,

I must admit it was a trial and error session. I just looked into the msdn doc and tried to create the function.

I guess Gary could explain how to set the right paramters to achieve a global update and/or getting the status whether _ is on or off.

On my XP SP2 it works for Lotus Notes and Scite and some other apps, but there also several it doesn't. :D

I'll give it a try to set the last paramter to 0x02 as you mentioned.

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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