English 中文(简体)
Communication between applescript and FileMaker
原标题:

I m currently writing an applescript to be run within FileMaker. I need to tell filemaker what the name of its application is (FileMaker Pro or FileMaker Pro Advanced or whatever) so that I can within ANOTHER applescript within filemaker I can say "tell application filemaker"

I currently have a script that figures out the name of the app file, however, the problem is getting it back into filemaker. The name I want to send back is in the applescript variable "FMName" I can think of 2 options

1)

tell application FMName
   set cell "gFMName" of current record to FMName
end tell

The problem with this is that even though I know that application FMName will have a set cell command, applescript doesn t and so complains.

2) have the applescript either return a value or an error message and somehow get FileMaker to accept this and do something useful with it.

The problem with this is that 1)it appears that Applescripts can only return numbers (is this true?) 2) I don t want an error dialog or anything, and 3) I have not figured out how to get filemaker to accept this return value in the first place...

Anyone have any better ideas on how to do this?

Thanks!

最佳回答

Since (if I understand you correctly) no matter what the application is that s being targeted, it s a version of FileMaker, whether FileMaker Pro or FileMaker Pro Advanced or even a runtime version of FileMaker, the dictionary being used will have the same terms available. So, you could use the using terms from application "FileMaker Pro" to enclose the block that you want to execute.

using terms from application "FileMaker Pro"
    tell application FMName
        set cell "gFMName" of current record to FMName
    end tell
end using terms from

I haven t experimented with it, so am not sure if it will work. It seems your goal is to get one FileMaker application to receive data from the AppleScript in another FileMaker application. I do wonder, however, why you re using two FileMaker applications. Are they different versions (i.e., FileMaker 10 and FileMaker 6)? If so, perhaps having the AppleScript write the data to a file that the second FileMaker application then imports is an option. But if they are both FileMaker 7-10, why not simply open the two files in the same application? Then you can write the data from AppleScript directly to the correct file.

问题回答

I know this thread is a bit stale now, but here s what I do - use an if statement. Use the Get(ApplicationVersion) function to find out what kind of FileMaker is running:

If ( PatternCount ( Get ( ApplicationVersion ) ; "Advanced" ) ; 
"tell application "FileMaker Pro Advanced""   ; 
"tell application "FileMaker Pro""  )

I have taken this a step further and set it up as a custom function so I don t have it repeated in many different scripts.

This was answered but I though I would add something I discovered lately. If you target another app, say the Finder, with a "Tell application Finder Activate" then those FMP calls will fail because your now IN the Finder till you do an "End Tell" or explicitly point back to FMP.

The solution that was pointed out to me was to do the out side calls in a single line such as

"Tell application Finder to [what ever you needed the Finder to do]"

This directs just that tell to the non FMP application but leaves you still IN FMP so your FMP calls will work.

This becomes an issue with runtimes since the runtime name will be different from your development application name.





相关问题
2 mysql instances in MAC

i recently switched to mac. first and foremost i installed xampp. then for django-python-mysql connectivity, i "somehow" ended up installing a seperate MySQL. now the seperate mysql installation is ...

Iterating over string/strlen with umlauted characters

This is a follow-up to my previous question . I succeeded in implementing the algorithm for checking umlauted characters. The next problem comes from iterating over all characters in a string. I do ...

Controlling OSX windows

I m trying to control windows of a foreign OSX applications from my application. I d like to 1. move the windows on the screen 2. resize the windows on the screen 3. change the currently active window ...

Switching J2SE versions on Mac OS (SnowLeopard)

My current JDK on Mac OS (10.6) is set to 1.6 and I d like to switch to 1.5. A listing of /System/Library/Frameworks/JavaVM.framework/Versions/ shows: lrwxr-xr-x 1 root wheel 10 Nov 3 18:34 ...

Scrolling inside Vim in Mac s Terminal

I ve been googling around trying to figure out if it s possible to use my mouse wheel to scroll while inside Vim in Mac s Terminal, with no luck. It seems as if only X11 or iTerm support this. Before ...

export to MP3 from quicktime API

A question for Apple,QT programmers. Would like to know if it s possible to export a Movie object to MP3 using the QuickTime API. Preferably the ConvertMovieToFile function. I ve looked at ...

热门标签