• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

URL Download in user selected path

Enthusiast ,
Sep 24, 2020 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

TOPICS
Print , Scripting

Views

501

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
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 30, 2020 Sep 30, 2020

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

Votes

Translate

Translate
Enthusiast ,
Sep 18, 2020 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

 

 

 

Votes

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
community guidelines
Enthusiast ,
Sep 19, 2020 Sep 19, 2020

Copy link to clipboard

Copied

Hi All,

 

Any help or ideas for my above request?

 

Thanks

SS

Votes

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
community guidelines
Enthusiast ,
Sep 22, 2020 Sep 22, 2020

Copy link to clipboard

Copied

Hi All,

Any help or update or ideas for the above request.

 

Thanks 

SS

Votes

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
community guidelines
Community Expert ,
Sep 25, 2020 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

Votes

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
community guidelines
Enthusiast ,
Sep 25, 2020 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.

Votes

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
community guidelines
Enthusiast ,
Sep 29, 2020 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

Votes

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
community guidelines
Community Expert ,
Sep 30, 2020 Sep 30, 2020

Copy link to clipboard

Copied

LATEST

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

Votes

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
community guidelines