Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Shell Commands - help please

Featured Replies

I need some assitance with a shell command.

How can I use a shell command to export a set of related records with the file name set to be the related field?

I have the database for a newspaper website, all stories entered by issue umber- there are over 300 issues.

I have a script that finds the related fields, and exports them, but i currently have to manually enter the issue number for the file name. I don't really want to have to type "issue650.txt" issue651.txt etc...

any ideas?

THANKS!

this applescript shell script will rename an exported file called "export.txt" in the path shown, to whatever name you have stored in field NewFileName

"do shell script "mv ~/desktop/FMExportFolder/output.txt ~/desktop/FMExportFolder/"& "newfile.txt" & """

  • Author

when i enter that shell script I get an error message...

"Expected "given","in", "of" expression, "with". "without"< other parameter name, etc. but found token

then it highlights the after script

WHAT on earth does that mean

oh and THANK YOU THANK YOU

Sorry, I gave you the syntax for FM version 7 which uses a different character to escape the quotation marks. Also, in version 6 it needs to be entered as a formula in a calculation field, and then you specify the calc field in the perform applescript step. Here is the correct syntax:

"do shell script ""mv ~/desktop/FMExportFolder/output.txt ~/desktop/FMExportFolder/"& NewFileName & """"

Also see the attached example file.

TestShellScript.fp5.zip

Just a tip if you change the postfix to .htm will HTML tags survive the export, and could convey a more snassy layouts than the ones you can open with textedit...

--sd

Going nuts here

i can change the file name when in Applescript

do shell script "mv ~/desktop/FMExportFolder/output.pdf ~/desktop/FMExportFolder/newfilename.pdf"

but when i add it to filemaker so I can use a Field it doesnt work

"do shell script "mv ~/desktop/FMExportFolder/output.pdf ~/desktop/FMExportFolder/"&"transmittal number"&"""

where transmittal number is the Field i want to use.

As a secondary question to add an extension do i just use

/"&"transmittal number"&".pdf""

thanks

You can't just address a FileMaker field by typing its name as text. You address it as a cell, setting its value into an AppleScript variable.

set transmittal to cell "transmittal number" of current record

(This would be in a FileMaker Perform AppleScript step. Otherwise, from Script Editor you'd need to be inside a "tell FileMaker" block.)

Then you can use that in your line (shortened so I could test it easily)???

set transmittal to cell "transmittal number" of current record & ".pdf"

do shell script "mv ~/desktop/output.pdf ~/desktop/" & transmittal

thanks that makes sense

sorry to be dense but when I try to send accross netwrok I get more errors

is this right to use the ip number?

set transmittal to cell "transmittal number" of current record & ".pdf"

do shell script "mv ~/desktop/transmittal.pdf IP number/volumes/server HD/folder/"& transmittal

The space in "Server HD" may be causing a problem. Try changing it to "Server HD"

If that doesn't work, you may have to try the following:


do shell script "mv ~/desktop/transmittal.pdf afp://username:password@IPaddress/volumes/server HD/folder/"& transmittal 





I don't know if you can reference the remote file without mounting the remote volume first or not. Otherwise you may have to do something like this:





# This should all be on one line

do shell script "mkdir /Volumes/MyTempVolume;

    mount -t afp afp://username:password@IPaddress/volumes/server HD/folder/ /Volumes/MyTempVolume;

     mv ~/desktop/transmittal.pdf /Volumes/MyTempVolume"& transmittal

  • 2 weeks later...

I have discovered to cope with a space in the file path, you need two backslashes eg server HD when running a shell script from filemaker or applescript. One backslash if renning directly from the terminal.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.