• 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: Finder weirdness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finder weirdness


  • Subject: Re: Finder weirdness
  • From: KOENIG Yvan <email@hidden>
  • Date: Fri, 12 Nov 2010 09:36:21 +0100


Le 11 nov. 2010 à 18:55, Walter Bushell a écrit :


Finder throws an error from the command it gets, which command runs by itself.

That is when I run the command that appears in the results and events window which throws an error, it runs. ?????

I think Finder is weird, better to do as much work as possible in Eunuchs.


I try
set x to (POSIX file "/Users/Walter/Music/YourBrain 000.pdf")
--tell application "QuickTime Player" to open x
tell application "Finder"
log x
my dostuff(x)
end tell

on dostuff(x)
set y to name of (info for x)

tell application "Finder"
set the name of x to "y" & text -7 thru -5 of y & ".pdf"
set name of x to "x" & text -7 thru -5 of name of x & ".pdf"
end tell
end dostuff

(1) I really don't understand what you wan't to do.

If I understand your code, it try to set the filename to y000.pdf
then to set it to x000.pdf

(2) Here, this handler does the trick
on dostuff(the_pdf)
set the_pdf to the_pdf as alias
tell application "Finder"
set the name of the_pdf to "y" & text -7 thru -5 of (get name of the_pdf) & ".pdf"

delay .1

set name of the_pdf to "x" & text -7 thru -1 of (get name of the_pdf)
end tell
end dostuff

Without the delay, the second 'set name' instruction fails because the modified path of the file isn't already available.
For my own use I would reduce the handler to :

on dostuff(the_pdf)
set the_pdf to the_pdf as alias
tell application "Finder"
set name of the_pdf to "x" & text -7 thru -1 of (get name of the_pdf)
end tell
end dostuff

Yvan KOENIG (VALLAURIS, France) vendredi 12 novembre 2010 09:34:29
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Finder weirdness (From: Walter Bushell <email@hidden>)

  • Prev by Date: Re: Finder weirdness
  • Next by Date: Re: Finder weirdness
  • Previous by thread: Re: Finder weirdness
  • Next by thread: text returned to record
  • Index(es):
    • Date
    • Thread