Re: IE5 with JavaScript by AppleScript seems to be tricky
Re: IE5 with JavaScript by AppleScript seems to be tricky
- Subject: Re: IE5 with JavaScript by AppleScript seems to be tricky
- From: Arthur J Knapp <email@hidden>
- Date: Fri, 05 Oct 2001 16:58:33 -0400
>
Date: Fri, 05 Oct 2001 19:04:40 +0200
>
Subject: Re: IE5 with JavaScript by AppleScript seems to be tricky
>
From: JJ <email@hidden>
>
> Does this mean, you cannot send an window.open-Event to Explorer the same way
>
> with AS or is it a IE bug? Why does it works once, not twice?
>
> set JavaScriptCode to "
>
> {
>
> var mypage = 'http://www.macgix.com';
>
> var myname = 'macgix';
>
> var w = '800';
>
> var h = '600';
>
> var scroll = 'yes';
>
> var winl = (screen.width - w * 1.15);
>
> var wint = (screen.height - h * 1.25) / 30;
>
> winprops =
>
> 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+'';
>
> window.open(mypage, myname, winprops);
>
> if (parseInt(navigator.appVersion) >= 4)
>
> {
>
> win.window.focus();
Hey, some of those variable names look familiar... ;-)
If some of this code is mine, you will probably find a lot of IE
bug-work-around code that can be confusing, (my JavaScript comments
are even worse than my AppleScript comments).
Try this:
tell application "Internet Explorer"
set jsCode to "
var mypage = '
http://www.macgix.com';
var myname = 'macgix';
var w = '800';
var h = '600';
var scroll = 'yes';
var winl = (screen.width - w * 1.15);
var wint = (screen.height - h * 1.25) / 30;
var winprops =
'height=' + h +
',width=' + w +
',top=' + wint + /* IE */
',left=' + winl + //
',screenY=' + wint + /* NN */
',screenX=' + winl + //
',scrollbars=' + scroll;
var win = window.open(mypage, myname, winprops);
win.focus();
// IE bug-fix for the window.focus() method:
//
if ( window.clientInformation ) /* goofy IE4+ client-sniff */
{ // intentionally set a global, (can't be helped):
gIEBugWin = win;
setTimeout('gIEBugWin.focus()', 250); // 1/4 second delay
}"
-- add your error traping stuff, of course...
--
do script jsCode
end tell
Mr. A : Are they going to come out with a backwards-compatible version
of AppleScript Studio?
Ms. B : Yes, it will be called, "ASS-Backwards". ;-)
P.S. I love this list... :)
Arthur J. Knapp
http://www.stellarvisions.com
mailto:email@hidden
Hey, check out:
http://www.zavatone.com/