Jump to content
Server Maintenance This Week. ×

Passing data out of FMP using Applescript


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

Recommended Posts

This is a very basic question, I know, but I am having a devil of a time using Applescript to send field contents to another application.

I have a field called Applescript1 which is a Global field and it contains the first part of the Applescript code:

tell application “Dialectic”

dial number “




I'm using a script parameter to capture a phone number field. Here is the Calculated Applescript:




Dash::Applescript1 & Get ( ScriptParameter ) & Dash::Applescript2




Here is the contents of the field Applescript2:




“

end tell

When I run the script I get the message:

"Expected end of line but found class name"

Unknown Error: -2741.

I can't figure out what is wrong. Any help is appreciated.

Thanks much,

Brian

Edited by Guest
including "code" tags
Link to comment
Share on other sites

No, Søren, it's all there. It's just an odd way to put an AppleScript together. The fact that it uses a calculated AppleScript, with a script parameter means there is no easy way to even see what the resulting AppleScript is. I put it into a script Variable, then ran with Script Debugger on, to see the result. But the original poster does not have FileMaker Advanced, so I don't think they can do that (or can they?).

Nor can they see it in a calculation field, as field calculations do not support Get ( ScriptParameter ). What they do support is global fields and global script Variables. So you could set your script parameter into a $$variable, then see the resulting calculation. For example (modified to do something I can do):

tell application “Finder”

open file “Macintosh HD:Users:fej:Desktop:Open via AS.fp7“

end tell

Basically, your calculation should work, if Dialectic supports that command in that format, which I don't know.

Link to comment
Share on other sites

Are you saying that Get (ScriptParameter) doesn't work in the way I'm using it or just there is no way to confirm the Applescript that is being generated with the way I am using it?

Also ho would I set a script parameter to a global variable?

Sorry, I'm still pretty novice.

Thanks for the help.

Link to comment
Share on other sites

Ah, yes, I remember now, the old "debug with dialogs". bb84604, your script works fine for me (tho I don't have Dialectic, so cannot test that). So there must be something else, which you need to see, as comment suggested.

P.S. You set a script Variable with the Set Variable script step. You make it global by using 2 dollar signs ($$). Read about it in the Help.

Link to comment
Share on other sites

OK. Now I'm really puzzled.

Thanks to your good advice I did the custom dialog to capture/view the applescript being generated and it looks perfect.

However it still gives me the same error and doesn't run the script.

I tested the identical script in the Applescript Script Editor and it works fine.

Any ideas??

Link to comment
Share on other sites

This topic is 5329 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.