Jump to content

HotKey!


iTwIx
 Share

Recommended Posts

hey guys, a friend of mine needs help with hotkeys.

this is his script:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("", 215, 235, 299, 218)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 112, 16, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 112, 40, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 112, 64, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 112, 88, 97, 17)
$Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 112, 112, 97, 17)
$Checkbox6 = GUICtrlCreateCheckbox("Checkbox6", 112, 136, 97, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Checkbox7", 112, 160, 97, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Checkbox8", 112, 184, 97, 17)
$Label1 = GUICtrlCreateLabel("Hot Key Ctrl+1", 8, 16, 72, 17)
$Label2 = GUICtrlCreateLabel("Hot Key Ctrl+2", 8, 40, 72, 17)
$Label3 = GUICtrlCreateLabel("Hot Key Ctrl+3", 8, 64, 72, 17)
$Label4 = GUICtrlCreateLabel("Hot Key Ctrl+4", 8, 88, 72, 17)
$Label5 = GUICtrlCreateLabel("Hot Key Ctrl+5", 8, 112, 72, 17)
$Label6 = GUICtrlCreateLabel("Hot Key Ctrl+6", 8, 136, 72, 17)
$Label7 = GUICtrlCreateLabel("Hot Key Ctrl+7", 8, 160, 72, 17)
$Label8 = GUICtrlCreateLabel("Hot Key Ctrl+8", 8, 184, 72, 17)
$Label9 = GUICtrlCreateLabel("Hot Key For Open and Close Alt+1", 8, 208, 165, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

he said that when he presses any hotkey it dsnt works...

Link to comment
Share on other sites

  • Moderators

iTwIx,

Welcome to the Autoit forum. :)

And why does your friend think his HotKeys will work if he does not use HotKeySet at some point in the script? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

iTwIx,

And so what is the question that you have? ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

how hes script is the following:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
HotKeySet("{Alt}"); That For Closs And Open the From
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("", 215, 235, 299, 218)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 112, 16, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 112, 40, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 112, 64, 97, 17)
$Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 112, 88, 97, 17)
$Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 112, 112, 97, 17)
$Checkbox6 = GUICtrlCreateCheckbox("Checkbox6", 112, 136, 97, 17)
$Checkbox7 = GUICtrlCreateCheckbox("Checkbox7", 112, 160, 97, 17)
$Checkbox8 = GUICtrlCreateCheckbox("Checkbox8", 112, 184, 97, 17)
$Label1 = GUICtrlCreateLabel("HotKeySet 1", 8, 16, 72, 17)
$Label2 = GUICtrlCreateLabel("HotKeySet 2", 8, 40, 72, 17)
$Label3 = GUICtrlCreateLabel("HotKeySet 3", 8, 64, 72, 17)
$Label4 = GUICtrlCreateLabel("HotKeySet 4", 8, 88, 72, 17)
$Label5 = GUICtrlCreateLabel("HotKeySet 5", 8, 112, 72, 17)
$Label6 = GUICtrlCreateLabel("HotKeySet 6", 8, 136, 72, 17)
$Label7 = GUICtrlCreateLabel("HotKeySet 7", 8, 160, 72, 17)
$Label8 = GUICtrlCreateLabel("HotKeySet 8", 8, 184, 72, 17)
$Label9 = GUICtrlCreateLabel("Hot Key For Open and Close Alt", 8, 208, 165, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1
HotKeySet("{1}")("")
Case $Checkbox2
HotKeySet("{2}")("")
Case $Checkbox3
HotKeySet("{3}")("")
Case $Checkbox4
HotKeySet("{4}")("")
Case $Checkbox5
HotKeySet("{5}")("")
Case $Checkbox6
HotKeySet("{6}")("")
Case $Checkbox7
HotKeySet("{7}")("")
Case $Checkbox8
HotKeySet("{8}")("")

EndSwitch
WEnd

but it still dsnt work

Link to comment
Share on other sites

You have to assign a function to HotKeySet and it's incorrectly formatted too. Refer to the Help file about HotKeySet.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

  • Moderators

iTwIx,

And why should it? Does your friend look at the Help file before coding or does he expect AutoIt to guess what he wants? ;)

The syntax for HotKeySet should be:

HotKeySet( HotKey, "Function_Name")

So where is the "Function_Name" (and the function itself? :)

M23

P.S. And you do not need the { } either. :D

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

ok this is what my friend replayed me in another website:

See That i make it

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
HotKeySet("{z}", "Selectoncheckbox1")
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("", 215, 235, 299, 218)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 112, 16, 97, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1


EndSwitch
WEnd


Func Selectoncheckbox1()
    MsgBox(4096, "", "This is a message.")
EndFunc   ;==>ShowMessage

but i went change MsgBox(4096, "", "This is a message.") to Select on checkbox1 not MsgBox(4096, "", "Select on checkbox1")

went change to select on checkbox1 no went it MsgBox Posted Image

sorry bro i dont understand what have u said...

ok that it

[/size][/font][/color]


#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
HotKeySet("{z}", "Selectoncheckbox1")
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("", 215, 235, 299, 218)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 112, 16, 97, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Checkbox1


EndSwitch
WEnd


Func Selectoncheckbox1()
    MsgBox(4096, "", "00000000000") ; i went change Msgbox to  i dont know what need to change MsgBox to ...... to make (HotKeySet) can Select On Checkbox1
EndFunc

(write it and GM will know what i mean

i went change Msgbox to i dont know what need to change MsgBox to ...... to make (HotKeySet) can Select On Checkbox1)

(I am very sorry for bothering you)

Edited by iTwIx
Link to comment
Share on other sites

  • Moderators

iTwIx,

I have absolutely no idea what you are trying to do. ;)

The first script you have posted shows the HotKey being set (although you do not need the { } as I have already mentioned) but what on earth do you mean by?

to make (HotKeySet) can Select On Checkbox1

The HotKey runs the function that you tell it to run - in this case Selectoncheckbox1. If you want the function to run when you select the checkbox then you need to do something like this:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

#region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("", 215, 235, 299, 218)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 112, 16, 97, 17)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Checkbox1
            Selectoncheckbox1()
    EndSwitch
WEnd

Func Selectoncheckbox1()
    MsgBox(4096, "", "00000000000") 
EndFunc   ;==>Selectoncheckbox1

Perhaps you need to get your friend to post here explaining what is going on rather than giving you snippets of script which only confuse us all. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

i Will Help me i am Really Surprised for

Melba23 cant help you !

see will add 2 func Only that it

Func Selectoncheckbox()
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
EndFunc
Func Selectoncheckbox1()
GUICtrlSetState($Checkbox1, $GUI_unchecked)
EndFunc

will make 2 hotkeyset

if went all Script

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

HotKeySet("{z}", "Selectoncheckbox")
HotKeySet("{x}", "Selectoncheckbox1")
#Region ### START Koda GUI section ### Form=Form1.kxf
$Form1 = GUICreate("", 215, 235, 299, 218)
$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 112, 16, 97, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd

Func Selectoncheckbox()
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
EndFunc
Func Selectoncheckbox1()
GUICtrlSetState($Checkbox1, $GUI_unchecked)
EndFunc

if he went add more check box he will need add other to func but change name func and change name $Checkbox1 Depending on the name $Checkbox 1 and the name next func not any name HotKeySet("{x}", "Here name the next Func") so will add Func Here name The Next Func any name but Be necessary in HotKeySet i hope i help your Friend ;)

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