January 14, 200521 yr I know this has to be here, somewhere, but I can't find it! Can someone please give me the correct syntax for Send Message to delete a windows file? I have a script that imports data from an excel file into my FMP6 app, and I want the script to delete the excel source file after the import. Also need the same for Apple Send Event command. Thanks.
January 14, 200521 yr Ellen, Try this: SendMessage ["aevt","odoc","cmd /c del c:folderfolderfile.ext"] Maybe sombody else can "weigh-in" on the Mac commands. I haven't touched an Apple machine in over 10 years.
January 14, 200521 yr On Mac: Perform AppleScript [ text below ] tell application "Finder" delete file "complete file path" end tell If you don't know the complete file path on each user's machine, it can be put together, either by AppleScript: set theDesktop to (path to desktop as string) -- the above cannot be inside the Finder block set theFilePath to theDesktop & "folder path (if any):file.xls" tell application "Finder" delete file theFilePath end tell Or by combining the file's relative location to the current database file; whose folder path, as a FileMaker Unstored calculation, is (on a Mac): Substitute( Left(Get(FilePath); Position(Get(FilePath); "/"; 1; PatternCount(Get(FilePath); "/"))); ["/"; ":"]; ["file::"; ""] )
January 15, 200521 yr You might want to consider a file plugin, which will give you a lot more functionality. Look at Troi, and a free one at David McKee's site Protolight Steve
January 16, 200521 yr If you are more comfortable with UNIX/DOS style commands than Applescript, you can accomplish the same thing on the Mac by using the "Send Event" script step to execute a shell script with the "Do Shell Script" Applescript command. Now that I read that back to myself, it sounds kind of complex, but it is really easy... Just paste this into the "Calculated Applescript" dialog in the Perform Applescript script step: "do shell script "rm -f /myFolder/myFile.txt"" Where "myFolder" is a folder at the top level of the hard drive (Macintosh HD, or whatever) and "myFile" is the file to delete. If that is confusing, work backwards... You would type this into the Terminal to accomplish the task: rm -f /folder/folder/asdf.txt Therefore, you would type this into the Applescript Script Editor application (not FileMaker)... do shell script "rm -f /folder/folder/asdf.txt" So, to make that fly in a FileMaker calulation dialog, you have to quote the whole thing and escape the existing quotes... "do shell script "rm -f /myFolder/myFile.txt"" Once you get your head around it, you will find youself using the same concept for all kinds of file management... HTH, j
November 1, 200619 yr Picking up an old thread... If you are more comfortable with UNIX/DOS style commands than Applescript, you can accomplish the same thing on the Mac by using the "Send Event" script step to execute a shell script with the "Do Shell Script" Applescript command. I am a little confused here. Should one use the "Send Event" of "Perform AppleScript" ScriptMaker command? However, neither is working for me. Eg, I want to execute "top -u" in the Terminal, directly from Filemaker. I am using the "Perform AppleScript" script step and it goes like this: tell application "Terminal" activate do shell script "top -u" end tell Terminal opens up right, but nothing is happening. What is wrong? While we are on the subject; I'm wondering if it is possible to do the following (FM8.5, OS X) - Start a Filemaker script from the Terminal? - Pass shell variables from the Terminal to scripts in Filemaker?
Create an account or sign in to comment