rlinsurf Posted October 17, 2009 Posted October 17, 2009 Hi-- I have the following AS I'm trying to use in a script to download audio mp3's from my jott account. Here's what I have so far, under Send Event: "set the target_URL to " & jotts::listenURL & "¶set the destination_file to " & ""'Macintosh HD/Users/jeffrey/Downloads/'"" & jotts::Title & "mp3"" & "¶tell application " & ""URL Access Scripting"" & "¶download target_URL to file destination_file replacing no" & "¶end tell" I then specify the Application as Apple Script Utility. But when I run this nothing happens. I then tried to run the same thing in AS itself, using real url's instead of the fields, and I get an error saying "Bad name of file". Does anyone know what I'm doing wrong here?
rlinsurf Posted October 17, 2009 Author Posted October 17, 2009 I found that when using AS, you have to use :'s instead of /'s. I also added a calc field to add ID number of the file and ".mp3", for the filename, in the field specification to make the whole thing easier to read. So I've now fixed the script to read: "set the target_URL to " & jotts::listenURL & "¶set the destination_file to " & ""Macintosh HD:Users:jeffrey:Downloads:jotts: & "" & jotts::addmp3 & "¶tell application " & ""URL Access Scripting"" & "¶download target_URL to file destination_file replacing no" & "¶end tell" This results in the following: set the target_URL to http://jott.com/JottAudio.ashx?id=somebunchofnumbers set the destination_file to "Macintosh HD:Users:jeffrey:Downloads:jotts: & "somebunchofnumbers.mp3" tell application "URL Access Scripting" download target_URL to file destination_file replacing no end tell This still just opens AS Utility and does nothing.
rlinsurf Posted October 17, 2009 Author Posted October 17, 2009 Ok. Got a little farther still. So I decided to just run this as Perform AppleScript step. So I pasted the same thing in as a calculated script: "set the target_URL to " & jotts::listenURL & "¶set the destination_file to " & ""Macintosh HD:Users:jeffrey:Downloads:jotts: & "" & jotts::addmp3 & "¶tell application " & ""URL Access Scripting"" & "¶download target_URL to file destination_file replacing no" & "¶end tell" So now I'm getting this: A ":" can't go after this indentifier. This occurs in the first use of a field: jotts::listenURL So now I'm really confused. There is a way to use a field in a script, yes?
Newbies AutomatingData Posted October 21, 2009 Newbies Posted October 21, 2009 Are you using FileMaker Pro Advanced? If so, what does the AppleScript calculation look like in the Data Viewer? Does it look like the AppleScript in your original post?
rlinsurf Posted October 21, 2009 Author Posted October 21, 2009 Ah, no it doesn't. I should have posted my solution. The answer was to have the path be expressed with ":", which is what AS likes. Hence, my finished as looks like this, and works perfectly: "set the target_URL to "" & jotts::listenURL & ""¶set the destination_file to " & ""Macintosh HD:Users:jeffrey:Downloads:jotts:mp3s:" & jotts::addmp3 & "¶tell application " & ""URL Access Scripting"" & "¶download target_URL to file destination_file replacing no" & "¶end tell" Where jotts::listenURL == "http://jott.com/JottAudio.ashx?id=" & jotts::ID and jotts::addmp3 == jotts::IDShort & ".mp3"" The final result looks like this: set the target_URL to "http://jott.com/JottAudio.ashx?id=somebunchofnumbers" set the destination_file to "Macintosh HD:Users:jeffrey:Downloads:jotts:mp3s:somebunchofnumbers.mp3" tell application "URL Access Scripting" download target_URL to file destination_file replacing no end tell
Recommended Posts
This topic is 5510 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