[comp.sys.mac.hypercard] Request Help with Progression Script Problem

fordj@yvax.byu.edu (03/28/91)

I have a problem with one of my scripts using HyperCard 2.0 on a
Mac SE with System software 6.0.5.  The problem script creates a
text file report by collecting information from several cards in a
stack and writes this information to an open text file as the
script moves from card to card.

The script was working fine until I attempted to incorporate
Stephen Fleming's "Progression" scripts which display and update a
"fill bar" on the screen to show the progress of a lengthy
process.  Now I get a "No open file by that name" (I forget the
exact wording) error when the script tries to write to the
previously-opened text file after the "progress" script is called.
The problem occurs somewhere in the following scripts (after
"progress" is called):

-----

on showframe
  global framerect
  set cursor to watch
  put 237 into xframedim
  put  24 into yframedim
  get the rect of this cd
  put item 3 of it into xcarddim
  put item 4 of it into ycarddim
  put trunc((xcarddim/2)-(xframedim/2)) into item 1 of framerect
  put trunc((ycarddim/2)-(yframedim/2)) into item 2 of framerect
  picture "ProgressFrame",resource,rect,false
  set cursor to watch
  put xframedim+item 1 of framerect+1 into item 3 of framerect
  put yframedim+item 2 of framerect+1 into item 4 of framerect
  put item 1 of framerect &","& item 2 of framerect &","&B
  item 3 of framerect &","& item 4 of framerect into
framerectstring
  set cursor to watch
  set rect of window "ProgressFrame" to framerectstring
  showboth
  picture "ProgressBar",resource,rect,false
end showframe

on progress param
  global framerect
  if the windows contains "ProgressFrame" then
    if the visible of window "ProgressFrame" is false then
      showboth
    end if
  else
    showframe
  end if
  if param < 0 then put 0 into param
  if param > 1 then put 1 into param
  put item 3 of framerect - item 1 of framerect into xtotal
  put trunc(xtotal * param) into xval
  set cursor to busy
  put item 1 of framerect &","& item 2 of framerect  &","B
  & item 1 of framerect + xval + 1 &","& item 4 of framerectB
  into progval
  set the rect of window "ProgressBar" to progval
  show window "ProgressBar"
end progress

on showboth
  lock screen
  if bg fld Banner is empty
  then put "Doing important stuff . . ." into bg fld Banner
  show bg fld Backdrop
  show bg fld Banner
  unlock screen with visual iris open very fast
  show window "ProgressFrame"
end showboth

-----

There does not seem to be any reason for these scripts to close
text files, so this is probably not something that Stephen Fleming
could have avoided.  (Thanks, by the way, for this script,
Stephen.)  My guess is either a bug in the show/close windows
commands (less likely) or a problem with the picture XCMD (more
likely).

Does anyone have more information on this (or a suggested
alternate solution)?  Any help would be most appreciated.

Thanks,

John M. Ford             BYU Instructional Psychology Program
740 South 50 East        (801) 378-7796
Orem, UT 84058           fordj@yvax.byu.edu

fordj@yvax.byu.edu (03/30/91)

An update on my efforts to solve this problem.

I have localized the problem to the picture XCMD provided in the Power Tools
stack that came with HyperCard 2.0.  Has anyone else had problems with this
XCMD?

(Thanks again to Stephen Fleming, author of the Progression stack/scripts for
his kind offer to help trace the problem at the script level.)

John M. Ford             BYU Instructional Psychology Program
740 South 50 East        (801) 378-7796
Orem, UT 84058           fordj@yvax.byu.edu