Jump to content


Photo

Dragging files to AHK Script SystemTray Icon


  • Please log in to reply
4 replies to this topic

#1 hurricanedavid

hurricanedavid
  • Members
  • 77 posts

Posted 18 November 2005 - 10:25 PM

I have an AHK script running which has all my hotkeys in it as well as some auto-replace sequences. I'm new to AHK and have just scratched the surface. I've done a few of the basic tutorials.

However, I'm a web developer, programming in ColdFusion and PHP, so I catch on quick.

:?: I was wondering if it was easy-ish to put some code in my script which would be run if a file was dropped onto that script's system tray icon.

I'd like to detect the filename and do different actions based on the extension.

Is that too far over my head?

:D P.S. AHK has got to be one of my favorite programs ever! I'mso glad I found it!

#2 polyethene

polyethene

    Administrator

  • Administrators
  • 5473 posts

Posted 18 November 2005 - 10:38 PM

I don't think you can drag/drop items onto the tray icon but you could make workarounds like a mini gui for when the icon is clicked.

#3 hurricanedavid

hurricanedavid
  • Members
  • 77 posts

Posted 21 November 2005 - 02:44 PM

Okay, well, maybe you can't drop items onto a system tray icon. But what about a normal desktop icon? If I put my script in the desktop or in the quicklaunch toolbar, then I think I can drop stuff onto it.

I installed AHK the other day on my home computer and noticed an option during installation whereby you can specify that AHK scripts can have stuff dropped on them. By default, it is not enabled. So it looks like it can be done.

:?: But what variables will I need to access to get the filenames?

#4 hurricanedavid

hurricanedavid
  • Members
  • 77 posts

Posted 21 November 2005 - 04:36 PM

I've made some progress. I assumed that %1% would be the first param, and in fact, it is. It is the physical path of the file dropped onto the script.

I realize that this gives me the first param... so if I dragged more than one file onto the script, I have to access %2% and so on. But often I don't know how many params will be passed.

Now it is in the old DOS format...
C:\bob\longfi~1.txt
Rather than a nice long format.

:?: How can I find out what the long name is?
:?: And how can I get all the params, instead of just the first one?

#5 hurricanedavid

hurricanedavid
  • Members
  • 77 posts

Posted 21 November 2005 - 04:52 PM

Since this topic has changed away from "system tray" stuff, I'm creating a new topic...

http://www.autohotke...opic.php?t=6495