Thursday, June 4, 2020

#1 2020-03-28 05:28:39 pm

CarNorm
Member
Registered: 2018-02-06
Posts: 2

Finder move folder not working anymore

I have this script which ask the user to select a folder in the Downloads folder and move the selected one to another location. This script use to work under Mojave and stop under Catalina 10.15.3

Here's the source

set inFolder to path to "down"
tell application "Finder"
    set outFolder to "Macintosh HD:Users:INorm:Documents"
    set folderNAME to choose folder default location inFolder
    move folderNAME to outFolder with replacing
end tell

what's changed in Catalina to make it stop ?

the result is: error "Finder error : The handler AppleEvent failed." number -10000

Thank you

Offline

 

#2 2020-03-28 06:59:06 pm

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 485

Re: Finder move folder not working anymore

CarNorm. I tested the script on my computer under Catalina with Script Editor, and it worked fine. You may want to try the following version but I suspect you'll get the same result.

Applescript:

set outFolder to "Macintosh HD:Users:INorm:Documents:" as alias
set folderNAME to choose folder

tell application "Finder"
   move folderNAME to outFolder with replacing
end tell

Under Catalina you may have to grant the script authorization to access the Downloads folder, depending on how the script is run. Try running the script in Script Editor and see what happens.

Also, take a look in:

System Preferences > Security & Privacy > Privacy > Files & Folders

On my computer, Script Editor has "Full Disk Access" and AppleScript apps that access the Downloads folder have this enabled.

Last edited by peavine (2020-03-28 07:19:24 pm)


2018 Mac mini - macOS Catalina

Offline

 

#3 2020-03-29 02:40:51 am

Nigel Garvey
Moderator
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 5205

Re: Finder move folder not working anymore

One important way in which peavine's script differs from the original is that the destination is a specifier (in this case an alias), not just a piece of text. Assuming that the Downloads and Documents folders belong to the same user on the same machine, the code might be written as below — but I've only been able to try it in Mojave:

Applescript:

set inFolder to (path to downloads folder)
set outFolder to (path to documents folder)

tell application "Finder"
   activate
   set folderNAME to (choose folder with prompt "Select a folder to move to your Documents folder …" default location inFolder)
   move folderNAME to outFolder with replacing
end tell


NG

Offline

 

#4 2020-03-29 08:32:58 am

CarNorm
Member
Registered: 2018-02-06
Posts: 2

Re: Finder move folder not working anymore

The solution of Nigel Garvey work as expect.

Is there an explanation why it does not work in Catalina the way I wrote my script ?

Even without explanation, thank for your solution. I can move on now.

Offline

 

#5 2020-03-29 11:59:13 am

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

Re: Finder move folder not working anymore

CarNorm wrote:

The solution of Nigel Garvey work as expect.

Is there an explanation why it does not work in Catalina the way I wrote my script ?
Even without explanation, thank for your solution. I can move on now.


I don't know, what happens with Catalina 10.15.3, but on the Catalina 10.15.4 your original script works as expected. Although it has clumsy syntax, the new Catalina completely coped with it. Look how smart is it! sad

Last edited by KniazidisR (2020-03-29 12:01:27 pm)


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

Offline

 

#6 2020-03-29 12:22:07 pm

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 485

Re: Finder move folder not working anymore

KniazidisR wrote:

I don't know, what happens with Catalina 10.15.3, but on the Catalina 10.15.4 your original script works as expected. Although it has clumsy syntax, the new Catalina completely coped with it. Look how smart is it! sad



I'm also on Catalina 10.15.4 and all three scripts in this thread work for me. It's just a guess, but I wonder if the OP's outFolder path is correct, which is one explanation as to why Nigel's script would work but the others wouldn't.

BTW I was surprised that the following works but it does:

Applescript:

set inFolder to path to "down" --> alias "Macintosh HD:Users:Robert:Downloads:"


2018 Mac mini - macOS Catalina

Offline

 

#7 2020-03-29 12:39:06 pm

Fredrik71
Member
Registered: 2019-10-23
Posts: 270

Re: Finder move folder not working anymore

The text in OP post he say downloads folder...

So the correct syntax is the way Nigel did it...

path to downloads folder



If the OP script did work in Catalina 10.15.4, and 'down' is same as 'download' I think its a bug.

hahaha, that said, I try on my Mojave path to "down" and it gave me the path to downloads.

1. AppleScript Language Guide didn't say anything about this. --- checked.

2. AppleScript Finder Guide didn't say anything about this. -- checked.

So I guess its maybe alias that is not documented.

This works to...

path to "desk"

Last edited by Fredrik71 (2020-03-29 01:01:12 pm)


I  have skied the highest mountain without logic, and still its the imagination that take me anywhere. Its the desire of something that matters for any knowledge I have or could learn.

Offline

 

#8 2020-03-29 01:00:08 pm

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

Re: Finder move folder not working anymore

Fredrik71 wrote:

The text in OP post he say downloads folder...

So the correct syntax is the way Nigel did it...

path to downloads folder



If the OP script did work in Catalina 10.15.4, and 'down' is same as 'download' I think its a bug.

hahaha, that said, I try on my Mojave path to "down" and it gave me the path to downloads.

1. AppleScript Language Guide didn't say anything about this. --- checked.

2. AppleScript Finder Guide didn't say anything about this. -- checked.

So I guess its maybe alias that is not documented.



I don't think so. Anyone can't get Scripting Additions documentation newest than last years. I know 1 thing from old documentations: path to command does some attempts to find the correct location when the user breaks the syntax. For example, the following command shows the location of the currently edited script:

Applescript:


path to

Last edited by KniazidisR (2020-03-29 01:02:32 pm)


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

Offline

 

#9 2020-03-29 01:03:11 pm

Nigel Garvey
Moderator
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 5205

Re: Finder move folder not working anymore

peavine wrote:

BTW I was surprised that the following works but it does:

Applescript:

set inFolder to path to "down" --> alias "Macintosh HD:Users:Robert:Downloads:"


There are text alternatives for most of the path to folders and for a few more which don't have keywords. But I think they're mostly obsolete now. They all have four letters and are seen as four-byte tokens rather than as text. You can use «class down» instead and it'll still work. However, the token for the Downloads folder nowadays is «constant afdrdown», which compiles as downloads folder, so this is to be preferred!


NG

Offline

 

#10 2020-03-29 01:06:13 pm

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

Re: Finder move folder not working anymore

Nigel Garvey wrote:
peavine wrote:

BTW I was surprised that the following works but it does:

Applescript:

set inFolder to path to "down" --> alias "Macintosh HD:Users:Robert:Downloads:"


There are text alternatives for most of the path to folders and for a few more which don't have keywords. But I think they're mostly obsolete now. They all have four letters and are seen as four-byte tokens rather than as text. You can use «class down» instead and it'll still work. However, the token for the Downloads folder nowadays is «constant afdrdown», which compiles as downloads folder, so this is to be preferred!



OK, what you can say for this:

Applescript:


set myEditedScript to path to


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

Offline

 

#11 2020-03-29 01:11:24 pm

Fredrik71
Member
Registered: 2019-10-23
Posts: 270

Re: Finder move folder not working anymore

The first run will give you the last path, the second run will give you path to the script...


I  have skied the highest mountain without logic, and still its the imagination that take me anywhere. Its the desire of something that matters for any knowledge I have or could learn.

Offline

 

#12 2020-03-29 01:17:44 pm

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

Re: Finder move folder not working anymore

It's not a bug.
It's an official 'short name' for the download folder.

Look at : "Xcode.app:Contents:Developer:Platforms:MacOSX.platform:Developer:SDKs:MacOSX.sdk:System:Library:Frameworks:CoreServices.framework:Versions:A:Frameworks:CarbonCore.framework:Versions:A:Headers:Folders.h"

Here is just a small part of this file:

Applescript:

kAudioVSTFolderType = 'avst', /* Refers to the VST subfolder of the Audio Plug-ins folder*/
kColorPickersFolderType = 'cpkr', /* Refers to the ColorPickers folder*/
kCompositionsFolderType = 'cmps', /* Refers to the Compositions folder*/
kFontCollectionsFolderType = 'fncl', /* Refers to the FontCollections folder*/
kiMovieFolderType = 'imov', /* Refers to the iMovie folder*/
kiMoviePlugInsFolderType = 'impi', /* Refers to the Plug-ins subfolder of the iMovie Folder*/
kiMovieSoundEffectsFolderType = 'imse', /* Refers to the Sound Effects subfolder of the iMovie Folder*/
kDownloadsFolderType = 'down' /* Refers to the ~/Downloads folder*/
};

enum {
kColorSyncProfilesFolderType = 'prof', /* for ColorSync™ Profiles */
kApplicationSupportFolderType = 'asup', /* third-party items and folders */
kTextEncodingsFolderType = 0xC4746578/*'ƒtex'*/, /* encoding tables */
kPrinterDescriptionFolderType = 'ppdf', /* new folder at root of System folder for printer descs. */
kPrinterDriverFolderType = 0xC4707264/*'ƒprd'*/, /* new folder at root of System folder for printer drivers */
kScriptingAdditionsFolderType = 0xC4736372/*'ƒscr'*/ /* at root of system folder */
};

you may test with

Applescript:

path to "flow"
path to "simp"
path to "empz"
path to "prof"
path to "asup"
path to "avst"
path to "cpkr"
path to "fncl"

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) dimanche 29 mars 2020  21:17:07

Last edited by Yvan Koenig (2020-03-29 01:20:53 pm)

Offline

 

#13 2020-03-29 01:26:55 pm

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

Re: Finder move folder not working anymore

Yes, it works, and should work in the future. The bug will if they will not work:

Applescript:


path to "desk" -- desktop
path to "cusr" -- home
path to "docs" -- documents
path to "mdoc" -- movies
path to "pdoc" -- pictures
path to "µdoc" -- music
-- and so on...

and this:

Applescript:

path to

is path to current file. It is equivalent to path to me.

Applescript:


path to "pref" -- preferences folder
path to "scrƒ" -- scripts folder

Last edited by KniazidisR (2020-03-29 01:39:14 pm)


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

Offline

 

#14 2020-03-29 01:37:09 pm

Fredrik71
Member
Registered: 2019-10-23
Posts: 270

Re: Finder move folder not working anymore

short name... for what... lazy people who type to slow...

I like long names that tell me what the code does... that is more meaningful but also for others.


I  have skied the highest mountain without logic, and still its the imagination that take me anywhere. Its the desire of something that matters for any knowledge I have or could learn.

Offline

 

#15 2020-03-29 01:53:23 pm

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

Re: Finder move folder not working anymore

Fredrik71 wrote:

short name... for what... lazy people who type to slow...


Yes, yes, for the lazy. lol

However, for a programmer, this is a great opportunity to provide a compact list of folders in which you need to find something. Without searching the rest.


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

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)