Sunday, January 23, 2022

#1 2022-01-07 11:05:25 am

greenchees
Member
Registered: 2012-06-25
Posts: 5
Website

Activate Finder if a folder isn't empty

Hi!

I struggle with this:
I want Finder to activate when a folder contains one file ore more, but nothing happens :_(

==============================

set TheFolder to ("ThePath")


if (count of TheFolder) is 1 then
   
    tell application "Finder"
       
        activate
       
    end tell
   
end if

==============================

Offline

 

#2 2022-01-07 12:39:06 pm

estockly
Member
Registered: 2009-01-03
Posts: 7

Re: Activate Finder if a folder isn't empty

How is this script being activated?

If you want an appleScript to monitor a folder on your mac you should look into Folder Events.

Offline

 

#3 2022-01-07 01:23:20 pm

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

Re: Activate Finder if a folder isn't empty

If I understand you correctly.

Applescript:

set chooseFolder to choose folder

tell application "Finder" to set fileItems to items of folder chooseFolder
if (count fileItems) ≥ 1 then
   tell application "Finder" to activate
end if


if you are the expert, who will you call if its not your imagination.

Offline

 

#4 2022-01-07 03:57:55 pm

greenchees
Member
Registered: 2012-06-25
Posts: 5
Website

Re: Activate Finder if a folder isn't empty

Perfect!!! big_smile:D:D

Fredrik71 wrote:

If I understand you correctly.

Applescript:

set chooseFolder to choose folder

tell application "Finder" to set fileItems to items of folder chooseFolder
if (count fileItems) ≥ 1 then
   tell application "Finder" to activate
end if

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)