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

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

Recommended Posts

Posted

I am in the process of making a filemaker 5 database that is intended to store a large amount of scientific info. I have been unable to create a script that will allow me to open a file in another application, where the name of the file to be opened is the content of a field.

The doc to be opened is a string of letters representing DNA sequences and the application I want to open them in is called MacVector 7.

I am making this database on a MAC! Not in windows.

This seams like a really basic comand and I'm sure it can be done, just not by me. Can anybody help???

Posted

Since MacVector is actually performing the open function the first step is to check is if MacVector is AppleScriptable. Use the "Open Dictionary" command in Script Editor and select your app to open to do this. Let us know.

Posted

Yes MacVector is Scriptable. I can write a script to open the apllication or to open a file in it if I specify the file name. What is giving me trouble is writing a script that will use the data in a field as the file name.

Mike

Posted

Sorry, not sure how much info you needed, anyways here is a basic line of script that can set a variable, ie: "DNAname" in applescript to a field in FM. ie: Doc Name

Seems like you have the documents path issue taken care of.

tell application "FileMaker Pro"

set DNAname to cell "Doc Name" of current record

Posted

Still can't get it to do what I want, so I thought I would re-write the problem and try to make it clearer.

So I have created the database layout and defined all the fields. I want to make a button that when pressed will fire up a script that will open a document in another application. I can make it work if I specify the file to open, but I don't want to have to write a script for every record. What I want is for the script to fire up the application and then use data contained if the feild (ie the file name) to specify the file to open. I have the file saved in a seperate folder so I will have to write a script that tells the program where the file is located, so that the only info in the field is the file name.

Cheers for all your help,

Mike

Posted

I'll expand on what Manitobaangler wrote:

code:


tell application "FileMaker Pro"

set DNAname to cell "Doc Name" of current record of database "MyDatabase.fp5

end tell

tell application "MacVector 7"

open file DNAname

end tell


"MyDatabase.fp5" is the name of your filemaker file. Including it in the script guarantees that the data can be found if you have more than one Filemaker file open.

Doc Name is the name of the field in your filemaker file that holds the filename of the document that you want to open in MacVector. The file name must be a complete path name of the form "Macintosh HD:SomeFolder:AnotherFolder:MyFile"

Posted

WooHoo!!!

That works great!! The only problem is that I now have to enter the whole path in the field so the the correct file can be found. Is there anyway I can specify the majority of the path in the script, so that only the file name needs to be entered in the field???

Thanks for your help,

Mike

Posted

code:


set docPath to "Macintosh HD:SomeFolder:AnotherFolder:"

tell application "FileMaker Pro"

set DNAname to cell "Doc Name" of current record of database "MyDatabase.fp5

end tell

tell application "MacVector 7"

open file (docPath & DNAname)

end tell


Posted

Thanks Bob, that script works great for the majority of my data. In another section of my database I have a button that fires a script that should open a file (file name specified in a feild and the path specified in the script as you showed me) in adobe photoshop 6, however when I write the script (as you showed but changing the relevant application names and field names) I get an error message that says "can not find the applications event dictonary." - any ideas what this might mean??

Plus - Is there a line I could put into the script that will make the application that is fired come to the foreground?

Thanks for all your help - you the man!

Cheers,

Mike

Posted

thought this might help, here is the script I am using that gives the error meeage. The message appears after filemaker asks me to show it where photoshop is.

set docPath to "Wallace:GatewayDatabase:Images:"

tell application "FileMaker Pro"

set Pic to cell "Image1" of current record of database "Gateway database"

end tell

tell application "Photoshop6"

open file (docPath & Pic)

end tell

and the error message is "can't get applications event dictonary"

Thanks again,

Mike

Posted

To bring an application to the foreground, use the applescript command "activate." Just put it on a line by itself right after the "tell application ...." line.

If the event dictionary cannot be found, it sounds like the application may not be scriptable, but Photoshop should be. You might want to try writing a very short script using the script editor to see if it works from there. Something like:

tell application "Photoshop6"

activate

end tell

Also, see if you can open Photoshop's dictionary from the Applescript Script Editor. The open dictionary command is under the file menu of Script Editor.

Posted

Thanks Bob. I've now got that script working as I hoped it would and the photoshop one is also working - you are truely the script master!!

I have recently came upon another problem, in a way similar but slightly different. I would like to make a button that fires up the web, the page that I would like it to open will be different for each record. I would like to contain a small part of the address in a feild and the rest of the address within the script.

An example address is:

http://flybase.bio.indiana.edu/.bin/fbidq.html?FBgn0003520

The bit that is contained within the feild is:

FBgn0003520

Is this sort of script possible??

Thanks for your help,

Mike

Posted

Just a brief reminder. If a field has the full path to a file including the file name it it, you can cast that path to an alias and have the Finder open it. That way the application opens in its creator application. Be sure that application is installed however or you will get the "Can't find the application that created...." errpr.

HTH

Old Advance Man

Posted

You don't need applescript to open a URL. Use a filemaker script with the Open URL step. Make a calculated field FullURL with the following formula:

"http://flybase.bio.indiana.edu/.bin/fbidq.html?" & WebPage

where the WebPage field holds the "FBgn0003520" part.

Then have your button execute this script:

Open URL[FullUrl]

Posted

Thanks again Bob.

It works but there is a monar problem, I was wondering if there is a way round it?

Heres what I did:

I went to define fields and created a calculation called FullURL

When asked to specify calculation I wrote -

"http://flybase.bio.indiana.edu/.bin/fbidq.html?" & Gene Fly Base ID

and told the program that the result would be text.

The field "Gene Fly Base ID" contains the end of the address

I then went to scriptmaker and made a new script:

Open URL["FullURL"]

Now the problem:

When you hit the button that executes the script FileMaker displays a dialog bix called Specify URL, which has two options

1. field value which is set to "FullURL"

2. text

If you just hit OK and let it use the feild value it opens the page no problem, but it would be nice if the program would by-pass this dialog box and just use the field value to go straight to the web page - can this be done???

Cheers,

Mike

Posted

Once again I have to thank you - you truely are the man when it comes to FileMaker. I don't believe I misted the check box, but oh well.

Thanks for all your help, the database now functions really slickly and is user friendly, plus it looks cool too, or at leat it will once I sort out the colours and get some images in it.

Cheers,

Mike

smile.gif" border="0

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