Hi,
I found a script on this page
http://d.hatena.ne.jp/kamiseto/
The author uses this line :
bt.body = toInDesign.toSource()+"("+contents.toSource()+","+gb.toSource()+","+kumi.toSource()+");";
I tried to use this syntax and my script didn't produce any result.
I found another approach based on an old Harbs's post. The syntax is like :
theScript = "...";
theScript += "...";
bt.body = theScript;
And it runs well.
However, as I don't like to saty ignorant, what is the reason of the toSource() error ?
Thanks in advance for explanation.
Loic
Hi Jongware,
I needed the help of the engineers of my office to understand what was a single static buffer :-) but accordingly to their explanation, your guess is relevant.
The only doubt that stays deals with the nature of the buffer error (dynamic/static or buffer overflow).
As the web page was japanese, maybe the poster was explaining it did'nt get any result with this toSource() method after all !. Nevertheless, I get my script working with the string approach and that's what is important to me. But as I said I didn't want to stay ignorant and you gave me a good input.
Thanks Jongware !
Loic
I tried to write a sample to show this kind of error in pure javascript, using something like
var buf;
alert ("What happens now? "+fn("a", buf)+fn("b", buf));
newstr = "And now?"+fn("c", buf);
newstr += fn("d", buf);
alert (newstr);
function fn (str, dest)
{
dest = "["+str+"]";
return dest;
}
-- but I couldn't get it not to work ...
I recognized the symptoms because I also write in the programming language C/C++, and there it's perfectly possible to mess up a program with such constructions. Done that a dozen times and more. I think the correct approach of writing such routines is called "thread-safe" (since the same problem occurs in a multi-threading environment, where each function needs a buffer for itself, even if that same function is called twice).
Oh, enough with the side tracking.
North America
Europe, Middle East and Africa
Asia Pacific