Jump to content

Hotkey not working


Go to solution Solved by JohnOne,

Recommended Posts

Posted (edited)

Function:

• Save color of pixel at center

• Compare a constantly updated pixel with original pixel

• Print message if original pixel is different than new one

• Exit when hotkey is pressed

Problem:

• Hot keys have no effect

• It doesn't even read the first msg box from firing the hotkey for "fire"

#include <Misc.au3>
#include <MsgBoxConstants.au3>
$toggle = 1
$start = 1
 
HotKeySet ( "F7" , "fire" )
HotKeySet ( "F8", "On_Exit" )
 
While True
Sleep(10)
WEnd
 
Func fire()

   MsgBox($MB_SYSTEMMODAL, "success", "yay", 3)
   $color = PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2)

   While True
       $color1 = PixelGetColor(@DesktopWidth / 2, @DesktopHeight / 2)

       If Not $color == $color1 Then
         MsgBox($MB_SYSTEMMODAL, "yay", "yay", 3)
         Sleep(500)
       EndIf

       Sleep(50)

   WEnd

EndFunc
 
Func On_Exit()
   Exit
EndFunc
Edited by Knee
Posted (edited)

I've looked at the help file and some examples and they all use the same format

i.e. HotKeySet ( hotkey , function name )

Else, I'm not sure what you mean.

I've checked with other keys, they work, just not the function keys.

:s

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

aha, now I see it,

F7 ---> f+7 (i think)

instead of using

{F7} ---> {F7}

Edited by Knee
  • Moderators
Posted

Knee,

Please read the comment I made in your >other thread. :naughty:

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

 

Guest
This topic is now closed to further replies.
×
×
  • Create New...