May 25, 200520 yr 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!
May 25, 200520 yr 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" & """
May 25, 200520 yr 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
May 26, 200520 yr 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
May 26, 200520 yr 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
June 1, 200520 yr 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
June 1, 200520 yr 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
June 1, 200520 yr 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
June 2, 200520 yr 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
June 12, 200520 yr 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