Director Web : Tips n' Scripts : Platform Specific Issues

Open command for Windows Projectors

Date:    Thu, 31 Aug 1995 09:58:41 +0000
From:    The Creative Syndicate <csi@EDGE.NET>
Subject: Re: Open command on PC under projector

>I cant seem to get the "open with" command to work from a projector on the
>PC.  It works fine running in director, but even an "Empty" projector, with
>nothing except
>
>  on startMovie
>    open "myfile.PDA" with "acroread.exe"
>  end startMovie
>
>in a movie script, the command doesnt work.  "open" doesnt work in a
>projector either, but works fine under director.
I've had a similar problem. In my case, it was a lack of memory to perform the operation. Director did not give me feedback when it couldn't open a file. I got around this by using the DLLGlue xobject. It seems to need less memory to perform actions and it returns error-specific codes.

Here is the code I use:

on CallProgram WhichFile
  if not(ObjectP(factory("DLLGlue"))) then
    openxlib "DLLGlue" -- if xobject not available, program halts automatically
  end if

  -- Send windows call...
  set Starter to DLLGlue(mNew,"KRNL386.EXE","WinExec","W","SW")
  if not (objectP(Starter)) then -- If object not formed, trip off error later
    set CallResult to 1
  else
    set CallResult to Starter(mCall,WhichFile,2)
    Starter(mDispose) -- Tidy, tidy, tidy...
  end if

  -- Error trapping
  if CallResult < 33 then -- If not valid result
    if CallResult = 0 or CallResult = 8 then -- Not enough memory?
      alert  "Installer does not have enough memory. Please close other applications and restart the installer." & return & return & "Installation incomplete."
      halt
    else -- Blame it on someone else.
      alert "KRNL386.EXE will not accept installer WinExec call." & return & return & "Error code:" && CallResult
      halt
    end if
  end if

  return CallResult
end CallProgram
It is like fishing with dynamite. Gets the job done very well but has the potential of being very messy.

Deke Smith
The Creative Syndicate, Inc.
111 Westwood Place
Brentwood, TN 37027

615-371-0887
csi@edge.net