Page 1 of 1
file dragged to icon
Posted: Sun Sep 14, 2008 11:23 pm
by keyless
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.
Posted: Mon Sep 15, 2008 6:42 am
by Janschenkel
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.
Posted: Tue Sep 16, 2008 4:31 am
by keyless
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.
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. )
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?
Posted: Tue Sep 16, 2008 5:06 am
by Janschenkel
That would be '$#' - though I'm not quite sure when that was added.
Jan Schenkel.
Posted: Tue Sep 16, 2008 6:21 am
by keyless
Janschenkel wrote:That would be '$#' - though I'm not quite sure when that was added.
Jan Schenkel.
It was added in 2.9

I'm using 2.8.1
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
Posted: Tue Sep 16, 2008 5:03 pm
by FourthWorld
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
Posted: Tue Sep 16, 2008 6:56 pm
by matthiasr
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
Posted: Wed Sep 17, 2008 2:31 am
by keyless
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
Posted: Wed Sep 17, 2008 2:32 am
by keyless
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
Thanks for the heads up. Yes, I tested my file drop and it does only allow for 9 files. Any temp workaround?
Posted: Wed Sep 17, 2008 8:30 pm
by matthiasr
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