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 

Click a tray icon

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Grateful user
Guest





PostPosted: Thu Sep 13, 2007 4:49 pm    Post subject: Click a tray icon Reply with quote

Hi,

I needed to just click a tray icon (of a plugin that deletes the song currently playing in winamp) and then have the mouse in the initial position. Searching this excellent forum I found relevant scripts, yet none of them did exactly that simple function. Although I'm not very familiar with the syntax I managed to combine and arrange elements of various scripts, and I post here the result, a short, simple, script, in case someone else needs it.

Warm congratulations on AutoHotKey and its Community.

Code:


; the number of the tray icon that you need to click, followed by a space and then the filename containing the icon :

iconstr = 3 C:\Program Files\Winamp\Plugins\gen_delete.dll

;replace this with your filename. I used beardboys Icon Browser - http://www.autohotkey.com/forum/viewtopic.php?t=5587&highlight=iconviewer - to find the icon inside the dll

   coordmode, mouse, screen
   MouseGetPos, mouseX, mouseY
   coordmode, pixel, screen
   WinGetPos, trayX, trayY, trayWidth, trayHeight, ahk_class Shell_TrayWnd
   ImageSearch, imageX, imageY, trayX, trayY, trayX+trayWidth, trayY+trayHeight, *Icon%iconstr%
MouseMove,%imageX%,%imageY%,0   
MouseClick,left,%imageX%,%imageY%,1,0
   MouseMove,%mouseX%,%mouseY%,0
Return




Best wishes

George
Back to top
FrankCh
Guest





PostPosted: Thu Oct 04, 2007 3:03 pm    Post subject: How to use the click a tray icon script Reply with quote

I downloaded autohotkey and I need to use this click tray icon script, but I don't know how to do it. Can you tell me what to do?
Back to top
Titan



Joined: 11 Aug 2004
Posts: 5009
Location: imaginationland

PostPosted: Thu Oct 04, 2007 3:35 pm    Post subject: Reply with quote

Follow the tutorial.
_________________

RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
Back to top
View user's profile Send private message Visit poster's website
Grateful user
Guest





PostPosted: Sat Oct 06, 2007 9:51 am    Post subject: Click a tray icon Reply with quote

Hi Frank,

Here is how I use this script. You can do the same if you can't understand the tutorial. First copy the script above into a txt file, and then add two more lines

To the very top add:

#singleinstance


To the bottom add:

Exit


Save this file as e.g. "ClickTrayDeleter.ahk" or however you like. Don't forget that the file must have the extension "ahk", not txt. Then open AutoHotkey.ahk, the file that is used by the main AutoHotKey application. You can access this file by right clicking the AutoHotKey tray icon and choosing the option "Edit this script". In that file add a line

#=::Run, "c:\ahkscripts\ClickTrayDeleter.ahk"

Replace c:\ahkscripts\ with the location in your computer where you saved the deleter script. Save, Close and Reload AutoHotkey.ahk (right click the main ahk tray icon and select the "Reload this script" option).

From now on, supposing that AutoHotKey starts whenever you open your computer, you will be able to run the deleter script by pressing the WinKey and =. You can change this shortcut to whatever is convenient for you.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions 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