|
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| Hi, I've been using this script since 2003. Now since Tex-Edit Plus is no longer supported with Lion, I'm trying to switch to another text editor. This script errors in TextWrangler, Pages, TextEdit and Smile. None of them seem to like "replace replacing with item x..." won't even compile. I tried "Text Window 1" in TextWrangler. Suggestions appreciated. --script on run main() end run on main() set DateString to current date set DateString to date string of DateString set AppleScript's text item delimiters to "," set DateString to DateString's text items 2 thru 3 as text set AppleScript's text item delimiters to "" set index1Flag to false tell application "Tex-Edit Plus" if not (window 1 exists) then beep return else tell window 1 if (name of window 1) contains "index1.html" then set index1Flag to true -- Initialize lists if not index1Flag then set searchList to {"pictures/", "thumbs/", "JPG"} set replaceList to {"/photo/pictures/", "/photo/thumbs/", "jpg"} else set searchList to {"pictures/", "thumbs/", "]PG"} set replaceList to {"/photo/pictures1/", "/photo/thumbs1/", "jpg"} end if tell window 1 repeat with x from 1 to the number of items in replaceList replace replacing with item x in replaceList looking for item x in searchList with cases matching and whole words matching end repeat -- html replacement string replace looking for "<body>" replacing with "<body><center><h1 class=title>" & DateString & "</h1></center>" replace looking for "<h1 class=title></h1>" replacing with "" replace looking for "<td width=\"576\" colspan=\"3\" />" replacing with "<td width=\"576\" colspan=\"3\">" replace looking for "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd" replacing with "http://www.w3.org/TR/html4/loose.dtd" end tell end tell ignoring application responses do shell script "say -v Alex " & "The replacing has ben completed. You should save the new file now." -- say "The replacing has ben compleeted. You should save the new file now." end ignoring display dialog "Ok to save?" buttons {"OK", "No"} default button 1 if text of button returned of result = "No" then return else tell application "Tex-Edit Plus" to activate select window 1 tell application "Tex-Edit Plus" to close window 1 saving yes end if end if end tell return end main TIA,
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
| Home | Archives | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2011 Apple Inc. All rights reserved.