Dropping a folder onto a closed standalone

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Chris
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10
Joined: Tue Mar 27, 2007 1:24 pm

Dropping a folder onto a closed standalone

Post by Chris » Fri Oct 21, 2011 12:31 pm

Hello folks -

I'm hoping this one is easy, but I can't seem to find the answer anywhere. I want to be able to open a standalone by dropping a folder onto it. Now actually that bit is easy (on Mac at least) by including "folder" in the pList data. But how do I pass the folder path to the stack script so that I can actually act on the folder?

I've tried using "the dragData["files"]" in the preOpenStack script, but that seems to be empty.

Any ideas?

and then... how do I do it in Windows???

Chris

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Dropping a folder onto a closed standalone

Post by Mark » Sun Oct 23, 2011 10:30 pm

Hi Chris,

On Mac, use the AppleEvent handler. Here's an example.

On Windows, you might be able to use the $0, $1, $2... variable.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Chris
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10
Joined: Tue Mar 27, 2007 1:24 pm

Re: Dropping a folder onto a closed standalone

Post by Chris » Sun Oct 23, 2011 10:37 pm

Brilliant! Thank you!

(Actually, your sample script anticipates another problem I have. Elsewhere in my project I need to be able to identify valid audio files. The "file type" external that is alluded to: where could I find such a thing? Or should I just roll my own function by looking at filename extensions?)

Thanks again,

Chris

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Dropping a folder onto a closed standalone

Post by Mark » Sun Oct 23, 2011 10:55 pm

Hi Chris,

File types are really just codes that are somewhere in the desktop database on Mac. These days, a file may very well have an incorrect file type or no file type at all. They are no more reliable than the file extensions. On Windows and Linux machines, such a thing like file type doesn't even exist.

You might check the file type if no file extension is present or if the file extension is insufficiently specific. However, you may be unable to detect a (correct) file type.

If a file type is present, you will find this info in the detailed files function.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply