• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Just returning Filename... not whole path
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Just returning Filename... not whole path


  • Subject: Re: Just returning Filename... not whole path
  • From: Yvan KOENIG <email@hidden>
  • Date: Mon, 24 Oct 2005 08:10:55 +0200


Le 24 oct. 2005 , à 2:15, Brett Conlon/HU/AU/SonyDADC a écrit :


Any takers?  <8-}

The code so far (or the bits you need to see):

on open (filelist)
        if GetResources() is true then
                CreateNewFolder()
                GetResources()
                repeat with aFile in filelist
                        with timeout of (5 * minutes) seconds
                                set replacement_title to AskTitle(aFile)
                                set replacement_catNo to AskCatNo()
                                DoAllThis(aFile)
                                ReplaceTitle(replacement_title)
                                ReplaceCatNo(replacement_catNo)
                        end timeout
                end repeat
        end if
        InClosing()
end open



--ASK TITLE
on AskTitle(aFile)
        tell application "Finder" to activate
        repeat
                set d to display dialog "Please enter the Title name (less than 13 chrs) for the file " & (name of 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
                        return answer
                        exit repeat
                end if
        end repeat
end AskTitle


THE ERROR:

Can't get name of alias "...PATH TO FILE.PDF"

Coj


Hello

It seems that I already responded (even adding that your code failed to check that the entered name was really less than 13 chars long.

	De: 	  email@hidden
	Objet: 	Rép : Just returning Filename... not whole path
	Date: 	21 octobre 2005  7:00:37 GMT+02:00
	À: 	  email@hidden

Here is your late version with some corrections in the AskTitle handler.

Your
tell application "Finder" to activate
instruction contains an "implicit " end tell so the Finder is unable to deal with the
set d to display dialog "Please enter the Title name (less than 13 chrs) for the file " & (name of aFile) & ":" default answer ""
instruction.


As I don't know which is the nature of the variable aFile in your open(filelist) handler I assume that it is an alias.

property a_File : "Macintosh HD:Users:yvankoenig:Desktop:Image 4.pdf"


set aFile to a_File as alias set replacement_title to AskTitle(aFile)


on open (filelist) if GetResources() is true then CreateNewFolder() GetResources() repeat with aFile in filelist with timeout of (5 * minutes) seconds set replacement_title to AskTitle(aFile) set replacement_catNo to AskCatNo() DoAllThis(aFile) ReplaceTitle(replacement_title) ReplaceCatNo(replacement_catNo) end timeout end repeat end if InClosing() end open


--ASK TITLE
on AskTitle(aFile)
-- tell application "Finder" to activate
tell application "Finder"
activate
repeat
set d to display dialog "Please enter the Title name (less than 13 chrs) for the file " & (name of 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
return answer
exit repeat
end if
end repeat
end tell
end AskTitle



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


References: 
 >Re: Just returning Filename... not whole path (From: Brett Conlon/HU/AU/SonyDADC <email@hidden>)

  • Prev by Date: Re: Just returning Filename... not whole path
  • Next by Date: Do Shell Script
  • Previous by thread: Re: Just returning Filename... not whole path
  • Next by thread: Re: Just returning Filename... not whole path
  • Index(es):
    • Date
    • Thread