Thank you for V0RT3X, I tried it and it worked but the issue now I am facing is that whenever I am calling a function for showing menu I am having multiple on the bottom(of menu).
Code: Select all
#IF (mbtnstate=0)
;Hotkey to select area
Mbutton::
SCW_ScreenClip2Win(clip:=0) ; set to 1 to auto-copy to clipboard
WinActivate, ScreenClippingWindow ahk_class AutoHotkeyGUI
If (ClickCount > 0)
{
ClickCount +=1
}
else
{
ClickCount :=1
}
If (ClickCount > 1 AND ClickCount < 4)
Tooltip, %ClickCount%
SetTimer, mbclickmonitor, 500
return
mbclickmonitor:
If (ClickCount = 2)
{
Send, {Media_Play_Pause}
}
else if (ClickCount > 2)
{
MNFunctionmenu() ;from here i am calling the function
}
ClickCount := 0
SetTimer, mbclickmonitor, Off
Tooltip,
return
#IF
#IF (whelscrlfn=1)
{
WheelUp::Right
WheelDown::Left
}
#IF
;============================================================================================================
;============================================================================================================
;Menu function and call
;InstantMenu is a function which can be called from any where or any if else statments
;current states of key always on top of script
;make a menu
;name of the menu is MNFunctions
MNFunctionmenu()
{
Menu, MNFunctions, Add, Schreenshot State, Screenshot1orScreenshot2State
Menu, MNFunctions, Add, SpeedUpDown_UnRe State, SpeedUpDownorUndoRedo_State
Menu, MNFunctions, Add, CopyCut/CopylinkCopyCut State, CopyCutorCopylinkCopyCutState
Menu, MNFunctions, Add, Play Pause 4 All - PlayPause 4 Nox State, MediaPlay4AllorMediaPlay4NoxState
Menu, MNFunctions, Add
Menu, MNFunctions, Add
Menu, MNFunctions, Add, Media Key 4 OneNote State, MediaKey4OneNoteorMediaKey4AllState
Menu, MNFunctions, Add, Fn Key Enable/Disable, fnkeystateenabledisable
Menu, MNFunctions, Add, Scroll Up/Down - Arrow State, wheelupdownarrow
Menu, MNFunctions, Add, Mouse_Middle_Button Enable/Disable , mousembuttonenabledisable
Menu, MNFunctions, Add
Menu, MNFunctions, Add
Menu, MNFunctions, Add, Lecture Recordings, lectruerecordingopen
Menu, MNFunctions, Add, Explore E_D, exploreedopen
Menu, MNFunctions, Add
Menu, MNFunctions, Add
Menu, MNFunctions, Add, OneNote, OneNoterunner
Menu, MNFunctions, Add, Calculator, calculatorrunneropen
Menu, MNFunctions, Add, Notepad, notepadrunneropen
Menu, MNFunctions, Add
Menu, MNFunctions, Add
Menu, MNFunctions, Add
Menu, MNFunctions, Add, Exit App, exiterapp
Menu, MNFunctions, Show
}
Screenshot1orScreenshot2State: ;create non-spaced labels for menu items
{
scrstate := !scrstate
if (scrstate=0)
{
MsgBox, 262144, Screenshot Key Press,
(
Screenshot - 2 press
`nRepeat last - 1 press
)
}
else if (scrstate=1)
{
MsgBox, 262144, Screenshot Key Press,
(
Screenshot - 1 press
`nRepeat last - 2 press
)
}
}
Return
SpeedUpDownorUndoRedo_State:
{
spustate := !spustate
if (spustate=0)
{
MsgBox, 262144, Speed up/down,
(
^ - speed up
`nv - speed down
)
}
else if (spustate=1)
{
MsgBox, 262144, undo/redo,
(
^ - redo
`nv - undo
)
}
}
Return
CopyCutorCopylinkCopyCutState:
{
cpcstate := !cpcstate
if (cpcstate=0)
{
MsgBox, 262144, copy/cut,
(
copy - 1 press
`ncut - 1 press
)
}
else if (cpcstate=1)
{
MsgBox, 262144, copylink/copy/cut,
(
copylink(onenote) - 1 press
`ncopy - 2 press
`ncut - 3 press
)
}
}
Return
MediaPlay4AllorMediaPlay4NoxState:
{
mdastate:=!mdastate
SoundBeep, 300, 700
if (mdastate = 1)
{
SplashTextOn,250,60,,Play/Pause for nox
Sleep 400
SplashTextOff
if (fnstate = 0)
{
Menu, Tray, Icon, fndisableone_nox.ico
}
else if (fnstate = 1)
{
Menu, Tray, Icon, fnenableone_nox.ico
}
}
else if (mdastate = 0)
{
SplashTextOn,250,60,,Play/Pause for all
Sleep 400
SplashTextOff
if (fnstate = 0)
{
Menu, Tray, Icon, fndisableone_all.ico
}
else if (fnstate = 1)
{
Menu, Tray, Icon, fnenableone_all.ico
}
}
}
Return
MediaKey4OneNoteorMediaKey4AllState:
{
mdkystate := !mdkystate
if (mdkystate=0)
{
MsgBox, 262144, Media_Play_Pause,
(
Play/Pause - Play/Pause
)
}
else if (mdkystate=1)
{
MsgBox, 262144, Media_Play_Pause,
(
Play/Pause - ctrl + shift + 6
)
}
}
Return
fnkeystateenabledisable:
{
fnstate:=!fnstate
SoundBeep, 900, 500
if (fnstate = 1)
{
if (mdastate = 0)
{
Menu, Tray, Icon, fnenableone_all.ico
}
else if (mdastate = 1)
{
Menu, Tray, Icon, fnenableone_nox.ico
}
}
else if (fnstate = 0)
{
if (mdastate = 0)
{
Menu, Tray, Icon, fndisableone_all.ico
}
else if (mdastate = 1)
{
Menu, Tray, Icon, fndisableone_nox.ico
}
}
}
Return
wheelupdownarrow:
{
whelscrlfn:=!whelscrlfn
if (whelscrlfn=0)
{
MsgBox, 262144, Scroll Up/Down,
(
Scroll Up - Scroll Up
`nScroll Down - Scroll Down
)
}
else if (whelscrlfn=1)
{
MsgBox, 262144, Scroll Up/Down,
(
Scroll Up - Arrow Right
`nScroll Down - Arrow Left
)
}
}
Return
mousembuttonenabledisable:
{
mbuttonstate:=!mbuttonstate
if (mbuttonstate=0)
{
SplashTextOn,350,100,,Scroll Button Disable
Sleep 400
SplashTextOff
}
else if (whelscrlfn=1)
{
SplashTextOn,350,100,,Scroll Button Enable
Sleep 400
SplashTextOff
}
}
Return
lectruerecordingopen:
run, C:\Users\amana\Music\Lecture Recordings
Return
exploreedopen:
run, C:\DaTa\E_D
Return
OneNoterunner:
run, ONENOTE
Return
calculatorrunneropen:
run, Calc
Return
notepadrunneropen:
run, Notepad
Return
exiterapp:
{
SplashTextOn,150,40,,Exit Script
Sleep 400
SplashTextOff
ExitApp
}
Return
but when I again press thrice to get the menu I have multiple lines in the bottom of it and the lines keep on increasing.