Quartekoen Posted January 3, 2011 Posted January 3, 2011 I would like to know of there is a way to open a specific file's location using ScriptMaster. Context: Whenever we print an invoice from FileMaker, part of the process is to create a PDF of the invoice and save it to a network drive. The invoice within FileMaker is then stored in a separate FM database that salespeople can access if needed, but this backup is not explicitly connected to the PDF that was created. In this "sent invoices" database, it would be nice to have a button that, when clicked, would open the location within windows explorer of the PDF that was created for that invoice and, ideally, highlight it. This seems like it would be a lot more natural for the users than creating a new PDF, locating it on their own within the file system, then deleting it when they're done. Note that all PDF's are saved to a specific location that does not change, and the names of the PDFs include the unique invoice number they are associated with. The difficulty is not in locating the PDF that was created at the time of printing, but rather opening a folder window from within FileMaker. It seems like this should be possible with ScriptMaster and Groovy, but I'm having dificulty. Any suggestions? (For anyone that uses iTunes, this would hopefully be similar to right clicking on a song and choosing "Show in Windows Explorer") Thanks.
john renfrew Posted January 4, 2011 Posted January 4, 2011 If you know its path, why not just open it in a webviewer??
Quartekoen Posted January 4, 2011 Author Posted January 4, 2011 The goal is not to simply view the file, but to quickly locate it on the network so that it can, for example, be attached to an email. I realize that FileMaker is capable of exporting a PDF that automatically attaches to an email, but this tends to be more work than attaching an existing file, plus it causes a duplicate of the PDF to be created. I have had some luck with a solution. While it doesn't use ScriptMaster, it does work very closely to what I was looking for. Basically, you create a batch file (sorry, Mac users) with the line "explorer /select Your\Path\Here". The only problem with it is that it doesn't work if you already have a window open of the folder that your file is in. If anyone else would like info on this, you can read up on it here. Thanks.
dansmith65 Posted January 5, 2011 Posted January 5, 2011 Funny, I just came to this forum with the same question. If I ever find out, i'll be sure to post back here. FYI: Here is how I do this without a plugin: Windows Open URL script step: "C:/Users/Public/Recorded TV/Sample Media/" Mac AppleScript step: tell application "Finder" open POSIX file "/Volumes/Network Share/Folder/" activate end tell You would need to create the above output for each via a calculation (escaping quotes as necessary, and including ¶ after each line for the AppleScript)
Tim Anderson Posted January 5, 2011 Posted January 5, 2011 You can also use open url on a Mac For local Folders file:///Users/me/Documents/ or for remote volumes afp://xxx.xxx.xxx.xxx/RAID/MyFiles/
Quartekoen Posted January 10, 2011 Author Posted January 10, 2011 So I figured I'd respond with the final result of all of this (well, re-respond... those darn hard drive failures...) The script that works: Set Variable[ $fileLocation ; Get( DocumentsPath ) & "batchFile.bat"] Set Variable[ $write; Value: WriteToFile( $fileLocation ; "explorer /select, \"X:\Your\Path\Here\Filename.pdf\"")] Send Event[ "aevt" ; "odoc" ; "$fileLocation" ] Pause/Result Script [Duration (seconds): 1] Set Variable [$delete ; Value: DeleteFileOrFolder( $fileLocation )] A couple of notes: The comma after /select IS required for it to work. Also, I included the pause step because without it, it seems that the script manages to delete the file before explorer can run it! Obviously there's a lot more that needs to be done (such as error capture, etc...), but this does do the trick! Thanks to everyone that helped.
john renfrew Posted January 10, 2011 Posted January 10, 2011 Now I remember what I was going to write This code will just 'run' the pdf, which will open it in the default reader for the OS, just feed it a valid OS path to a pdf. No need to export and then run batch files. // PDFOpen (fm_FileIn) // 10_06_01_JR // v1 // open file in registered desktop application import java.awt.Desktop desktop = new Desktop() file = new File(fm_FileIn) desktop.open(file) return true
Recommended Posts
This topic is 5077 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