Re: AS how to check if a file name matches a string in a text file
Re: AS how to check if a file name matches a string in a text file
- Subject: Re: AS how to check if a file name matches a string in a text file
- From: Jim Weisbin <email@hidden>
- Date: Mon, 30 Jun 2014 15:12:45 -0400
Shane Stanley wrote:
> Not really. You can just loop through:
>
> set theFilePath to (path to desktop as text) & "Sans titre.rtf"
>
> tell application "TextEdit"
> open file theFilePath
> set theText to text of document 1
> end tell
> set theText to paragraphs of theText
>
> set foundNames to {}
> repeat with anEntry in theText
> set theoffset to offset of space in anEntry
> set anEntry to text (theoffset + 1) thru -1 of anEntry
> if listOfFileNames contains anEntry then
> set end of foundNames to anEntry
> end if
> end repeat
> return theText
>
> foundNames
I did it a bit differently but I got it working. The client will have to clean up their data a bit, there are too many inconsistencies.
Thanks to all for your help.
Jim Weisbin | C.T.O. | human | 138 Fifth Avenue | 3rd Floor | New York, NY | 10011 | (212) 352-0211 | (917) 375-2272 | Los Angeles Office | 2046 Broadway | Santa Monica, CA | 90404 | (310) 264-0211 telephone | www.humanworldwide.com
_______________________________________________
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