Droplet Problem
Droplet Problem
- Subject: Droplet Problem
- From: Mike Evans <email@hidden>
- Date: Tue, 17 Sep 2002 11:21:55 -0400
All,
I am having a strange problem to which I am sure there is some simple
answer that I am overlooking. I am trying to set up a batch process to move
files from one directory to another. I am logging the transaction so I need
to verify the existance of a parent folder in another directory. The problem
is this. If my droplet script (appended below) does not find the parent
directory, it errors on a variable already produced (theSources). This is
obviously a misleading error but I am still not sure what the real error is.
If I hardwire the directory in (as opposed to using the droplet, script also
appended) the error subsides and the script works. Any ideas?
And sorry about the partial post.
----------------------------------------------------
Script 1
Droplet - does not work of Inbox directory not found...
on open theFolders
tell application "Finder"
repeat with eachFolder in theFolders
set theFiles to the name of every file of folder eachFolder
set theDir to the name of folder eachFolder
set theSources to every folder of every folder of folder theDir
of folder "Inbox" of disk "AdProduction"
set sourceFolderNames to the name of every folder of every
folder of folder theDir of folder "Inbox" of disk "AdProduction"
repeat with eachFile in theFiles
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"00.EPS"}
set ampsNo to (text item 1 of eachFile as string)
set AppleScript's text item delimiters to oldDelim
if ampsNo is in sourceFolderNames then
set sourceIndex to (my getIndex(ampsNo,
sourceFolderNames))
my dd(theSources)
else
my dd("The parent folder for ad " & ampsNo & " was not
found!")
end if
end repeat
end repeat
end tell
end open
on dd(message)
tell application "Finder"
activate
display dialog (message as string) buttons {"Ok"} with icon caution
default button "Ok"
end tell
end dd
on getIndex(theItem, theList)
repeat with i from 1 to the count of theList
if item i of theList is theItem then return i
end repeat
return 0
end getIndex
----------------------------------------------------
Script 2
Hardwired directory, works, no errors
----------------------------------------------------
tell application "Finder"
set theFolders to folder "610" of folder "Repository" of disk
"AdProduction"
set theFiles to the name of every file of theFolders
set theDir to the name of theFolders
set theSources to every folder of every folder of folder theDir of
folder "Inbox" of disk "AdProduction"
set sourceFolderNames to the name of every folder of every folder of
folder theDir of folder "Inbox" of disk "AdProduction"
repeat with eachFile in theFiles
set oldDelim to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"00.EPS"}
set ampsNo to (text item 1 of eachFile as string)
set AppleScript's text item delimiters to oldDelim
if ampsNo is in sourceFolderNames then
set sourceIndex to (my getIndex(ampsNo, sourceFolderNames))
my dd(item sourceIndex of theSources)
else
my dd("The parent folder for ad " & ampsNo & " was not found!")
end if
end repeat
end tell
on dd(message)
tell application "Finder"
activate
display dialog (message as string) buttons {"Ok"} with icon caution
default button "Ok"
end tell
end dd
on getIndex(theItem, theList)
repeat with i from 1 to the count of theList
if item i of theList is theItem then return i
end repeat
return 0
end getIndex
----------------------------------------------------
--
Mike Evans
IT Manager/Systems Administrator
Cyclone Integrated
7110 Pacific Circle
Mississauga, Ontario
L5T 2A6
Canada
T: 905.670.5212
F: 905.670.4979
E: email@hidden
_______________________________________________
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.