Re: Scripting Script Debugger
Re: Scripting Script Debugger
- Subject: Re: Scripting Script Debugger
- From: Gnarlodious <email@hidden>
- Date: Thu, 21 Jul 2005 21:02:34 -0600
Entity Shane Stanley uttered this profundity:
> AFAIK, there's no scriptable search command. You need to get the contents of
> document 1, change it using your S&R tools of choice (text item delimiters,
> grep, whatever), then set the contents of document 1 to the result.
For example, here's a script I use to change all underscored variable_names
to variableNames:
set oldDelims to AppleScript's text item delimiters
tell application "Script Debugger"
set cursorPos to position of the selection
set textWithVariables to the text of the front window
set AppleScript's text item delimiters to "_"
set textAsList to every text item of textWithVariables
set AppleScript's text item delimiters to ""
repeat with x from 2 to the count of textAsList
set thisSegment to item x of textAsList
set thisSegment to every text item of thisSegment as list
set firstChar to ASCII number of item 1 of thisSegment
if firstChar > 96 and firstChar < 123 then
set firstChar to ASCII character (firstChar - 32)
set item 1 of thisSegment to firstChar
set thisSegment to thisSegment as string
set item x of textAsList to thisSegment
end if
end repeat
set the front window to (every item of textAsList as string)
select insertion point cursorPos of the front window
end tell
set AppleScript's text item delimiters to oldDelims
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden