Scripting additions & Filemaker.
Scripting additions & Filemaker.
- Subject: Scripting additions & Filemaker.
- From: Jono Bushell <email@hidden>
- Date: Mon, 27 Nov 2000 19:35:00 +1200
I'm new to applescript but am slowly getting the hang of things.
We've had a system developed using Filemaker to create personalised
satationery in Quark via applescript.
I've been writing a script to reformat text often received with " " - , etc
where they shouldn't be.
All was going well & I came across the scripting addition Satimage. It's
been very useful for setting the required format & at reducing the length of
the script but there's something that filemaker doesn't like in the
following script. I've narrowed it down to some new code written today that
uses the replace syntax pre this I was doing a find & replace. I'm sure of
this as I've used the same script with the find & replace & it works OK.
I've got the Scripting addition on the server hosting Filemaker Server but
it still doesn't work.
Any ideas would be welcome?
New bit
if theSpace contains "-" then
replace "-" by "" in theSpace
copy the result to theSpace
end if
if theSpace contains " " then
replace " " by "" in theSpace
copy the result to theSpace
end if
try
if theSpace > 0 then
format theSpace into "+##-#-###,####"
copy the result to theSpace
replace "," by " " in theSpace
copy the result to theSpace
end if
This is what I had originally which works ok in filemaker.
repeat
copy (offset of "-" in theSpace) to atPos
if atPos > 0 then
copy (text 1 thru (atPos - 1) of theSpace) & (text (atPos + 1)
thru (length of theSpace) of theSpace) to theSpace
else
exit repeat
end if
end repeat
repeat
copy (offset of " " in theSpace) to atPos
if atPos > 0 then
copy (text 1 thru (atPos - 1) of theSpace) & (text (atPos + 1)
thru (length of theSpace) of theSpace) to theSpace
else
exit repeat
end if
end repeat
if theSpace > 0 then
format theSpace into "+##-#-###,####"
copy result to theSpace
end if
copy (offset of "," in theSpace) to atPos
if atPos > 0 then
copy (text 1 thru (atPos - 1) of theSpace) & " " & (text (atPos
+ 1) thru (length of theSpace) of theSpace) to theSpace
end if
--
Jono Bushell
Systems Integration Manager
Communication Arts