-
02-24-2012, 09:00 AM #1Limited Access Member
- Location:
- USA
- Join Date
- Oct 2011
- Posts
- 2
- FM Version
- FileMaker Pro 11
- Skill Level
- Novice
- OS
- Mac
- Rep Power
- 0
"Save as..." dialog using Open URL?
I'm setting up a runtime for students accessing mp3 audio files over a server. I was using a script with "Open URL" and a text field with the URL path to the audio file:
Text field "mp3URL"
Contents: file:///Volumes/HardDrive01/MUSIC_COLLECTION/mp3_files/cd001/cd00101.mp3
Script Name: GoToMp3URL
Open URL [no dialog Tracks::mp3URL]
However, clicking the button to run the script opens the mp3 in the default browser and starts playing it. If I delete the "cd00101.mp3" from the path it will open the containing folder of the mp3 and it's a workaround for now.
What I really want is for the student to click a script button and have a "Save as" dialog pop up so they can save the mp3 to a place of their choosing.
I was researching and saw the use of variables as a possible solution but being a novice at FM it was hard to decipher:
http://filemakertoday.com/com/showth...me-as-filename
Any help would be appreciated.
Thanks
-
02-24-2012, 12:44 PM #2Moderator - Editor
- Location:
- New York (Manhattan) USA
- Join Date
- Aug 2006
- Posts
- 10,015
- FM Version
- 12, 10, 9, 8.5, 8, 7, 6, 5.5., 5, 4.1, 4, 3, 2.1, 1, II; & the old Nashoba versions. But not 11
- Skill Level
- Developer
- OS
- Windows & Mac
- Blog Entries
- 1
- Rep Power
- 10
Re: "Save as..." dialog using Open URL?
I'm unclear about the desired behavior. Do you WISH for FileMaker to play the file itself (not open it in the default browser but instead have FileMaker Pro itself start playing the file)? Or do you wish to MOVE or COPY the file to a user-specified location and NOT play the file? Or both (play the file and then if the student wants a copy, save the file to a locatio nof the user's choosing)?
a) You can play the file by making a calculation field of result type "container" defined as follows:
"moviemac:///Volumes/HardDrive01/MUSIC_COLLECTION/mp3_files/cd001/cd00101.mp3"
or, more usefully, probably:
"moviemac:///Volumes/HardDrive01/MUSIC_COLLECTION/mp3_files/" & YourTable::WhichCD & "/" & YourTable::FileNameOfTrack
then execute this script step:
go to Field [select/play, YourTable::YourCalculationField]
b) You can copy the file using Perform AppleScript to do shell script to copy the file as you would using Terminal commands.
Perform AppleScript [calculated value]:
Let (Qmk = """";
"do shell script" & Qmk & "cp /Volumes/HardDrive01/MUSIC_COLLECTION/mp3_files/" & YourTable::WhichCD & "/" & YourTable::FileNameOfTrack & " " & UserDefined/Path/to/DesiredFolder/ & YourTable::FileNameOfTrack & Qmk )
c) Allowing the user to specify a path to desired folder is messier. Easiest is to make user choose between a folder (that they create or that you create using another Perform AppleScript / do shell script) named "MP3files" at the root of their Documents folder or at the root of their Desktop folder. Then you get to do this:
Let (Qmk = """";
"do shell script" & Qmk & "cp /Volumes/HardDrive01/MUSIC_COLLECTION/mp3_files/" & YourTable::WhichCD & "/" & YourTable::FileNameOfTrack & " " & Get (DocumentsPath) & "MP3files/" & YourTable::FileNameOfTrack & Qmk )
Alternatively, you can have user type in a full folder path into a global text field and use that instead of Get(DocumentsPath).
Or, as brsamuel pointed out recently you can use Perform AppleScript to have AppleScript get the user to pick the folder. The above-linked brsamuel post has a link to a custom function called AS_ChooseFolder.
-
02-24-2012, 04:26 PM #3Limited Access Member
- Location:
- USA
- Join Date
- Oct 2011
- Posts
- 2
- FM Version
- FileMaker Pro 11
- Skill Level
- Novice
- OS
- Mac
- Rep Power
- 0
Re: "Save as..." dialog using Open URL?
Thanks for the response. Before I digest (or attempt to) what you wrote let me further clarify. I've already created a PlayTrack button for auditioning the lower rez mp3 files using a calculation with the result being a container. So I just need to "copy" the CD quality version of the file once they decide they want to use it in their production.
What I would like is when the student clicks a W (WAV version of the file) or M (mp3 version of the file) button a typical "Save file as" window will pop up so they can save the hi rez version of the file off the server to their hard drive.
I have another problem in that I need to make a Mac runtime and a Win runtime so while AppleScript could work for the Mac version what do I do about the Win version?
I was thinking that maybe I should just use Desktop as the default save location since both Mac and Windows have a desktop. They can then manually move the files.
Also, I could make two more calculations and make the W and M buttons the resulting container fields. Right-clicking the W or M button gives the "Export field contents..." option which pops an Export to File window and allows you to save the file. I'll need to test that.
-
02-24-2012, 04:47 PM #4Moderator - Editor
- Location:
- New York (Manhattan) USA
- Join Date
- Aug 2006
- Posts
- 10,015
- FM Version
- 12, 10, 9, 8.5, 8, 7, 6, 5.5., 5, 4.1, 4, 3, 2.1, 1, II; & the old Nashoba versions. But not 11
- Skill Level
- Developer
- OS
- Windows & Mac
- Blog Entries
- 1
- Rep Power
- 10
Re: "Save as..." dialog using Open URL?
For Windows, instead of AppleScript that performs a "do shell script" followed by the cp command you'd type in Terminal, you issue a Send Event that speaks to "cmd" and then after an initial "cmd /c" you issue the MSDOS type command you would issue at the Windows command prompt:I have another problem in that I need to make a Mac runtime and a Win runtime so while AppleScript could work for the Mac version what do I do about the Win version?
Set Variable [$SourcePath; {PC style path to source file goes here}]
Set Variable [$DestPath; {PC style path to destination goes here} ]
Set Variable [$PCCommand; Let (Qmk = "\""; "cmd /c cp "&Qmk & $SourcePath & Qmk & " " & Qmk & $DestPath & Qmk)]
Send Event [to cmd, $PCCommand]
Not that PC style paths have backslashes; you'll need to escape those when specifying $SourcePath and $DestPath:
Let (Bksl = "\\";
"E:"&Bksl & MUSIC_COLLECTION" & Bksl & "mp3_files" & Bksl & YourTable::WhichCD & Bksl & YourTable::FileNameOfTrack
)
etc
-
04-11-2012, 03:47 AM #5Limited Access Member
- Location:
- Malaysia
- Join Date
- Apr 2012
- Posts
- 3
- FM Version
- 11 advanced
- Skill Level
- Entry Level
- OS
- Windows
- Rep Power
- 0
Re: "Save as..." dialog using Open URL?
dear sir, i am very new in filemaker. i'd like to ask that do we still use the openURL to open an URL which contains a .csv file? then run the shellscript PC equivalent?
I have a table of stock prices, i would like to get the quotes from yahoo which is in csv file. so the plan is to download it onto the desktop and use an import script the import the csv into my fm database. please advise.
-
04-11-2012, 04:11 AM #6Moderator - Editor
- Location:
- New York (Manhattan) USA
- Join Date
- Aug 2006
- Posts
- 10,015
- FM Version
- 12, 10, 9, 8.5, 8, 7, 6, 5.5., 5, 4.1, 4, 3, 2.1, 1, II; & the old Nashoba versions. But not 11
- Skill Level
- Developer
- OS
- Windows & Mac
- Blog Entries
- 1
- Rep Power
- 10
Re: "Save as..." dialog using Open URL?
Depends on the behavior of your browser.
Let's say the URL to the file is http://www.domain.com/folder/filename.csv
If you click the URL (or paste it into the address bar or manually type it into the address bar) does it download the file or display it in the web browser window?
If it downloads, you can download it to the default location (probably a Downloads folder) and then (without importing it into the database, that's not necessary) open it using Send Event.
-
04-11-2012, 04:36 AM #7Limited Access Member
- Location:
- Malaysia
- Join Date
- Apr 2012
- Posts
- 3
- FM Version
- 11 advanced
- Skill Level
- Entry Level
- OS
- Windows
- Rep Power
- 0
Re: "Save as..." dialog using Open URL?
any way for me to 'auto' this part? i have the url in the table. where a timer triggered the openurl and it downloads to desktop. thats cause the prices are to be updated every 15 mins. so if downloading it manually then it beats the purpose. thank you for your quick response
-
04-11-2012, 03:27 PM #8Moderator - Editor
- Location:
- New York (Manhattan) USA
- Join Date
- Aug 2006
- Posts
- 10,015
- FM Version
- 12, 10, 9, 8.5, 8, 7, 6, 5.5., 5, 4.1, 4, 3, 2.1, 1, II; & the old Nashoba versions. But not 11
- Skill Level
- Developer
- OS
- Windows & Mac
- Blog Entries
- 1
- Rep Power
- 10
Re: "Save as..." dialog using Open URL?
Downloading files from a web address requires Filemaker Pro (FmServer won't do it; web space is user-space not services-space).
So you'd need a dedicated machine (virtual machine would do fine) and put a script in a perpetual loop; open the file on that machine and start the script; the script downloads and then inserts file into container then pauses 15 minutes, in a never-ending loop.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads - The answer to your question may be in one of these posts!
-
Buttons in a "Show Custom Dialog" script
By saltobello in forum FileMaker Pro 8.5Replies: 8Last Post: 05-25-2012, 09:24 AM -
Portal of "Glossary" field with two columns, one "Spanish" and one "French"
By LanguageAmbassador in forum Portal & RelationshipsReplies: 8Last Post: 02-20-2010, 07:01 PM -
Changing text format for "Custom Dialog Function"
By lefty2020 in forum FileMaker Pro 10Replies: 1Last Post: 11-12-2009, 01:01 AM -
Disbale FM 7 "Save Changes to this records" dialog box?
By HappyMan in forum FileMaker Pro 7.0Replies: 0Last Post: 09-28-2004, 10:35 AM -
No "File Open" dialog when recover is needed
By Doug Leib in forum ScriptMaker and ScriptingReplies: 0Last Post: 06-02-2003, 12:45 PM



Reply With Quote




Bookmarks