Jump to content

Applescript in Filemaker


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

Recommended Posts

I am a newbie to all of this and little idea of what I am doing.

I am trying to create an Applescript in FM that will create a new folder and name that folder by the JobNum field (it is a serial number to identify that record).

Here is the script that I currently have:

tell application "Finder"

activate

make new folder at folder "Current Jobs" of startup disk with properties {name: JobNum}

end tell

The error message that I get when I use this script is:

"The variable JobNum is not defined."

I am having a hard time figuring out what this means and how I can get this script to work. Any help is much appreciated!

Link to comment
Share on other sites

I am a newbie to all of this and little idea of what I am doing.

I am trying to create an Applescript in FM that will create a new folder and name that folder by the JobNum field (it is a serial number to identify that record).

Here is the script that I currently have:

tell application "Finder"

activate

make new folder at folder "Current Jobs" of startup disk with properties {name: JobNum}

end tell

The error message that I get when I use this script is:

"The variable JobNum is not defined."

I am having a hard time figuring out what this means and how I can get this script to work. Any help is much appreciated!

Link to comment
Share on other sites

I am a newbie to all of this and little idea of what I am doing.

I am trying to create an Applescript in FM that will create a new folder and name that folder by the JobNum field (it is a serial number to identify that record).

Here is the script that I currently have:

tell application "Finder"

activate

make new folder at folder "Current Jobs" of startup disk with properties {name: JobNum}

end tell

The error message that I get when I use this script is:

"The variable JobNum is not defined."

I am having a hard time figuring out what this means and how I can get this script to work. Any help is much appreciated!

Link to comment
Share on other sites

It means what it says. If that's the whole script you haven't told it what value JobNum is, and it is reminding you of the fact. As it is JobNum is just an AppleScript variable which has never been set to anything at all, so it's an error.

If this is inside a FileMaker Perform AppleScript step*, it should have something like:

set JobNum to cell "JobNum" of current record

then the rest of the script.

The field JobNum would have to on the current layout for the above to work. Or you can specify the layout:

set JobNum to cell "JobNum" of current record of layout "Job"

There are alternative places to the startup disk, which is the top level, not usually a place where I'd put user documents.

You could use:

make new folder at desktop with properties {name: JobNum}

Which would be the user's desktop. Or

make new folder at (path to documents folder) with properties {name:JobNum}

User's Documents folder

*If this is NOT inside a FileMaker Perform AppleScript step, but is being written or run in Script Editor (perhaps for testing), then it needs a FileMaker tell block:

tell application "FileMaker Pro"

rest of script

end tell

Link to comment
Share on other sites

It means what it says. If that's the whole script you haven't told it what value JobNum is, and it is reminding you of the fact. As it is JobNum is just an AppleScript variable which has never been set to anything at all, so it's an error.

If this is inside a FileMaker Perform AppleScript step*, it should have something like:

set JobNum to cell "JobNum" of current record

then the rest of the script.

The field JobNum would have to on the current layout for the above to work. Or you can specify the layout:

set JobNum to cell "JobNum" of current record of layout "Job"

There are alternative places to the startup disk, which is the top level, not usually a place where I'd put user documents.

You could use:

make new folder at desktop with properties {name: JobNum}

Which would be the user's desktop. Or

make new folder at (path to documents folder) with properties {name:JobNum}

User's Documents folder

*If this is NOT inside a FileMaker Perform AppleScript step, but is being written or run in Script Editor (perhaps for testing), then it needs a FileMaker tell block:

tell application "FileMaker Pro"

rest of script

end tell

Link to comment
Share on other sites

It means what it says. If that's the whole script you haven't told it what value JobNum is, and it is reminding you of the fact. As it is JobNum is just an AppleScript variable which has never been set to anything at all, so it's an error.

If this is inside a FileMaker Perform AppleScript step*, it should have something like:

set JobNum to cell "JobNum" of current record

then the rest of the script.

The field JobNum would have to on the current layout for the above to work. Or you can specify the layout:

set JobNum to cell "JobNum" of current record of layout "Job"

There are alternative places to the startup disk, which is the top level, not usually a place where I'd put user documents.

You could use:

make new folder at desktop with properties {name: JobNum}

Which would be the user's desktop. Or

make new folder at (path to documents folder) with properties {name:JobNum}

User's Documents folder

*If this is NOT inside a FileMaker Perform AppleScript step, but is being written or run in Script Editor (perhaps for testing), then it needs a FileMaker tell block:

tell application "FileMaker Pro"

rest of script

end tell

Link to comment
Share on other sites

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