AutoHotkey Community

It is currently May 25th, 2012, 4:01 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: September 16th, 2007, 5:51 am 
Offline

Joined: August 19th, 2004, 10:53 pm
Posts: 326
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 ..


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 16th, 2007, 7:18 pm 
Offline

Joined: August 19th, 2004, 10:53 pm
Posts: 326
bump..

_________________
Autohotkey Just drives me crazy ..


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, dmg, ogrish, Pulover, rbrtryn, vsub, Zaelia and 24 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group