Need some help using AS with Platypus

I have a small problem with Platypus 3.3 www.sveinbjorn.org/platypus using AppleScript…

I write an application with Bundle Contents, and when the final myPlatypus.app try to path using this script:

set myApp to (path to me as string)

The result is something like: “myHd:Users:MyHome:myPlatypus.app:Contents:Resources:script:”
– it use “script” like being my running app

So I tried:

set myApp to (path to current application as string)

and it returned: “myHd:usr:bin:osascript”
– ???, sorry… I don’t know exactly why it happens :stuck_out_tongue:

And if I try to use:

set myResource to ((path to resource “myResource”) as string)

I got an error couse it path my application Resources folder to “…myPlatypus.app:Contents:Resources:script:Contents:Resources”

I can’t use the “path to frontmost application” command couse user can switch it, and can’t use “path to application “myPlatypus.app”” couse the name can always be changed, and I’m making many variations of the same project.

Im solving this issue with the command:

set resources_folder to (text 1 through -7 of (path to me as string))
So I can change the final of path “…Contents:Resources:script:” to “…Contents:Resources:”

The problem with it is that I can’t use single commands like “tell me to activate” .

I’m newb with Scripts, and I think there’s an easy way to solve it, so plz, can someone give me any help??? :smiley:

Thx so much in advance…

Does this script work okay before you save it as a Platypus app?

If so, it could be a bug in Platypus. On Tiger, whenever I try saving apps with the option “Secure Bundled Script” it breaks the app. I guess I ought to email the developer…

I think the script cant run this kind of command alone, without the application bundle.
If we use path to me with the “Script Editor” for example, it will return something like:
“myHd:Applications:AppleScript:Script Editor.app:”, because the script use the current running appl.

So, about the Platypus, now I understand wht is going on…
The Platypus just use the daemon /usr/bin/osascript to run the script.
Platypus works like a frontmost GUI, and run the file “script” in “Resources” folder of our final Platypus app using “osascript”.

Wht means that “me” will return to the script file, and “current application” to daemon “osascript”, couse it is the real current application running the script, and not our final Platypus appl.

Im solving it using the ‘Creator Code’ of the applications… so, if the user change the name of my application, I’ll find it anywere on hd. To do it, I make a Creator Code (“MyAp” for example) to application bundle, and use command:
tell application “Finder” to set myApplPath to application file id “MyAp” as string

If my Platypus appl have the creator code “MyAp”, “myApplPath” will always return the current path to myPlatypusAppl.app.

So I can easily go to my resources folder. It solved my trouble, couse now Im still not able to use the tell me to quit command, but I can replace it with tell application myApplPath to quit, and got the same result.

I tried to use “Secure Bundled Script” too, with no success… I think its a bug in the Platypus. To solve it, Im compiling my script as “Read Only”, and replacing the file “script” in the Resources of my final appl created by Platypus.

Now, I think is a great idea send an email to developer, and explain all this issues to help him to improve the next release… but, like u can see, my english is not so good to write this mail… :stuck_out_tongue:

Thx so much for your reply!

Model: iMac G4 Flat
AppleScript: 1.10.6
Browser: Firefox 1.5.0.3
Operating System: Mac OS X (10.4)