• 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
SatImage Regular Expression OSAX error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SatImage Regular Expression OSAX error


  • Subject: SatImage Regular Expression OSAX error
  • From: email@hidden
  • Date: Thu, 15 Oct 2009 11:00:06 +0100

Hi All

I'm hoping that someone on this mailing list has some experience of using the Satimage Regular _expression_ OSAX

I've been trying to write an Applescript using this OSAX which looks for erroneous characters within file names eg. commas, brackets, slashes etc. using regular expressions. The problem I have with it is that when the "find text" command does not find any of the character searched for it returns an error. Here's a snippet of code

property rejectFolder : ":afolder:somewhere" as alias

tell application "Finder"
       
        if filetype = "JPEG" or filetype = "TIFF" then
               
               
                --Check and rename the name of the file
               
                set origfile to ((container of origfile as string) & name of origfile) as alias
                set currentfileName to name of (origfile)
               
                set nameWithOutExt to characters 1 thru -5 of currentfileName
                set extension to (characters -4 thru -1) of currentfileName
                set extension to extension as text
               
               
               
                -- The Regular _expression_ Part
                set theTextFound to (find text "[^[:alnum:]||[[.-_ ]]]" in nameWithOutExt with regexp)
               
                (* This returns the following error message if no matches found
       
                "Finder got an error: No result was returned from some part of this _expression_."
               
                *)
               
                if matchPos of theTextFound > 0 then
                       
                        move origfile to rejectFolder
                       
                end if
               
        end if
       
end tell

I have a couple of questions
1. Is this the correct behaviour for the OSAX
2. if so, is the only way to handle said error to capture it in a try-on error block
3. Has anyone got a better way of doing this


Keith Bamford
Wales is just a click away - http://www.walesOnline.co.uk - news, sport, culture and entertainment

********************
IMPORTANT NOTICE This email (including any attachments) is meant only for the intended recipient. It may also contain confidential and privileged information. If you are not the intended recipient, any reliance on, use, disclosure, distribution or copying of this email or attachments is strictly prohibited. Please notify the sender immediately by email if you have received this message by mistake and delete the email and all attachments.

Any views or opinions in this email are solely those of the author and do not necessarily represent those of Trinity Mirror PLC or its associated group companies (hereinafter referred to as "TM Group"). TM Group accept no liability for the content of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Although every reasonable effort is made to keep its network free from viruses, TM Group accept no liability for any virus transmitted by this email or any attachments and the recipient should use up-to-date virus checking software. Email to or from this address may be subject to interception or monitoring for operational reasons or for lawful business practices.

Trinity Mirror PLC is the parent company of the Trinity Mirror group of companies and is registered in England No 82548, with its address at One Canada Square, Canary Wharf, London E14 5AP.
********************
 _______________________________________________
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: SatImage Regular Expression OSAX error
      • From: Emmanuel LEVY <email@hidden>
    • Re: SatImage Regular Expression OSAX error
      • From: Christopher Stone <email@hidden>
  • Prev by Date: Customizing Address Book list format
  • Next by Date: Re: So where did «class bmrk» come from?
  • Previous by thread: Customizing Address Book list format
  • Next by thread: Re: SatImage Regular Expression OSAX error
  • Index(es):
    • Date
    • Thread