How can I enlarge Script Debugger’s Text Substitution preference pane, so that I can see more of the substitution text in the right hand column? Presently, I can view the expanded right handed text by typing the abbreviated text in the left hand column. I would like a less tedious method to expand each shortcut, to assess whether it contains the expansion I am looking for.
There’s no way to enlarge it currently. However, you should see the whole contents if you hover over an entry.
- Export the Text Replacements.
- Open the XML file in BBEdit.
- Run the appended Perl Filter.
- Then you can do lookups as you like with your editor of choice.
#!/usr/bin/env perl -0777 -nsw
# ------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2023/04/18 19:08
# dMod: 2023/04/18 19:08
# Task: Clean up Script Debugger Text Replacement XML File.
# Tags: @ccstone, @Shell, @Script, @Clean, @Script_Debugger, @Text_Replacement, @XML, @File
# ------------------------------------------------------
use v5.12;
my @array = m!(<string>.+?</string>)!gims;
my $cntr = 0;
foreach my $item (@array) {
$cntr++;
if ( $cntr % 2 == 0 ) {
say $item . "\n";
} else {
say $item;
}
}
# ------------------------------------------------------
You can also read the files directly in AppleScript:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
set theFile to (choose file)
set theData to current application's NSData's dataWithContentsOfURL:theFile
set theDetails to (current application's NSPropertyListSerialization's propertyListWithData:theData options:0 format:(missing value) |error|:(missing value)) as list
Open the result in its own window, and use pretty print.
2 Likes
Nice. I should have thought of that…
--------------------------------------------------------
# Auth: Christopher Stone { Heavy Lifting by Shane Stanley }
# dCre: 2023/04/19 13:41
# dMod: 2023/04/19 13:41
# Appl: Script Debugger 8
# Task: Read Script Debugger 8's Text Substitutions File and Reformat for Easier Viewing.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @ASObjC, @Read, @Text_Substitutions, @File, @Reformat, @Viewing
--------------------------------------------------------
# Title : SD Text Substitution preference pane enlargement - AppleScript - Late Night Software Ltd.
# Post : #4 by @ShaneStanley
# Date : This user is a moderator
# URL : https://forum.latenightsw.com/t/sd-text-substitution-preference-pane-enlargement/4325/4
--------------------------------------------------------
(*
You can also read the files directly in AppleScript:
*)
--------------------------------------------------------
use AppleScript version "2.4" --» Yosemite or later
use framework "Foundation"
use scripting additions
--------------------------------------------------------
property LF : linefeed
--------------------------------------------------------
set sdTextSubstitutionsFile to "~/Library/Application Support/Script Debugger 8/Text Substitutions.plist"
set sdTextSubstitutionsFile to ((current application's NSString's stringWithString:sdTextSubstitutionsFile)'s stringByExpandingTildeInPath) as text
# read sdTextSubstitutionsFile as «class utf8» -- test...
set theData to current application's NSData's dataWithContentsOfFile:sdTextSubstitutionsFile
set theDetailsList to (current application's NSPropertyListSerialization's propertyListWithData:theData options:0 |format|:(missing value) |error|:(missing value)) as list
set theOutput to {}
repeat with theItem in theDetailsList
set end of theOutput to {replace, |with|} of theItem
set end of theOutput to LF & "················································································" & LF
end repeat
set AppleScript's text item delimiters to linefeed
set theOutput to theOutput as text
--------------------------------------------------------