Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Applescript to write file to disk using IE...

Applescript to write file to disk using IE...
Thread Tools
Fresh-Faced Recruit
Join Date: Dec 2000
Location: Trabuco Canyon, CA, USA
Status: Offline
Reply With Quote
Feb 24, 2001, 10:35 AM
 
I think I am almost there, but cannot figure out the last part. The IE dictionary refers to the ability to access a specific url, then optionally write the file to disk. Here is a copy/paste from the IE dictionary:

GetURL: Open the URL (and optionally save it to disk)
GetURL string -- URL to open
[to 'fsswhich to save resource located at URL.

...I am a bit green when it comes to Applescript. I have the first part working great (GetURL "www.foo.com/whatever/image.gif") however, I do not understand the [to 'fss'] reference. Obviously, this is the reference to writing the file to disk, but I don't know how to express this. My objective is to get the file into a specific directory (start up disk:System Folder: Appearance: Desktop Pictures:image.gif)

Thanks in advance for everyone's help!

     
Junior Member
Join Date: Oct 1999
Location: Edmonton, Alberta, Canada
Status: Offline
Reply With Quote
Feb 24, 2001, 08:53 PM
 
> how to express this. My objective is to get the
> file into a specific directory

tell application "Internet Explorer 5"
GetURL "www.foo.com/whatever/image.gif" to file "start up disk:System Folder: Appearance: Desktop Pictures:image.gif"
end tell


you could also use URL access scripting if you are running (i believe) 8.6 or higher. to download or upload a file.

hope that helps

-- An idea is salvation by imagination.
-- Frank Lloyd Wright
-- 30 --
     
morps  (op)
Fresh-Faced Recruit
Join Date: Dec 2000
Location: Trabuco Canyon, CA, USA
Status: Offline
Reply With Quote
Feb 24, 2001, 09:35 PM
 
I have moved to URL Access Scripting... you're right. I have it working now, the only thing I haven't figured out is how to set the explicit path when I don't know what the name of the hard disk is. Any thoughts there? I'd imagine that there must be a way to simply "find" the Appearance folder, right?
     
morps  (op)
Fresh-Faced Recruit
Join Date: Dec 2000
Location: Trabuco Canyon, CA, USA
Status: Offline
Reply With Quote
Feb 24, 2001, 10:25 PM
 
Ahhhh, figured it out:

--code snip

set picture file of monitor 1 to alias ((path to desktop pictures folder as text) & the item_name)

--end code snip

Small accomplishment I know, but now I've got a groovy little script that goes to a url, downloads a file, then makes the background image of the monitor that file.

Now I need to learn how to iterate the selection of a file (001.jpg, 002.jpg, etc) in my initial query as well as how to set a timer to automatically check for a new file every "x" days/weeks whatever.

Any pointers are always appreciated.

     
Junior Member
Join Date: Mar 2000
Location: Salem, OR, USA
Status: Offline
Reply With Quote
Feb 27, 2001, 07:49 PM
 
Re: running at timed intervals.

Now that you have your script running there are two ways to get it to go off at a certain time. One way is to use iDO Script Scheduler. I think this is still distributed by Apple as part of the system install (or maybe just on the install disk as a separate install). If it isn't there look on the web. You install iDO and then pick the times and/or intervals you want scripts to run.

The other way is through an "on idle" handler. You just have to put "on idle" at the top of your script and "end idle" at the end. One line before the "end idle" you need a "return 60". Substitute the 60 for the number of seconds you want to pause between runnings. Every hour would be 3600. Do a save as of your script and make sure it is saved as an application and that "stay open" is checked.

To test it you have to click it from the finder. Script Editor won't run "on idle" scripts from the editor. Just launch your new application and it will perform its steps every X number of seconds.

Kind of long, but hope this helps.
-numero
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:00 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2