Re: Thanks (was: Keep lines)
Re: Thanks (was: Keep lines)
- Subject: Re: Thanks (was: Keep lines)
- From: kai <email@hidden>
- Date: Wed, 30 Jul 2003 23:17:02 +0100
on Tue, 29 Jul 2003 13:54:51 +0200, Paul Moortgat wrote:
>
I've an EXIF text file from which I need to keep some lines (like 1, 6,
>
7, 11, 17) Each time the same lines. How can this be done in
>
Applescript? How to start?
Hmmm... Not too sure about EXIF files - but can you read them using the
'read file' command from Standard Additions?
If so, then something like the routine below might work. My test file, which
was plain ol' text, contained 30 simple lines like this:
"this is line 01
this is line 02
...
this is line 29
this is line 30"
=======================
set f to "Path:to:file" -- amend as appropriate
set t to read file f
set l to {}
repeat with p in {1, 6, 7, 11, 17, 50}
try
set l's end to t's paragraph p
on error number -1728 -- the file doesn't go that far
exit repeat
end try
end repeat
set text item delimiters to return
set l to l as string
set text item delimiters to {""}
l
=======================
--> "this is line 01
--> this is line 06
--> this is line 07
--> this is line 11
--> this is line 17"
You could then write the resulting text to another file - or even back to
the same file. (Ask again if you're not sure how.)
-----------------------------------
on Wed, 30 Jul 2003 20:42:11 +0200, Paul Moortgat wrote:
>
Thanks everyone for the zero answers I got.
That's really not very gracious, Paul.
Many of these guys/gals work hard elsewhere to earn a living - and then come
here in what's left of their spare time to see if they can offer any help or
encouragement to others (completely for free, I might add). Sometimes they
might wait to see if someone else has more appropriate experience before
responding. Even if they know the answer to a question, they can't always
respond immediately because of other commitments. Quite a few are also in
digest mode - and don't get to see every message as it is posted.
So you may not always get a reply to a question. Even if you do, it may not
be particularly prompt or exactly what you were hoping for.
But before criticising others too hastily for not coming up with a solution
for you, perhaps you should try asking yourself these questions:
Have I made my purpose and problem clear enough?
Can I script *any* of this to demonstrate what I'm trying to do?
Have I tried hard enough to come up with even part of the answer?
Is sarcasm really the way to attract help from these people in the future?
---
kai
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.