Welcome to MacBoardz.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Folder action script

 
Goto page Previous  1, 2
   Macintosh computer (Home) -> Apple Scripts RSS
Next:  File list from Spotlight  
Author Message
Jolly Roger

External


Since: Sep 09, 2006
Posts: 1943



(Msg. 16) Posted: Fri Jul 25, 2008 2:41 pm
Post subject: Re: Folder action script [Login to view extended thread Info.]
Archived from groups: alt>comp>lang>applescript (more info?)

In article
,
Jo_y wrote:

> d)the script begins to work

Show us the script please.

--
Send responses to the relevant news group rather than to me, as
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR

 >> Stay informed about: Folder action script 
Back to top
Login to vote
Gregory Weston1

External


Since: Oct 03, 2004
Posts: 2243



(Msg. 17) Posted: Fri Jul 25, 2008 3:34 pm
Post subject: Re: Folder action script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article
,
Jo_y wrote:

> Hey, guys
>
> i laughed nobody, i'll try to write a better and clearer text for my
> questions.Sorry, nobody is perfect.
> I've no desire to tell lies, because i'm here in the forums to learn
> too, how others. Hm.
> I understand, thats annoying to hear new definitions, but it's not
> simple to traslate everything, have patience; hopefully it's not the
> end of word.
> (related to scripts:little things can corrupt a entire script, i know)
>
> Back to our focus:
>
> a)i activate the folder actions
> b)i attach a folder action to a folder (Desktop)
> c)i add more files to desktop in 1 action(Sound, Video, Image, Text,
> Clipping, ect.)
> d)the script begins to work
> e)if i add a item where kind was being processed during the folder
> action, then this one rests on desktop.
> f)after processing all the kinds of files, the finder-windows
> continues to pops for-and backward (like activate finder-and like when
> you click on desktop, with 1 or more activ windows open; these effect
> turns all finder win grey but it does not change the application)
>
>
> My mac is a laptop, not a desk-computer. Perhaps are little
> differences between these.

My Macs are both. And no, there's no difference between them. Same OS.

The question both JR and I have, is this: what does that action in step
(b) *do*? We both suspect the window behavior you're seeing is a result
of the specific script you're running. It's certainly not the result of
any random folder action script I have here.

--
"Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
- Harry Potter and the Odor of the Phoenix

 >> Stay informed about: Folder action script 
Back to top
Login to vote
Jo_y

External


Since: Jun 22, 2008
Posts: 36



(Msg. 18) Posted: Sat Jul 26, 2008 2:56 am
Post subject: Re: Folder action script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> Show us the script please.

As i said, there is no difference between long or short folder action
scripts without the win-popup behavior in finder.
Belowe, a short example: (-and litte gift)


--Sort

on adding folder items to this_f after receiving added_items
tell application "Finder"
if (exists (document files in this_f whose name begins with "1"))
then
set name_is to "1"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "2"))
then
set name_is to "2"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "3"))
then
set name_is to "3"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "4"))
then
set name_is to "4"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "5"))
then
set name_is to "5"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "6"))
then
set name_is to "6"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "7"))
then
set name_is to "7"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "8"))
then
set name_is to "8"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "9"))
then
set name_is to "9"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "0"))
then
set name_is to "0"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "a"))
then
set name_is to "A"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "b"))
then
set name_is to "B"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "c"))
then
set name_is to "C"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "d"))
then
set name_is to "D"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "e"))
then
set name_is to "E"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "f"))
then
set name_is to "F"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "g"))
then
set name_is to "G"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "h"))
then
set name_is to "H"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "i"))
then
set name_is to "I"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "j"))
then
set name_is to "J"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "k"))
then
set name_is to "K"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "l"))
then
set name_is to "L"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "m"))
then
set name_is to "M"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "n"))
then
set name_is to "N"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "o"))
then
set name_is to "O"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "p"))
then
set name_is to "P"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "q"))
then
set name_is to "Q"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "r"))
then
set name_is to "R"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "s"))
then
set name_is to "S"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "t"))
then
set name_is to "T"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "u"))
then
set name_is to "U"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "v"))
then
set name_is to "V"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "w"))
then
set name_is to "W"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "x"))
then
set name_is to "X"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "y"))
then
set name_is to "Y"
my my_sorter(name_is, this_f)
end if
if (exists (document files in this_f whose name begins with "z"))
then
set name_is to "Z"
my my_sorter(name_is, this_f)
end if
end tell
end adding folder items to

on my_sorter(name_is, this_f)
tell application "Finder"
if not (exists (folders in this_f whose name is name_is)) then
make new folder at this_f with properties {name:name_is}
end if
set count_chars to count characters of name_is
if count_chars ≠ 3 then
set x to (document files in this_f whose name begins with name_is)
set y to (the name of folders in this_f whose name is name_is) as
string
move x to folder y of this_f
else
set ch_1 to character 1 of name_is
set ch_3 to character 3 of name_is
set x_1 to (document files in this_f whose name begins with ch_1)
set x_3 to (document files in this_f whose name begins with ch_3)
set destin_ to (the name of folders in this_f whose name is (ch_1 &
"," & ch_3)) as string
set Group_1 to {x_1, x_3} as list
move Group_1 to folder destin_ of this_f
end if
end tell
end my_sorter
 >> Stay informed about: Folder action script 
Back to top
Login to vote
John Stewart

External


Since: Jul 26, 2008
Posts: 1



(Msg. 19) Posted: Sat Jul 26, 2008 11:25 am
Post subject: Re: Folder action script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 2008-07-26 05:56:36 -0400, Jo_y said:

>
>> Show us the script please.
>
> As i said, there is no difference between long or short folder action
> scripts without the win-popup behavior in finder.
> Belowe, a short example: (-and litte gift)
>
>
> --Sort
>
> on adding folder items to this_f after receiving added_items
> tell application "Finder"
> if (exists (document files in this_f whose name begins with "1"))
> then
> set name_is to "1"
> my my_sorter(name_is, this_f)
> end if

<big snip>

> end tell
> end adding folder items to
>
> on my_sorter(name_is, this_f)
> tell application "Finder"
> if not (exists (folders in this_f whose name is name_is)) then
> make new folder at this_f with properties {name:name_is}
> end if
> set count_chars to count characters of name_is
> if count_chars ≠ 3 then
> set x to (document files in this_f whose name begins with name_is)
> set y to (the name of folders in this_f whose name is name_is) as
> string
> move x to folder y of this_f
> else
> set ch_1 to character 1 of name_is
> set ch_3 to character 3 of name_is
> set x_1 to (document files in this_f whose name begins with ch_1)
> set x_3 to (document files in this_f whose name begins with ch_3)
> set destin_ to (the name of folders in this_f whose name is (ch_1 &
> "," & ch_3)) as string
> set Group_1 to {x_1, x_3} as list
> move Group_1 to folder destin_ of this_f
> end if
> end tell
> end my_sorter

I'm not sure from your script why you are seeing the effect you are
unless it is being caused by the behavior Sander mentioned. However,
I've shortened the initial part of your script to something a bit
easier to read/maintain and let Applescript do the work. I've also
included some comments in the handler regarding its functionality along
with a couple of code changes.

on adding folder items to this_f after receiving added_items
set cList to characters of "1234567890abcdefghijklmnopqrstuvwxyz"
tell application "Finder"
repeat with aChar in cList
set tmpChar to contents of aChar
if (exists (document files in this_f whose name begins with tmpChar)) then
set tmpID to (id of tmpChar)
if tmpID ≥ 65 and tmpID ≤ 122 then set tmpChar to (character id
(tmpID - 32))
end if
my my_sorter(tmpChar, this_f)
end repeat
end tell
end adding folder items to

on my_sorter(name_is, this_f)
tell application "Finder"
if not (exists (folders in this_f whose name is name_is)) then
make new folder at this_f with properties {name:name_is}
end if
(* as written, the variable "name_is" always contains 1 character *)
set count_chars to count characters of name_is -- this will always
evaluate to 1
if count_chars ≠ 3 then -- so this will always be true
set x to (document files in this_f whose name begins with name_is)
set y to (some folder in this_f whose name is name_is) as alias
move x to y
else -- and this will never get executed
set ch_1 to character 1 of name_is
set ch_3 to character 3 of name_is
set x_1 to (document files in this_f whose name begins with ch_1)
set x_3 to (document files in this_f whose name begins with ch_3)
set destin_ to (the name of folders in this_f whose name is (ch_1 &
"," & ch_3)) as text
set Group_1 to {x_1, x_3} as list
move Group_1 to folder destin_ of this_f
end if
end tell
end my_sorter

This was done with MacOS X 10.5.4 and Applescript 2.0. since you are
using an older version you would need to replace "id of tmpChar" and
"character id" with "ASCII number" and "ASCII Character" as
appropriate. I no longer have a 10.3 system version available for
authoring or testing.

As I don't have your file/folder setup I was unable to fully test it.
 >> Stay informed about: Folder action script 
Back to top
Login to vote
Sander Tekelenburg

External


Since: Nov 07, 2003
Posts: 648



(Msg. 20) Posted: Sat Jul 26, 2008 3:56 pm
Post subject: Re: Folder action script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
Gregory Weston wrote:

> In article
> ,
> Jo_y wrote:

[... "contraction of windows"]

> > It was very annoying thing in Panther, every time when a folder (with
> > attached actions) gots items, now a bit improved in Tiger, causes a
> > contraction of finder windows, putting these in the backround. (like
> > during a Mouseclick on desk, every in Finder)
>
> That's not a standard behavior of folder actions, as far as I recall
> (although it's been a long time since I used 10.3). Look at the specific
> scripts you're using and I suspect you'll find that it's a side effect
> of some command in there.

on adding folder items to this_folder after receiving added_items
-- do nothing
end

The above removes focus from whatever the front app happens to be. I
guess that's what the OP means.

I reported this to Apple in May 2004. Apple still lists it as Open.

--
Sander Tekelenburg, <http://www.euronet.nl/~tekelenb/>

Mac user: "Macs only have 40 viruses, tops!"
PC user: "SEE! Not even the virus writers support Macs!"
 >> Stay informed about: Folder action script 
Back to top
Login to vote
Jo_y

External


Since: Jun 22, 2008
Posts: 36



(Msg. 21) Posted: Sun Jul 27, 2008 3:29 am
Post subject: Re: Folder action script [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hey Steward,
my scripts are not all so clumsy, but i've looked and played a while
too, to find or construct a similary code (related to the first
routine in the reviewed and renewed version of my Sorter-script).
For now i've not maked experience with ascii characters, because too
abstract for the normal use. But how sayed in other posts, i like to
have more options as the direct referrals, it's more creativ and easy
to write such scripts.

Thanks.
 >> Stay informed about: Folder action script 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Folder action script help please! - Hi, when I add an app to /Applications, I'd like an alias to that app to be automatically created in ~/Applications. I think the best way to do that is by attaching a folder action script to /Applications. Can anyone help? Thanks much! -- K.

folder action script loop problem - this post is not archived.

Posix path in a Folder Action Script - Why doesn't this work? It throws a "-1728" error... on adding folder items to thisFolder after receiving addedItems local folderPath --set folderPath to ((thisFolder as Unicode text) as text) set folderPath to POSIX path of (thisFolder as te...

Folder Action script to open .PS files in Preview (OS 10.3)? - I know this should be simple, but I'm a beginner, so please be patient: Thanks to Patrick Stadelmann's generous help to me and to others, I know how to write a folder action script that can print a file that gets dropped into a watched folder. But I've...

Folder action script to delete .ps files older than three .. - Hello, Another request from a more-or-less beginner: I'm trying to write a folder action script that will wait until a new file is added to the folder and then delete all files in the folder whose name extension is .ps and whose creation is more than..
   Macintosh computer (Home) -> Apple Scripts All times are: Pacific Time (US & Canada)
Goto page Previous  1, 2
Page 2 of 2

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]