Madapple Posted May 25, 2005 Posted May 25, 2005 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!
BobWeaver Posted May 25, 2005 Posted May 25, 2005 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" & """
Madapple Posted May 25, 2005 Author Posted May 25, 2005 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
BobWeaver Posted May 26, 2005 Posted May 26, 2005 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
Søren Dyhr Posted May 26, 2005 Posted May 26, 2005 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
Aussie John Posted June 1, 2005 Posted June 1, 2005 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
Fenton Posted June 1, 2005 Posted June 1, 2005 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
Aussie John Posted June 1, 2005 Posted June 1, 2005 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
BobWeaver Posted June 2, 2005 Posted June 2, 2005 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
Aussie John Posted June 12, 2005 Posted June 12, 2005 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.
Recommended Posts
This topic is 7103 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 accountSign in
Already have an account? Sign in here.
Sign In Now