• 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: "try" broke???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "try" broke???


  • Subject: Re: "try" broke???
  • From: Robert Poland <email@hidden>
  • Date: Tue, 06 Nov 2012 16:01:43 -0700

Thanks John,

Of all the replies I got this is the only that sort of works.

As a test, it runs but adding an "on error" shows that the "try" did nothing. But at least it doesn't crash.

FYI,
The reason for the try block was so the script could run on any Finder window. I know I cannot delete a file from a CD.


On Nov 6, 2012, at 3:43 PM, John Day <email@hidden> wrote:

> I forgot the try block ( which was the point of the question)
>
> try
> 	tell application "Finder"
> 		activate -- used here and at end
> 		set winTarget to target of front window as alias
> 	end tell
> 	tell application "System Events" to delete (every file of winTarget whose name = ".DS_Store")
> end try
>
> On Nov 6, 2012, at 5:26 PM, Robert Poland wrote:
>
>> Hi,
>>
>> Running from Smile AND Applescript Editor, when pointed at a CD the following script errors out and won't run;
>>
>> tell application "Finder"
>> 	activate
>> 	tell window 1 -- clears out Finder idiosyncrasies
>> 		tell application "Finder" -- used here and at end
>> 			set winTarget to target of front window as alias
>> 		end tell
>> 		set fileList to list folder winTarget with invisibles
>> 		try
>> 			if fileList contains ".DS_Store" then
>> 				delete item ".DS_Store"
>> 			end if
>> 		end try
>> 	end tell
>> end tell
>>
>>
>> Robert Poland
>> 2.7 GHz Intel Core I5, 27” iMac
>>  12 GB Ram, 1TB HD
>>  OS X 10.8.2 (12C54)

Robert Poland - Fort Collins, CO




 _______________________________________________
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


  • Follow-Ups:
    • Re: "try" broke???
      • From: John <email@hidden>
References: 
 >Re: "try" broke??? (From: John Day <email@hidden>)

  • Prev by Date: Re: "try" broke???
  • Next by Date: Re: "try" broke???
  • Previous by thread: Re: "try" broke???
  • Next by thread: Re: "try" broke???
  • Index(es):
    • Date
    • Thread