Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

travman1974

macrumors newbie
Original poster
Jul 9, 2009
18
0
Is there a way to repeat an apple script until it reaches the end of the file or document.

I am trying to use applescript with text wangler to manipulate an qfx file to work with my quicken. Basicly I need to have the <NAME> field be less than 32 characters or my quicken will error out. I have the following code wich works for what I need.

Code:
tell application "TextWrangler"
	activate
		find "<NAME>................................" searching in text 1 of text document 1 options {search mode:grep, starting at top:false, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
		copy selection
		find "$" searching in text 1 of text document 1 options {search mode:grep, starting at top:false, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:true} with selecting match
		delete selection
		paste
	save text document 1
end tell

the code works for what I need, but I can't figure out how to get it to repeat for the entire file. Each time I download a qfx file from my bank the size of the file will change. how can I get the repeat function to work until the end of the file or document.

Thanks
 
You don't need to write a script for this you can do it textwrangler with grep.

Just go to the find option and put in the following in the find box.

(?<=<name>................................).*?(?=$)

Then choose replace all.

That will find every line starting with <name> and strip off the end of the line after the 32nd character.

You can then save the find in textwrangler to repeat at your leisure.
 
Thanks soo much that worked perfectly. I knew there had to be a way to do it using grep.

You don't need to write a script for this you can do it textwrangler with grep.

Just go to the find option and put in the following in the find box.

(?<=<name>................................).*?(?=$)

Then choose replace all.

That will find every line starting with <name> and strip off the end of the line after the 32nd character.

You can then save the find in textwrangler to repeat at your leisure.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.