AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Little help with the right click

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Candle



Joined: 19 Aug 2004
Posts: 334

PostPosted: Sun Sep 16, 2007 5:51 am    Post subject: Little help with the right click Reply with quote

When I run this you have to click two or three times on the desktop or system tray icon before the full menu opens with all the program links?
Thanks for the help.
Code:
; ========== opens with Rightclick under desktop , can add new links ==================================

#Persistent

setworkingdir, %a_scriptdir%



;------ here your path to read ------------

AAA=C:\Program Files\

Menu,Tray,NoStandard

Menu, Tray, UseErrorLevel


Menu, Tray, Add , edit menu, editmenu

Menu, Tray, Add

Menu, Tray, Add, Add menu item, AddMenuItem

Menu, Tray, Add, Exit,exit





Filedelete,MenuItems.txt

Loop %AAA%\*.exe,,1

FileAppend,%A_LoopFileName% `t %A_LoopFileLongPath%`n,MenuItems.txt





Loop,read,MenuItems.txt

{

StringSplit, MenuComponent, A_LoopReadLine, %a_tab%

if MenuComponent1 <>

{

Menu, tray, add, %MenuComponent1%, MenuHandler

}

}

return



;--------------

RButton::

MouseGetPos, , , WindowUnderMouse

WinGetClass, ClassUnderMouse, ahk_id %WindowUnderMouse%

if ClassUnderMouse <> WorkerW

{

if ClassUnderMouse <> Progman ; No desktop, so make RButton behave normally.

{

MouseClick, right, , , , , D

Loop

{

Sleep, 10

GetKeyState, RButtonState, RButton, P

if RButtonState = U ; button has been released

break

}

MouseClick, right, , , , , U

return

}

}

; Otherwise, the user has clicked on the desktop, so do a custom action.

Menu, Tray, Show

Loop, read, MenuItems.txt

{

StringSplit, MenuComponent, A_LoopReadLine, %a_tab%

if A_ThisMenuItem = %MenuComponent1%

{

MenuComponent2=%MenuComponent2%

Run, %MenuComponent2%

break

}

}

return

;--------------------





AddMenuItem:

FileSelectFile, Filename,,,, Executable Files (*.exe; *.bat; *.com)

if Filename =

return

SplitPath, Filename,,,, FilenameNoExt

InputBox, MenuItemName, Choose Menu Item Name, Type the name of this item as it will appear in the menu.,,,,,,,, %FilenameNoExt%

FileAppend, %MenuItemName%`t%Filename%`n, MenuItems.txt

Menu, tray, add, %MenuItemName%, MenuHandler

return



exit:

ExitApp

return



MenuHandler:

Loop, read, MenuItems.txt

{

StringSplit, MenuComponent, A_LoopReadLine, %a_tab%

if A_ThisMenuItem = %MenuComponent1%

{

MenuComponent2=%MenuComponent2%

Run, %MenuComponent2%

break

}

}

return

















editmenu:

Run, MenuItems.txt

return

;=================================================================================

_________________
Autohotkey Just drives me crazy ..
Back to top
View user's profile Send private message
Candle



Joined: 19 Aug 2004
Posts: 334

PostPosted: Sun Sep 16, 2007 7:18 pm    Post subject: Reply with quote

bump..
_________________
Autohotkey Just drives me crazy ..
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group