Re: Checking if a folder exists and dealing with it
Re: Checking if a folder exists and dealing with it
- Subject: Re: Checking if a folder exists and dealing with it
- From: Chad Chelius <email@hidden>
- Date: Mon, 09 Dec 2002 10:26:25 -0500
First of all, thank you to Thomas and Mr. Tea for responding to my post.
You both gave me good insight on how to do what I wanted to. I tried your
script alone and it worked like a charm, when I added it to my script, it
broke. I am far from an expert on applescript (as you probably already
guessed) but AFAIKT I am passing the wrong information to the portion of the
script that makes the folder. I'm not sure if I'm giving it the proper type
of list that it needs. I have included a small part of my script and I have
commented out the part where the error is occuring.
To explain this part of the script, MyArchiveFolder is a list of jobs in the
format of 123456.job1, 129354.job2, etc. FoundTemplatesFolder is a list of
Template files in the format of 123456 Template1, 129354 Template2, etc.
Basically with this script I am creating a list of jobs that have templates
that have been found that match the job number. Then it is supposed to
create a Templates folder in the the job folder called "Templates" in which
to put the actual template file. I appreciate your help and patience.
Hopefully I explained this well enough.
tell application "Finder"
choose folder with prompt "Please choose the folder that contains the
jobs you want to archive"
set MyArchiveFolder to the result
set FoundTemplatesFolder to folder "Found Templates1" of desktop
get the name of every item of FoundTemplatesFolder
set FoundTemplates to the result
set ShortFoundTemplates to {}
repeat with profTem in FoundTemplates
if (count profTem) is greater than 5 then
copy text 1 through 6 of profTem to the end of
ShortFoundTemplates
end if
end repeat
set ShortFoundTemplateMatches to {}
repeat with temp in ShortFoundTemplates
set end of ShortFoundTemplateMatches to (folders in MyArchiveFolder
whose name begins with temp)
end repeat
get ShortFoundTemplateMatches
(*set tFolders to every folder of ShortFoundTemplateMatches
repeat with tFolder in tFolders
if (folder "Templates" of folder (tFolder as string) exists) is
false then
make new folder at tFolder with properties {name:"Templates"}
end if
end repeat*)
end tell
--
Chad Chelius
Systems Administrator
Offset Impressions, Inc.
email@hidden
610-236-4722
>
From: email@hidden
>
Reply-To: email@hidden
>
Date: Wed, 04 Dec 2002 22:00:32 -0800
>
To: email@hidden
>
Subject: applescript-users digest, Vol 3 #1120 - 13 msgs
>
>
Another solution without "try" block using the "exists" command :
>
>
set theFolders to every folder of ShortFoundTemplateMatches
>
repeat with aFolder in theFolders
>
if (folder "Templates" of folder (aFolder as string) exists)
>
is false then
>
make new folder at aFolder with properties {name:"Templates"}
>
end if
>
end repeat
>
>
Thomas
>
>
Mr Tea wrote :
>
>
> set theFolders to every folder of ShortFoundTemplateMatches
>
> repeat with aFolder in theFolders
>
> try
>
> make new folder at aFolder with properties {name:"Templates"}
>
> end try
>
> end repeat
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.