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

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

Recommended Posts

Posted

I want FileMaker to perform shell scripts that use ImageMagick, the command-line-based image manipulation library.

I installed IM on my machine using MacPorts and tested it thoroughly in Terminal. I also successfully performed some generic shell scripts in FileMaker, using both the Troi File Plug-in and the Perform Apple Script ("do shell script") script step.

But if I try to call the IM "convert" command from within FileMaker via either the plug-in or AppleScript, it says "command not found" and "Unknown error 127." (Actually, that's what happens when using AppleScript, the plug-in returns no error, but still does nothing.)

Is there a step I'm missing that will allow FM to see the new commands?

Posted

Found the answer here--following the advice in the second paragraph solved my problem:

http://developer.apple.com/technotes/tn2002/tn2065.html

Q: My command works fine in Terminal, but when I try to use it in do shell script, I get an error about "command not found." What’s going on?

A: There are two possibilities. First, do shell script always uses /bin/sh to interpret your command, not your default shell, which Terminal uses. (To find out what your default shell is, say echo $SHELL in Terminal.) While some commands are the same between shells, others are not, and you may have used one of them. If you write your do shell script scripts in Terminal first, always use sh. You can start sh by typing /bin/sh; type exit to get back to your normal shell.

Second, when you use just a command name instead of a complete path, the shell uses a list of directories (known as your PATH) to try and find the complete path to the command. For security and portability reasons, do shell script ignores the configuration files that an interactive shell would read, so you don’t get the customizations you would have in Terminal. Use the full path to the command, for example, /sbin/ifconfig instead of just ifconfig. To find the full path in Terminal, say which command-name, for example, which ifconfig; to see the list of places do shell script will search, say do shell script "echo $PATH".

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