Converting The HyperCard Address Stack to SuperCard

Basic Conversion

The first walk through just covers the basic conversion of the stack and getting the basic scripts on the first background working.

In this section we will cover : Using The HyperCard Converter 4.5, Initial errors opening the project, Project Appearance, Navagation Buttons, Find Button, Show Notes, New Card Button, Delete Card Button and the Telephone Buttons.

Using The HyperCard Converter 4.5

We use the HyperCard Converter 4.5 application found in the SuperCard® 4.5.2:HyperCard Converter: folder.

You can either drag the HyperCard Stack on to the application or open it from the file menu:

You then choose a folder to save the new project in:

You will be presented with a dialog asking hwo you want the resources moved. The only thing I have changed it to put All others in the resource fork of the new project

You end up with a new Supercard project:

Initial errors opening the project

So now we can open the project and get to work.
We will just fix these error so that we get a working project, leaving more complex functinality for later.

The first thing I see is a SuperCard error message:
expected boolian and found something else
Tracing this leads to this script:

on openBackground
  -- Requires handlers: updateMenu,wrongStack
  if not wrongStack() then updateMenu
  pass openBackground
end openBackground
and particularly the wrongStack function:
function wrongStack -- in case stackInUse
  return (the value of word 2 of the long name of me is not line 1 of the stacks)
end wrongStack
The function is called from the openStack, closeStack, openBackground, closeBackground, resume, suspend, resumeStack, suspendStack handlers (which were in the stack script and now are in the window script of wd 1).

SuperCard does not have a stacks function (it has projects and windows ones).
To make it easier to deal with we just change the function at the moment to

function wrongStack -- in case stackInUse
  return true
end wrongStack
As Hypercard creates menus on the fly and supercard 'Menus are normally created, named and scripted during the project design' we are going to have to do some work on the menus later.

The second error I see is: property not defined in the background script:

on openCard
  set the visible of bg btn "Unmark" to (not the marked of this cd)
  pass openCard
end openCard
SuperCard does not have a marked property the SuperCard site HC and SC syntax difference pages notes:
mark[ed]
Syntax: the marked of this cd
Card property allowing for fast selection by such specified cards.
No equivalent card property. Try using a global variable or user property to store long ID's and the lineOffset function to manage them.

Again at the moment we are just going to comment out script:

on openCard
  --set the visible of bg btn "Unmark" to (not the marked of this cd)
  pass openCard
end openCard

Project Appearance

Now we will do some cosmetic work on the first background.

If we look at the first card of our new project you can see that the icons and lable fields are missing. SuperCard Background Fields do not support sharedText so we will create some Background Draw Text graphics to replace them.

We could change the name of the window too.

There are several buttons on the background that do not show up properly as their icons are in the Hypercard application or the home stack.
On of them is the home button at the bottom right of the background. We will just detete this. If you were making the addresses part of an SC system of projects you might want to script this to do something useful.

The telephone number fields all have a telephone button on the left, this icon is from the Hypercard application. you need to move this resource from the resource fork of the Hypercard app to the data fork of your project. (using the resource mover utility or MPI's resource module.) Once you have done that the icons will show up in the buttons.

Before we move on to the various scripts, we will just make the proj look a little more mac like. When the stack was converted the B&W hyperCard art was added as a background bitmap, I am going to delete this and set the showlines of all the fields to false and their showFrame to true:

We could change the window themeBackground to default, some of the button styles t obevel and set the showfill of all the fields to true.

Navagation Buttons

The Navagation buttons have a script like this:
on mouseDown
  lock screen
  if the shiftKey is down then go prev marked cd
  else if the commandKey is down then go first cd of this bg
  else go prev cd of this bg
  unlock screen with visual wipe left fast
end mouseDown

on mouseStillDown
-- Requires handler: mouseDown
  mouseDown
end mouseStillDown 

These throw an error 'can't understand arguments from the 'unlock screen with visual wipe left fast' in Supercard you need to quote the visual effect:
'unlock screen with visual "wipe left" fast'

Also in SuperCard the mouseStill Down message is not sent if the card changes.
A quick fix is:

repeat until the mouse is up
 go prev cd of this bg
 unlock screen with visual "wipe right" slow
end repeat
and comment out or remove the mouseStillDown script.

The if the shiftKey is down then go prev marked cd line will not work, Supercard will put up a file dialog asking you to find the prev marked card.

At the moment we just change 'prev marked cd' to prevmarkedcd
and and this to the background script:
on prevmarkedcd
end prevmarkedcd
We will script this when we have worked out how to deal with marked cards.

Deal with the next button in similar fashion. (nextmarkedcard)

Find Button

The find button and script works fine, clicking it presents a ask box and after that enter or return will find the next occurance.
There is a handler in the background to let you use the enterkey and return key to find again.
This interfears with running a script from the messgebox after finding something, I've added a line to fix his:

function executeFind
  -- Requires handler: findText
  -- if the cursor is not in a field or in the message box, then
  -- assume they want to find the text again.
  --JJ next line to allow me to use the message box
  if the vis of the msg and the message is not "" then return FALSE
  global AddressFind
  if (AddressFind is not empty) and (the selectedField is empty) then
    return TRUE
  else return FALSE
end executeFind

Show notes

Show notes works fine too. We can leave it alone

New Card Button

The New Card button has a script:

on mouseUp
  -- Requires handler: toggleMark
  -- create a new card and leaving the cursor into the name field
  toggleNotes false
  set lockMessages to true
  doMenu "New Card"
  --toggleMark false
  select after text of bg field id 4
end mouseUp

Which nearly works, the toggleMark handler runs into the problem of the marked property not being a Supercard one.
Juat comment it out for now.

Also doMenu "New Card" uses a workaround added to the SC project by the converter, better to use 'new card' instead of doMenu "New Card".

Delete Card Button

The Delete Card button script looks like this:

on mouseUp
  -- Requires handler: deleteCurrentCard
  if the optionKey is down then
    doMenu "Delete Card"
    exit mouseUp
  end if
  if the number of cards in this bkgnd = 1 then
    answer "Can't delete the last address card." with "OK" -- Δ
    exit to hyperCard
  end if
  answer "Delete this address card?" with "Cancel" or "OK" -- Δ
  if it is "OK" then -- Δ
    set cursor to watch
    get number of this card
    lock screen
    doMenu "Delete Card"
    go card it - 1
    unlock screen
  end if
end mouseUp
the first comment:
-- Requires handler: deleteCurrentCard seems to be left over from a previous version of the stack.
The 2 lines ' doMenu "Delete Card"' can be canged to 'delete card'

'go card it - 1' produces an error 'expected end of line'
Change it to 'go card (it - 1)'

Telephone Button

The dial buttons These have scripts like:
on mouseUp
  dialNumber "Phone 1"
end mouseUp
The dialNumber handler is in the background script, in my copy of the address stack there are 2 tihs is the first one:
on dialNumber whichFld
  -- dial the phone with a specified number.
  put bg fld whichFld into phoneNumber
  if phoneNumber is empty then
    ask "What phone number would you like dialled?" -- Δ
    if the result is "Cancel" or it is empty then exit dialNumber
    put it into phoneNumber
  end if
  -- the dial handler is in the Phone Dialer stack
  if there is a stack "Phone Dialer" then  -- Δ
    lock screen
    push cd -- remember where we are
    go stack "Phone Dialer" -- Δ
    if the result is empty then
      dial phoneNumber
      pop cd
      unlock screen
    end if
  else dial phoneNumber
end dialNumber
I've changed it to:
on dialNumber whichFld
  -- dial the phone with a specified number.
  put bg fld whichFld into phoneNumber
    dial phoneNumber
end dialNumber

I am not sure if it works as I do not have a modem in my mac.

This covers the basic workings of the Address stack, but none of the more complex issues such as menus, marking and sorting.