EllenG Posted January 14, 2005 Posted January 14, 2005 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.
Ted S Posted January 14, 2005 Posted January 14, 2005 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.
Fenton Posted January 14, 2005 Posted January 14, 2005 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::"; ""] )
SteveB Posted January 15, 2005 Posted January 15, 2005 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
jonathanstark Posted January 16, 2005 Posted January 16, 2005 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
carlsson Posted November 1, 2006 Posted November 1, 2006 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?
Recommended Posts
This topic is 6599 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