The goal of my script is as follows:
- curl URL copied to the clipboard
- isolate a URL for the file download & isolate a NAME for the downloaded file
- specify PATH for downloaded file to be placed on HD
Here it is, so far;
---GET HTML SOURCE CODE FROM URL ON THE CLIPBOARD, RETURN grep'D SECTION--- set curl_url to (do shell script "curl " & (the clipboard) & " | grep '170x170-75.jpg'") as text ---DEFINE PREFIX AND SUFIX OF DESIRED TEXT--- set name_delim1 to "alt=\"" set name_delim2 to "\" class=" ---CLEAN BETWEEN DELIMS--- set text item delimiters to name_delim1 set interim_text1 to text item 2 of curl_url set text item delimiters to name_delim2 set file_name to text item 1 of interim_text1 & ".jpg" set text item delimiters to "" ---DEFINE PREFIX AND SUFIX OF DESIRED URL--- set image_delim1 to "\" class=\"artwork\" src=\"" set image_delim2 to ".170x170-75.jpg\" /></div></a>" ---CLEAN BETWEEN DELIMS--- set text item delimiters to image_delim1 set interim_text2 to text item 2 of curl_url set text item delimiters to image_delim2 set image_url to text item 1 of interim_text2 & ".jpg" set text item delimiters to "" ---DOWNLOAD--- set download_path to (POSIX path of (path to pictures folder)) & file_name do shell script "curl " & image_url & " -o " & download_path
If file_name is “TV Show: The Episode, Season 1” the file is downloaded as “TV”
How would I specify “$HOME:Pictures:Artwork:TV” as the directory instead of path to pictures folder
This is my first post, so please be gentle. My script has been sourced from info found on other posts, and in no way signifies my “understanding” (if any) of Applescript. I am very determined and patient, please bear with me.
Thanks to everyone!