Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Ibjr

macrumors 6502a
Original poster
Jun 29, 2002
513
21
Eastern seaboard
I know this is going to sound simple, but if you question my motives check the story at the bottom.

I am trying to get an apple script to ask for input of a URL and then download to desktop whatever is at the URL. I have spent the last hour finding out automator has a way to download URLs but i can't find a way to pass the input to that.

Story:I hate to do this but i am at wits end. I am a recent returner (and apple script is a lot more complicated than it was in os7 days) and some of our school's classes are online video (Univ of Florida Biz School) through a service that will only let you use IE. Every mac user i know is having trouble. I have found a way to download the videos (why doesn't mac IE have save target as?), and am looking for a quick script i can send out to people so they only need the URL and bam they have their econ lectures.
 

Ibjr

macrumors 6502a
Original poster
Jun 29, 2002
513
21
Eastern seaboard
Counterfit said:
Perhaps Automator is better suited to this?

Yes. the problem is i can't find a way to pass a user inputed URL into the download URL thing. That is why i was looking at apple script.
 

WildCowboy

Administrator/Editor
Staff member
Jan 20, 2005
18,397
2,833
How about something like this:

Code:
set TheURL to text returned of (display dialog "Enter a file address" default answer "")
set AppleScript's text item delimiters to "/"
set Filename to last text item of TheURL
set AppleScript's text item delimiters to ""

tell application "URL Access Scripting"
	download TheURL to file Filename
	
end tell
 

Ibjr

macrumors 6502a
Original poster
Jun 29, 2002
513
21
Eastern seaboard
WildCowboy said:
How about something like this:

Code:
set TheURL to text returned of (display dialog "Enter a file address" default answer "")
set AppleScript's text item delimiters to "/"
set Filename to last text item of TheURL
set AppleScript's text item delimiters to ""

tell application "URL Access Scripting"
	download TheURL to file Filename
	
end tell

Stupid question, but would this be standalone or proceeding automator's download url? B/c it says, as standalone, error "URL scripting access got an error. bad name for file. some object"

Well when i tried it within automator same error.

Thanks for trying to help.
 

WildCowboy

Administrator/Editor
Staff member
Jan 20, 2005
18,397
2,833
Hmm...I'm no AppleScript expert, so troubleshooting isn't my thing. It's a standalone script that works just fine for me...help, anyone?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.