Monday, September 28, 2020

#1 2019-06-14 08:48:16 am

Lilyah
Member
Registered: 2019-03-27
Posts: 4

Change default download folder in Safari

Hi Guys,
I am trying to change default download folder in Safari using defaults command,but it not takes effect when i running it via shell script.

Could you please help me - i need it by any way.
I stuck for choosing the folder using UI elements in apple script also.

Many thanks,
Lilya

Offline

 

#2 2019-06-15 09:39:37 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4569

Re: Change default download folder in Safari

Hello KniazidisR

I'm puzzled.
There is no folder com.apple.Safari in the folder Containers of my Home folder.

Applescript:

set path2plist to (path to home folder as text) & "Library:Containers:"
tell application "Finder"
   exists folder path2plist
   log result
end tell

set path2plist to path2plist & "com.apple.Safari:"

tell application "Finder"
   exists folder path2plist
   log result
end tell

The events log is :

Applescript:

tell current application
   path to home folder as text
       --> "SSD 500:Users:**********:"
end tell
tell application "Finder"
   exists folder "SSD 500:Users:**********:Library:Containers:"
       --> true
   (*true*)
   exists folder "SSD 500:Users:**********:Library:Containers:com.apple.Safari:"
       --> false
   (*false*)
end tell

The only folder with this name is :
"SSD 500:Users:**********:Library:WebKit:com.apple.Safari:"

In the Containers folder, the unique folder related to Safari is :
"SSD 500:Users:**********:Library:Containers:com.apple.Safari.CacheDeleteExtension:"

The default Downloads folder is defined in the entry : DownloadsPath
in the file :
"SSD 500:Users:**********:Library:Preferences:com.apple.Safari.plist"

In the same file, the entry NSNavLastRootDirectory points to the Desktop.

Auxiliary comment, in the UI code there is no need for:

Applescript:

set downloadsFolder to POSIX path of (path to desktop folder)
-- copy the download folder path to the clipboard
set the clipboard to downloadsFolder as text

because downloadsFolder, like every POSIX path IS a string

Applescript:

set downloadsFolder to POSIX path of (path to desktop folder)
-- copy the download folder path to the clipboard
set the clipboard to downloadsFolder

is sufficient.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 15 juin 2019  17:39:07

Last edited by Yvan Koenig (2019-06-15 09:45:49 am)

Offline

 

#3 2019-06-15 02:14:14 pm

KniazidisR
Member
Registered: 2019-03-03
Posts: 1305

Re: Change default download folder in Safari

Yvan Koenig wrote:

Hello KniazidisR

I'm puzzled.
There is no folder com.apple.Safari in the folder Containers of my Home folder.



Maybe damaged. Try reset Safari to defaults.

NOTE: In fact, this plist file is useless, because even after changing the value of the keys, Safari does not read them, and when exiting, it replaces what is changed by the user. The UI scripting example above is working fine.

It is OK only for retrieving information for all current Safari settings

Last edited by KniazidisR (2019-06-15 02:28:58 pm)


Model: MacBook Pro
OS X: Catalina 10.15.4
Web Browser: Safari 13.1
Ram: 4 GB

Offline

 

#4 2019-06-15 02:35:56 pm

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4569

Re: Change default download folder in Safari

No, it's not damaged.
I have exactly the same items on three different volumes used separately with different versions of the System.

Maybe these items appeared with Mojave which I can't install.


Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 15 juin 2019  22:34:17

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)