Problems with AppleScript and IE 5.2
Problems with AppleScript and IE 5.2
- Subject: Problems with AppleScript and IE 5.2
- From: "John Witchel" <email@hidden>
- Date: Sun, 13 Jul 2003 09:07:54 -0700
Overview: We have developed a system used to automate the process of taking
screen captures of webpages loaded in IE 5.2 on a Mac. (www.browsercam.com)
The issue: IE 5.2 consistently but arbitrarily crashes or quits
unexpectedly. We need help isolating the cause of the crash and finding a
solution to reduce or eliminate these crashes.
Technical Detail:
We use a tiny java program that does the following:
1) Writes a file to disk called script_runner.html that contains some
javascript to load a new webpage (see below).
2) Opens Explorer by calling osascript /bcservice/scripts/ie52_start.as (see
below). IE's home page is set to script_runner.html, so the page opens, we
wait for a bit then take the picture and then call a second AppleScript
osascript /bcservice/scripts/ie52_stop.as to close the browser (see below).
The system has taken over 100,000 captures across Windows, Mac and linux
machines, it run flawlessly everywhere else, so we have a very high degree
of confidence in the Java program and the overall system. We also
multiple macs running and we get identical behavior so we are confident it
is not hardware or system related.
The truth is Explorer runs pretty consistently, we only get this issue once
every 25-100 captures, but when you're running hundreds of captures a day,
that ends up being a lot.
We believe the issue is with these AppleScripts listed below and Explorer
specifically. Does anyone have any thoughts here?
Are there known problems with AppleScript and IE? Is there a better way to
open and close IE? We can use a shell script if that is more stable then
AppleScript. Does anyone have practical experience on UNIX shells vs
AppleScript?
We are using:
OSX 10.2.3
Kernel Version Darwin 6.3
ApplieScript.framework 1.9.1
AppleScriptKit.framework 1.2.1
Internet Explorer 5.2.2
Thanks for any comments
--john
~~~~~~~~~~~~~~~~~~~~~~~~
CODE USED
~~~~~~~~~~~~~~~~~~~~~~~~
=============================================================
Script_runner.html template
=============================================================
<html>
<SCRIPT LANGUAGE="JavaScript">
window.resizeTo({{WIDTH}}, {{HEIGHT}}-26);
window.moveTo({{X}}, {{Y}});
window.location.href = "{{URL}}";
</SCRIPT>
</html>
NOTE: The {WIDTH}, {HEIGHT}, {X}, {Y}, and {URL} obviously get replaced by
actual values before being written to disk as script_runner.html
=============================================================
/bcservice/scripts/ie52_start.as Script
=============================================================
try
do shell script "cp -f /tmp/script_runner.html
/bcservice/script_runner.html"
on error
end try
tell application "Internet Explorer"
launch
run
activate
end tell
=============================================================
/bcservice/scripts/ie52_stop.as script
=============================================================
try
with timeout of 5 seconds
tell application "Internet Explorer"
quit saving no
end tell
end timeout
on error
end try
try
do shell script "/bcservice/scripts/stop.sh"
on error
end try
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.