file dragged to icon
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
file dragged to icon
Was wondering if this is possible with Rev. Making a standalone app that could be activated by dragging a file to its exe icon.
Example: A file zip program, that all you have to do is drag files to it's icon on the desktop, and the program launches and produces the Zip file.
Example: A file zip program, that all you have to do is drag files to it's icon on the desktop, and the program launches and produces the Zip file.
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
That is certainly possible. On MacOSX, you'll need to trap the 'appleEvent' message, and on Windows you script your 'startup' handler to look at the command-line parameters '$1', '$2, '$3', etc.
Also nice is that you can then leave the applicatin open and provide a drag-and-drop area in your stack where people can drag files and folders into and achieve the same effect as when dropping onto the icon, possibly with a UI for advanced settings.
Continuing along that path - on Windows, if you want to prevent the application from being opened multiple times, you should also tale a look at the entry for the 'relaunch' message in the Rev dictionary.
Hope this helped,
Jan Schenkel.
Also nice is that you can then leave the applicatin open and provide a drag-and-drop area in your stack where people can drag files and folders into and achieve the same effect as when dropping onto the icon, possibly with a UI for advanced settings.
Continuing along that path - on Windows, if you want to prevent the application from being opened multiple times, you should also tale a look at the entry for the 'relaunch' message in the Rev dictionary.
Hope this helped,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
Thanks Jan, I was aware of the command line parameters, but did not know they would pass files dropped on an icon (and definitly not worded as such in rev documentation. )Janschenkel wrote:That is certainly possible. On MacOSX, you'll need to trap the 'appleEvent' message, and on Windows you script your 'startup' handler to look at the command-line parameters '$1', '$2, '$3', etc.
Also nice is that you can then leave the applicatin open and provide a drag-and-drop area in your stack where people can drag files and folders into and achieve the same effect as when dropping onto the icon, possibly with a UI for advanced settings.
Continuing along that path - on Windows, if you want to prevent the application from being opened multiple times, you should also tale a look at the entry for the 'relaunch' message in the Rev dictionary.
Hope this helped,
Jan Schenkel.
I'm familier with the other things you mention and have used them with great success.
Thanks again for your ever helpful answers.
One quick question, Is there a way to tell how many parameters there are (ex $1, $2,.....) or should I just check from one until i find a blank one?
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
That would be '$#' - though I'm not quite sure when that was added.
Jan Schenkel.
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
It was added in 2.9Janschenkel wrote:That would be '$#' - though I'm not quite sure when that was added.
Jan Schenkel.

I wrote this quick, and it works, but I'm sure someone has something more elegant and without the 999 limit.
Code: Select all
repeat with i = 1 to 999
put value("$" & i) into Fchecker
if Fchecker is empty then exit repeat
put Fchecker & cr after theDropped
end repeat
-
- VIP Livecode Opensource Backer
- Posts: 10049
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
This discussion describes how to handle the dropped file well, but hasn't yet described how the OS knows to let the application handle the drop.
On OS X, this is handled in the plist file in the bundle, normally written appropriately by Rev's standalone builder. If details are needed that's described in depth here:
http://sonsothunder.com/devres/revoluti ... ile005.htm
On Windows, a registry entry is required. Commonly this is done by an installer (Wise Install makes this simple), but it's possible to have your Rev app do this itself on launch - details for this also at Ken Ray's site:
http://sonsothunder.com/devres/revoluti ... ile004.htm
On OS X, this is handled in the plist file in the bundle, normally written appropriately by Rev's standalone builder. If details are needed that's described in depth here:
http://sonsothunder.com/devres/revoluti ... ile005.htm
On Windows, a registry entry is required. Commonly this is done by an installer (Wise Install makes this simple), but it's possible to have your Rev app do this itself on launch - details for this also at Ken Ray's site:
http://sonsothunder.com/devres/revoluti ... ile004.htm
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
One little thing to be aware in windows with commandlines:
Under windows there are only 9 standalone commandline paramters possible ($1 - $9).
I don't knw how much are supported under OS X or Linux. But under Windows there are only 9.
see also my bugreport at
http://quality.runrev.com/qacenter/show_bug.cgi?id=7148
This behaviour is already confirmed by Runrev and will be corrected in the next version.
Regards,
Matthias
Under windows there are only 9 standalone commandline paramters possible ($1 - $9).
I don't knw how much are supported under OS X or Linux. But under Windows there are only 9.
see also my bugreport at
http://quality.runrev.com/qacenter/show_bug.cgi?id=7148
This behaviour is already confirmed by Runrev and will be corrected in the next version.
Regards,
Matthias
matthiasr wrote:One little thing to be aware in windows with commandlines:
Under windows there are only 9 standalone commandline paramters possible ($1 - $9).
I don't knw how much are supported under OS X or Linux. But under Windows there are only 9.
see also my bugreport at
http://quality.runrev.com/qacenter/show_bug.cgi?id=7148
This behaviour is already confirmed by Runrev and will be corrected in the next version.
Thanks for the heads up. Yes, I tested my file drop and it does only allow for 9 files.
Regards,
Matthias
Thanks for the heads up. Yes, I tested my file drop and it does only allow for 9 files. Any temp workaround?matthiasr wrote:One little thing to be aware in windows with commandlines:
Under windows there are only 9 standalone commandline paramters possible ($1 - $9).
I don't knw how much are supported under OS X or Linux. But under Windows there are only 9.
see also my bugreport at
http://quality.runrev.com/qacenter/show_bug.cgi?id=7148
This behaviour is already confirmed by Runrev and will be corrected in the next version.
Regards,
Matthias
If you want to drag files onto a shortcut under windows, then there is no workaround. I am sorry.
See the answer to my bugreport of Mark Waddingham at
http://quality.runrev.com/qacenter/show_bug.cgi?id=7148
It seems, we have to wait for the next version.
Regards,
Matthias
See the answer to my bugreport of Mark Waddingham at
http://quality.runrev.com/qacenter/show_bug.cgi?id=7148
It seems, we have to wait for the next version.
Regards,
Matthias