Highlighted

URL Download in user selected path

Enthusiast ,
Sep 24, 2020

Copy link to clipboard

Copied

HI All,

 

My request is, download the url into the user selected destination location.

 

As of now, I can find the solution for download the url from Chrome via default download location.

 

But I am struggled, to downloaded the file into the user destination path.

 

Below is my code, I tried so far, Please help on this.

set downloadURL to text returned of (display dialog "Enter URL" default answer "" buttons {"Download", "Cancel"} default button 1)

set the destination to (choose folder)

tell application "Google Chrome"
	activate
	open location downloadURL
	delay 1
	--do shell script "curl -L " & downloadURL & " -o " & POSIX path of the destination  --Help need here

end tell





Thanks
SS

Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

If you just need to download the file in the destination folder then there is no need to use the browser, just the curl command should do. Try the following

set downloadURL to text returned of (display dialog "Enter URL" default answer "" buttons {"Download", "Cancel"} default button 1)

set the destination to (choose folder)

do shell script "curl -L " & downloadURL & " -o " & POSIX path of the destination & "demo.jpg"

-Manan

TOPICS
Print, Scripting

Views

75

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

URL Download in user selected path

Enthusiast ,
Sep 24, 2020

Copy link to clipboard

Copied

HI All,

 

My request is, download the url into the user selected destination location.

 

As of now, I can find the solution for download the url from Chrome via default download location.

 

But I am struggled, to downloaded the file into the user destination path.

 

Below is my code, I tried so far, Please help on this.

set downloadURL to text returned of (display dialog "Enter URL" default answer "" buttons {"Download", "Cancel"} default button 1)

set the destination to (choose folder)

tell application "Google Chrome"
	activate
	open location downloadURL
	delay 1
	--do shell script "curl -L " & downloadURL & " -o " & POSIX path of the destination  --Help need here

end tell





Thanks
SS

Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

If you just need to download the file in the destination folder then there is no need to use the browser, just the curl command should do. Try the following

set downloadURL to text returned of (display dialog "Enter URL" default answer "" buttons {"Download", "Cancel"} default button 1)

set the destination to (choose folder)

do shell script "curl -L " & downloadURL & " -o " & POSIX path of the destination & "demo.jpg"

-Manan

TOPICS
Print, Scripting

Views

76

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 24, 2020 0
Enthusiast ,
Sep 18, 2020

Copy link to clipboard

Copied

HI All,

 

My request is, download the url into the user selected destination location.

 

As of now, I can find the solution for download the url from Chrome via default download location.

 

But I am struggled, to downloaded the file into the user destination path.

 

Below is my code, I tried so far, Please help on this.

 

 

set downloadURL to text returned of (display dialog "Enter URL" default answer "" buttons {"Download", "Cancel"} default button 1)

set the destination to (choose folder)

tell application "Google Chrome"
	activate
	open location downloadURL
	delay 1
	--do shell script "curl -L " & downloadURL & " -o " & POSIX path of the destination  --Help need here

end tell

 

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 18, 2020 0
Enthusiast ,
Sep 19, 2020

Copy link to clipboard

Copied

Hi All,

 

Any help or ideas for my above request?

 

Thanks

SS

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 19, 2020 0
Enthusiast ,
Sep 22, 2020

Copy link to clipboard

Copied

Hi All,

Any help or update or ideas for the above request.

 

Thanks 

SS

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 22, 2020 0
Adobe Community Professional ,
Sep 25, 2020

Copy link to clipboard

Copied

Hi There,

I have merged your previous post on the same subject with this one, opening a new thread with the same query would not help. I don't delve too much into Applescript but the following seems to be working for me

set downloadURL to text returned of (display dialog "Enter URL" default answer "" buttons {"Download", "Cancel"} default button 1)

set the destination to (choose folder)

tell application "Brave Browser"
	activate
	open location downloadURL
	delay 1
	do shell script "curl -L " & downloadURL & " -o " & POSIX path of the destination & "demo.jpg"
end tell

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
Enthusiast ,
Sep 25, 2020

Copy link to clipboard

Copied

Hi Mannan,

 

Thank you for your swift reply..

 

Your timely help is much appreciated!

 

Will test and let you know shortly.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 25, 2020 0
Enthusiast ,
Sep 29, 2020

Copy link to clipboard

Copied

HI Mannan/All,

 

Yes.. your provided code helps to download the URL file in the destination location.

 

In that, I found two difficulties.

1. File is downloaded in both "choosing destination" as well as "default download location"

2. When the file is downloaded in destination, the name of the zip file should vary. (In default Download location, the name is as expected)

Thanks for your great support!

 

Regards

SS

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 29, 2020 0
Adobe Community Professional ,
Sep 30, 2020

Copy link to clipboard

Copied

If you just need to download the file in the destination folder then there is no need to use the browser, just the curl command should do. Try the following

set downloadURL to text returned of (display dialog "Enter URL" default answer "" buttons {"Download", "Cancel"} default button 1)

set the destination to (choose folder)

do shell script "curl -L " & downloadURL & " -o " & POSIX path of the destination & "demo.jpg"

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 30, 2020 0