Re: Just returning Filename... not whole path
Re: Just returning Filename... not whole path
- Subject: Re: Just returning Filename... not whole path
- From: Yvan KOENIG <email@hidden>
- Date: Fri, 21 Oct 2005 07:00:37 +0200
Le 21 oct. 2005 , à 6:11, Brett Conlon/HU/AU/SonyDADC a écrit :
OK, almost there now...
In the prompt dialogue where it asks for the title name of the DVD, if
I have dropped more than one file it gets confusing as to which file
it's asking the title of so I'd like to add the filename in the
dialogue.
The below snipets of my script highlight the bits I'm working on but
at the moment the dialogue is showing the entire path of the file
being worked on... not just the filename. How do I change it to just
return the filename?
Here's the code:
on open filelist
with timeout of (5 * minutes) seconds
if GetResources() is true then
CreateNewFolder()
GetResources()
repeat with aFile in filelist
set replacement_title to
AskTitle(aFile)
set replacement_catNo to AskCatNo()
DoAllThis(aFile)
ReplaceTitle(replacement_title)
ReplaceCatNo(replacement_catNo)
end repeat
end if
end timeout
InClosing()
end open
…
Your assistance is MOST appreciated!
Hello
to test the handler, I stripped a part of the code.
testing:
property a_file : "Macintosh
HD:Users:yvankoenig:Desktop:URL_dans-message.rtf"
set replacement_title to AskTitle(a_file as alias)
--ASK TITLE
on AskTitle(aFile)
tell me to activate
repeat
tell application "Finder"
set fileName to name of aFile
set d to display dialog "Please enter the Title name (less than 13
chrs) for the file " & aFile & ":" default answer ""
set answer to text returned of d
if the answer contains ":" then
beep
display dialog "A file or folder name cannot contain a colon (:).
Please try again..." buttons {"OK"} default button 1
else if the answer contains "/" then
beep
display dialog "A file or folder name cannot contain a forward
slash (/). Please try again..." buttons {"OK"} default button 1
else
-- it would be fine to check the name's length here
return answer
exit repeat
end if
end tell
end repeat
end AskTitle
I met no problem.
The handler correctly returned a fileName.
Here is the history reported.
tell current application
activate
end tell
tell application "Finder"
get name of alias "Macintosh
HD:Users:yvankoenig:Desktop:URL_dans-message.rtf"
"URL_dans-message.rtf"
display dialog "Please enter the Title name (less than 13 chrs) for
the file Macintosh HD:Users:yvankoenig:Desktop:URL_dans-message.rtf:"
default answer ""
{text returned:"URLdansMessages.rtf", button returned:"OK"}
end tell
the returned result was:
"URLdansMessages.rtf"
As you may see, the only oddity I met is that the handler fail to check
the name's length.
This written, I assume that something may be wrong with what you pass
to the handler but I can't check that.
Yvan KOENIG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden