Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4838 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Please help.

I am trying to delete a file via an automated script, and my IT guys want me to do it via applescript as opposed to buying a plugin. When we run the applescript outside of filemaker it seems to work... for instance when we run the below script in the terminal window on my mac, it works, but when we try and pass that through the applescript command in FM it doesn't do anything.

here is the syntax... what are we doing wrong. ? This comes from a formula he used trying to get the same format as in the terminal window.

"tell application \"Finder\"" & ¶ &

"delete file " & Quote($as_command) & ¶ &

"end tell"

$as_command = posix path = /Volumes/Show/Elements/Segments/...

The other command I've tried is

"try" &¶ &

"do shell script \"rm " & Quote($as_command) & "\"" &

"end try"

Posted

You cannot use a POSIX path as such in Applescript. Try something like:

delete POSIX file & Quote ( $yourPosixPath )

Re your other attempt, you cannot use double quotes within double quotes; put the filepath in single quotes.

Posted

Thanks for the help, I'm not getting it. I have this in my applescript editor to make it work there, and it errors on the first ( and tell me it's expecting an end of line there.

tell application "finder"

delete POSIX file & Quote ( /Volumes/Macintosh HD/User/Administrator/Desktop/test.txt )

end tell

Posted

Well, Quote() is a Filemaker function - you can't use it in AppleScript Editor. The thing is you eventually want to get:

tell application "Finder"

delete POSIX file "/Volumes/Macintosh HD/User/Administrator/Desktop/test.txt"

end tell

so if you are using a calculated AppleScript, your calculation (i.e. your Filemaker calculation) must return exactly the text above. If your POSIX path is stored in a $path variable, you could use:

"tell application \"Finder\"" & ¶ &

"delete POSIX file " & Quote ($path) & ¶ &

"end tell"

as the formula.

Posted

Thanks for publishing the full script... it's really helpful. I will give it a bash in a week after my final week off. Thanks for support... it's great.

s

Posted

Don't know if anyone can still help me... but,

I heard back from my IT guy. He is a real filemaker wiz, and he's tried what was suggested here, and can't get it to work. Is it possible there is a differernt syntax for a volume mounted via the network? I believe it is connected via afp - (or possibly smb), and the syntax in this thread simply isn't working.

Any other suggestions are most welcome!

Steve.

This topic is 4838 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.