Recently, I wrote:

>> FWIW, I've found you have to do a lot more jumping through hoops than what
>> is available in the sample stack due to quirky behavior of
>> Internet Explorer
>> and possibly DDE in general.  The problem is IE doesn't always make itself
>> known to the appsopen external on certain systems, so in my case, I had to
>> use a combination of the launch command and DDE to make sure URLs got
>> launched appropriately in this browser.
>> 
>> Also, this may be a Windows thing or MetaCard thing, but rapid successive
>> attempts to launch a URL can fail, making the launch process useless and
>> requiring a restart of the browser and/or MC (I can't recall which).  If
>> there is any chance of a user repeatedly clicking on a launch control, you
>> would be wise to prevent these multiple launch requests using a
>> timer and/or
>> busy cursor.  In my experience a delay of 2 to 3 seconds appeared to work
>> consistently under testing on Win95, 98 and 2000 systems.


Then, Monte Goulding wrote:

> Would it be possible for you to post the script to the list.


The following script is what I wound up using.  One thing that developers
may forget is that not only do users have a default browser but they have a
"currently running browser" which may or may not be the default.  It would
be silly to launch IE if Netscape was currently active, and vice versa, so
the script tries to take this possibility into account and launches
appropriately.  As mentioned above, this requires Tuviah's excellent
externals collection.

In our case, we knew that users would primarily use IE or Netscape, and
since Netscape appears to behave better than IE, I tested for Netscape first
and defaulted to IE if Netscape wasn't the default browser or running.

The global variable gLaunchBusy must be tested by any control making a call
to the browser launch handler; if the global is true then the call to the
handler should be canceled to prevent multiple DDE requests and possible
browser launch failures.

(Note: queryRegistry line is wrapped)


# BROWSER LAUNCH HANDLER
launchBrowser tURL
  launchDelayTimer
  put word 1 to -2 of queryRegistry("hkey_local_machine\software\
    classes\http\shell\open\command\") into defBrowser
  # CHECK IF BROWSER IS ALREADY OPEN AND LAUNCH URL
  if "Netscape" is in ext_appsopen() then
    ext_ddeexecute "NSShell","WWW_OpenURL",tURL
    exit to metacard
  end if
  if "Internet Explorer" is in ext_appsopen() then
    ext_ddeexecute "IExplore","WWW_OpenURL",tURL
    exit to metacard
  end if
  # LAUNCH BROWSER WINDOW
  launch tURL with defBrowser
  if "already open" is in the result then
    if "IExplore" is in defBrowser then \
       ext_ddeexecute "IExplore","WWW_OpenURL",tURL
    else ext_ddeexecute "NSShell","WWW_OpenURL",tURL
  end if
end launchBrowser


on launchDelayTimer
  global gLaunchBusy
  set lockCursor to true
  set cursor to watch
  put true into gLaunchBusy
  send "resetDelayTimer" to me in 2 seconds
end launchDelayTimer


on resetDelayTimer
  global gLaunchBusy
  put false into gLaunchBusy
  set lockCursor to false
  # THIS GOOFY WORKAROUND FORCES AN UPDATE OF THE CURSOR
  # WHICH DOESN'T AUTOMATICALLY OCCUR ON SOME SYSTEMS
  get the screenMouseLoc
  set the screenMouseLoc to item 1 of it + 1,item 2 of it + 1
end resetDelayTimer


Hope this is useful.

Regards,

Scott

_____________________________________________________________________
Scott Rossi                       Tactile Media - Multimedia & Design
Creative Director                 Email: [EMAIL PROTECTED]
                                  Web: www.tactilemedia.com


Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to