Rafita Posted September 29, 2008 Posted September 29, 2008 Hi! I'm in the Importing process of a database. In order to verify if the source file exists in the desktop -before "Delete all" script in the destination file-,I tried the "not IsValid ( $desktop ), where $desktop stands for Set Variable [Let ( [ MAC = "filemac:" & Get ( DesktopPath ) ; PC = "filewin:" & Get ( DesktopPath ) ] ; Case(Abs(Get ( SystemPlatform )) = 1; MAC; Abs(Get ( SystemPlatform )) = 2 ; PC ) & "MainDatabase/" & Get ( FileName )) I think that the IsValid step doesn't work here, because it is ignored in the process. Does somebody know if there is any other step to verify in advance if the file or folder exists in the desktop? Tks.
mr_vodka Posted September 29, 2008 Posted September 29, 2008 Take a look at this free plugin written by one of our forums members. Mooplug You can actually do it without using plugin by running a shell script / batch script but the plugin is just easier. :P
Rafita Posted September 30, 2008 Author Posted September 30, 2008 Well, the plug-in looks good for the purpose, but I like to leave plug-ins as a last resource. ¿Don't you think that I could play maybe with the import step, as it warns if it doesn't find the file? Tnx.
Fenton Posted September 30, 2008 Posted September 30, 2008 You can import the file path, [x] Reference only, into a global container field. Trap for error.
Miko Posted November 3, 2008 Posted November 3, 2008 how do you trap for the error. cause currently, my script attempts to copy a file from a server to the desktop using a global container to hold the path. if it doesn't locate it, a window pops up asking for it to be located. the only error i seem to be able to trap is the one canceling the locate dialog. i too am stumped with how to script it to detect a missing file that was originally placed in a container but has been moved or deleted. thanks, Limore
Fenton Posted November 3, 2008 Posted November 3, 2008 Well, so much for my advice :-[ Actually I remember now that it is a method to establish the default dialog path and [x] As reference toggle. So, good for something, but not for what you need. If it was only on a Mac, I'd fall back on FileMaker's Perform AppleScript script step. An AppleScript error can be captured by FileMaker's Set Error Capture ["On"]. If you have the Mac syntax filepath (with the colons)* then the simplest test for a file is (example file): alias "Macintosh HD:Users:fej:Desktop:donuts.pdf" That will produce an error if the file does not exist there, which you can catch in FileMaker. You would have to pass the Mac syntax path into the Perform AppleScript step, by getting it from a field (cell) on the current record, on the current layout (hopefully, though you could also specify a layout where it was, though Insert requires the container field on the layout). * It is pretty easy to convert between an AppleScript path and a FileMaker syntax path. There is also the Get functions like Get (DesktopPath).
Miko Posted November 3, 2008 Posted November 3, 2008 do you know how the syntax would be if you were to use a calculated applescript which dynamically set the file path to a field on the layout?
Miko Posted November 3, 2008 Posted November 3, 2008 replying to myself. gotta love that. here is the applescript syntax for anyone interested in a calculated applescript to test whether a file exists or not. "set thePath to "" & YourTable::FilePath & """ & ¶ & "alias thePath" you must convert the filepath to something that applescript understands. Like: VolumeName:FolderName:FileName.pdf and this can be done with a calculation easily enough. then setting error capture on, trap for -43 which is the applescript error for a file not found. enjoy.
NovaChan Posted January 14, 2009 Posted January 14, 2009 This post is late and just for the record. There is a native method that will work on files, though I'm unsure about folders. The "Import Records" script step does not show any dialogs if you are capturing errors. Just set the import to "update existing records" and only point to an unimportant global field. Error 100 is returned if the file is missing. If you're looking for a specific folder, you're probably out of luck unless you know the name of a file it contains.
sprynmd Posted August 28, 2009 Posted August 28, 2009 This approach almost worked for me. But, if the file I'm checking is a .xls file with multiple worksheets, FileMaker pops up a dialog box asking the user to select a worksheet. I haven't found a way to intercept the dialog box. ...Mike
NovaChan Posted August 28, 2009 Posted August 28, 2009 Thanks for the observation sprynmd. I don't see any way around that prompt either. It would be nice if we could specify a worksheet in the file path, but I don't think that's possible. It is possible to limit the file type to one type like fp7 in the import setup dialog. In that case, invalid files still result in an error dialog, so invalid extensions would have to be handled before the import step. Of course, this doesn't help you. Please post back if you find a good solution!
sprynmd Posted August 31, 2009 Posted August 31, 2009 I was finally able to do what I want using an approach in a different thread: Post# 202706 Using the insert command seems to do the trick for me. Because my system is multi-platform, I had to have 3 file paths on the insert command (the file to be inspected, a known Mac file, and a known PC file). The one thing which tripped me up initially was that the global container had to exist on the current layout. Once I got around that, my file-exists check seems to work fine. I also tried 360Works ScriptMaster free plugin check file, but it only seems to work in the primary disk volume. My files are on a server. ...Mike
NovaChan Posted August 31, 2009 Posted August 31, 2009 Thanks for following up Mike. I like it when the solution is simple, native and clever I haven't used the feature, but it sounds odd that the SriptMaster pluging would only work with the Documents folder. I'm sure someone at 360Works will clarify the details with you via email if you ever need to revisit that approach.
sprynmd Posted September 1, 2009 Posted September 1, 2009 Sorry, NovaChan. I edited my note shortly after posting. 360Works seems to see only the primary disk volume (not just the documents folder). But, I need to see a server volume. I posted a question on that issue in the ScriptMaster forum but have not yet received a response. One more disadvantage of the insert approach to checking file existence is that a large file will take time to insert. All I want is to know that it's there. This is especially frustrating if I'm looping through several records checking files. ...Mike
NovaChan Posted September 3, 2009 Posted September 3, 2009 Mike, Did you try importing the file as a reference only? I just realized that Fenton actually suggested this technique back at the beginning of this thread. Seems the discussion could have ended there for all our progress ;)
NovaChan Posted September 3, 2009 Posted September 3, 2009 Rafael, your question was just sent to my inbox again, so I thought I'd touch back on it. If you're manually supervising an import process with multiple tables, it's often easiest to open the source file beforehand (esp if it's password protected). In this case your script can set error capture [On], open the file [hidden], then trap for errors.
sprynmd Posted September 17, 2009 Posted September 17, 2009 NovaChan: Thanks for the suggestion. Yes, I tried insert by reference. The content of the container requires some additional text-processing because more than just the file name is inserted in the container. Some initial tests seem to show that by-reference does not make a difference on timing. But, it's working now in direct (non-reference) mode and other priorities prevent me from experimenting any more at this time. Thanks again for the input! ...Mike
MParker Posted July 26, 2013 Posted July 26, 2013 replying to myself. gotta love that. here is the applescript syntax for anyone interested in a calculated applescript to test whether a file exists or not. "set thePath to "" & YourTable::FilePath & """ & ¶ & "alias thePath" you must convert the filepath to something that applescript understands. Like: VolumeName:FolderName:FileName.pdf and this can be done with a calculation easily enough. then setting error capture on, trap for -43 which is the applescript error for a file not found. enjoy. i know this is a really old post, and i'm terribly sorry for bumping it, but i just wanted to say thank you so much....you just saved my a$$ with that. big time.
Newbies Costa Zachariou Posted September 24, 2018 Newbies Posted September 24, 2018 (edited) Anyone know how to install MooPlug into FIleMaker 16 Pro Advanced 64bit? I placed the .fmx file into the extentions folder under AppData/.../... but it is not showing in the Preferences Dialog Window under the Plugin tab? Edited September 24, 2018 by Costa Zachariou Typo error
Lee Smith Posted September 24, 2018 Posted September 24, 2018 Hi Costa, I just searched for "MooPlug and found that they have a support link. http://mooplug.com/docs If you don't get help from someone here, perhaps MooPlug can short cut your question. Lee
Fitch Posted September 24, 2018 Posted September 24, 2018 This thread started in 2008. MooPlug hasn't been updated since 2010. It's now 2018. I wouldn't assume it even works with FM16. @Costa, you didn't say what your goal is, but if you want a great supported free plugin, try: http://www.goya.com.au/baseelements-plugin/
Newbies Costa Zachariou Posted September 26, 2018 Newbies Posted September 26, 2018 Thank you all who replied to my question. @Fitch I will take a look at BaseElements.
Recommended Posts
This topic is 2318 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