MACSCRPT Archives

August 2010

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Jon Pugh <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 20 Aug 2010 07:45:00 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (85 lines)
At 8:29 AM +0100 8/20/10, John Delacour wrote:
>I posted this message to the Smile list a few days ago but it hasn't appeared.  Perhaps someone here knows what's happening...
>
>
>
>
>Back in 2006 I wrote this script for Eudora users
>
>       <http://bd8.com/eudora/scripts/#searcheudorasettings>
>
>that allows you to search for settings matching a regular expression, and the script continues to work for many users, but users of later versions of Mac OS X have been complaining it doesn't work any more.
>
>Since I have no access to anything later than 10.4.11 I have been reluctant to fix the problem and involve myself in long Q&A sessions with users who don't understand AppleScript.  However one persistant user finally persuaded me to send him a couple of tests and I discover that AppleScript is eating, annihilating, the entire contents of a handler that is meant to return the full list of Eudora settings.  The man in question has opened the script in Script Editor (10.5.8) and something called AppleScript Editor (10.7.*) and on editing and saving the file size shrinks from 199,180 bytes to 9,729 as a result of the emptying of the handler.

Opening the script here in 10.6.4 with Script Debugger, I see:

(*
 Toolbar button script to search for "geek strings"
 *)
using terms from application "Eudora"
	set _fu to "/tmp/xes.txt"
	set _f to _fu as POSIX file
	set _xes to getSettings()
	set ls to paragraphs of _xes
	set AppleScript's text item delimiters to {return}
	set _xes to ls as string
	set AppleScript's text item delimiters to {""}
	open for access _f with write permission
	set eof _f to 0
	write _xes to _f
	close access _f
	set _prompt to "[Settings for v. 6.2]

* You may use Perl regular expressions *

Type a dot to get the whole list

Search for descriptions of Eudora settings containing ..."
	try
		set _dd to display dialog _prompt default answer "" with icon 1001
	on error number n
		if n is -128 then return
	end try
	set _pattern to _dd's text returned
	if _pattern is "" then set _pattern to "."
	set AppleScript's text item delimiters to "\\"
	set ls to text items of _pattern
	set AppleScript's text item delimiters to "\\\\"
	set _pattern to "" & _pattern
	set AppleScript's text item delimiters to ""
	set _fout to "/tmp/hits.txt"
	do shell script "perl -e '$searchstring = qq~" & _pattern & "~;
$fout = qq~" & _fout & "~ ;
$f = q~" & _fu & "~ ;
$error = qq~$/Can\\047t find file $f$/$/~ ;
sysopen F, $f, O_RDONLY ;
sysread F, $_, 1000 ;
$/ = /(\\015\\012|\\015|\\012)/ ? $1: qq~\\n~;
open F, $f or die $error;
open FOUT, qq~>$fout~ ;
$s = 0 ;
print FOUT qq~$/<http://www.bd8.com/eudora/scripts/>$/$/~ ;
print FOUT qq~$/\\xa5\\xa5\\xa5 Key COMMAND-D to delete \\xa5\\xa5\\xa5$/$/~ ;
print FOUT qq~Command-click on any setting to view or change its value.$/$/~ ;
print FOUT qq~_________________________________________________________$/$/~ ;
for (<F>) {
	/$searchstring/i and print FOUT qq~$_$/~ ;
}'"
	set _results to read POSIX file _fout
	if _results is "" then return
	set _message to make message at end of mailbox 2
	set field "subject" of _message to "Settings matching ³" & _pattern & "²"
	set body of message "" to _results
end using terms from

on getSettings()
	
end getSettings

It certainly appears that getSettings() is empty from the get-go.

I don't have any older systems to test on.

Jon

ATOM RSS1 RSS2