Over the last few months we have seen the evolution of Hypercard Stacks. We have also been evolving AutoScriptEdit by showing you how to increase the functionality while retaining simplicity. I have had a lot of feedback about ASE and most people prefer it to the inbuilt shortcuts in Hypercard 1.2.

So what was I to do for an encore, well I always wanted to group and move buttons etc. Souix Lacey did a great job with Groupies, and I wondered if I could make Hypercard act more in a Mac way. I decided to write AutoHyperEdit.

Well I started experimenting and I was thoroughly addicted to solving the problem. Even half way throug writing it I thought it would be impossible to get around some obstacles that would make it work. The script basically allows the user to shift and click on objects to group them. The problem was if you clicked on a button for example after my stack had done its stuff it would then execute the button that was clicked on. So I couldnt use nice things like target. The way I got around that was to check what objects were under the mouse at the time of the shiftKey.

After I had the scripting finished I decided I would make a model Installer and Demo Stack. I will first take you through the Stack and then get into how and what was done.

figure 1. AutoHyperEdit

The opening card shows what a little shading can do to add depth to your stack. The buttons I created to give as much feedback as possible. When you click on a button it appears to move in and the center black square turns to white. This is done by switching icons. Also to implement more feedback a click sound is heard.

I cant stress the importance of a good user interface particularly in Hypercard. At least half of my time in this project was spent on the interface. Apple is spending a lot of dollars on interface technology and have recognised the need for using it to aid in the smooth information flow between computer and machine. There is a group at Apple called the Human Interface Group, their sole job is to work on interface ideas and guidelines. If you have not read the Human Interface Guidelines do so immediately. It is a must. The guidlines are available through APDA and in some Bookshops and Computer Stores.

If you go to the examples card you will see three new buttons; Script Tools, Object Tools and Aligning Tools.

figure 2.

The Script Tools are the tools found in AutoScriptEdit-III. I use an interesting way to demo how the tools are to be used. There is part of a keyboard and part of a mouse pad and a mouse in the bottom left of the card, see figure 3.

figure 3.

When you click on a selection, you also get visual and auditory feedback, a field pops up along with two buttons; Close and Show Me.

figure 4.

Clicking on Show Me Starts the demo. First the cursor dissapears and an icon that is identical to the cursor is shown at the point of interest. To attract the attention to the moving parts I flash (hilite/unhilite) both the cursor and the the mouse icon. now I play the tune:

play harpsichord tempo 1200 c5 c6 c7

This signifies the start of what you should do. I then play the word mousedown which has been digitized. The icon changes showing a mouse with the button down. I showed the original demos to non Mac users and they could follow how to do it easily. My previous tests where I didnt have all the feedback the user was a bit lost and did not know where to focus his attention. The rest of the demo shows the mouse and the cursor moving up above a field. The script editor is then evoked.

The action of the buttons remain consistent even though the location is slightly different. One of the things to watch out for in your stacks is to keep consistency and simplicity at the forefront of your mind when you are designing.

The demo of grouping shows the tool window first to show that you must be in the browse tool mode. You then click on an object with the shift key down. This will hilite a button.

figure 6

There was a problem of not being able to hilite a field, so as well as a hilite I use a click tone. To select more objects just shift click again and to de-select you also shift click. Once you have finished selection you must double click not on an object. This will bring you to the button tool where you can choose a menu item such as copy button. Or simply type command-C. I used a feature of Hypercard 1.2 to show the card picture. I have a menu as a card picture and I show it and drag a hilited transperent button to act as a regular menu, see figure 7. Now go to the card you want to paste to and do a command-V and the objects will appear.

figure 7.

Clearing objects works in the same way, first selection then, double click, then menu command.

The next section is Aligning Tools. This allows you to select objects as before and then to hold down the mouse where you want the objects to be aligned, press the arrow key which corresponds to the alignment i.e. left arrow align left.

figure 8.

I also created an installer that puts the script into your home stack and adds a checkbox in the preferences card to allow you to turn AHE on and off. I do this in an interesting way. As well as the checkbox I add a hidden field to the card. I put the home stack into the field and search for specific comment strings that are on the same line as the handlers and I comment out the begining and end of the handlers.

{1}
on mouseUp
if the hilite of me is false
then
put the script of this stack into cd fld TempAHE
lock screen
show cd fld TempAHE
repeat 8 times
set cursor to busy
find --**AutoHyperEdit**--
put the foundline into temp
select temp
put -- before the selection
put the selection into temp
end repeat
set script of this stack to cd fld TempAHE
put empty into cd fld TempAHE
hide cd fld TempAHE
unlock screen
else
put the script of this stack into cd fld TempAHE
lock screen
show cd fld TempAHE
repeat 8 times
set cursor to busy
find --**AutoHyperEdit**--
put the foundline into temp
select temp
put the selectedtext into stext
delete char 1 to 2 of stext
put stext into the selection
put stext into temp
end repeat
set script of this stack to cd fld TempAHE
put empty into cd fld TempAHE
hide cd fld TempAHE
unlock screen
end if
end mouseUp

The Remove card simply removes all traces of AHE.

Here is the script I will go through the important parts and tell you what they do.

{2}
---- AutoHyperEdit 1.0 by Fred Stauder June 1988 ----
-- Put this Script into your Home Stack
-- To use keep mouse btn down over Button or Field and move mouse up
-- To edit Bkgnd Script keep mouse btn down move mouse to -left of card
-- Card Script - move right
-- Stack Script - move up
-- Now works with unlocked fields
-- To lock and unlock fields option click in them
-- To show/hide tools/patterns at cursor
-- hold option click on non-field areas
-- click in top left to hide cd window botom right to show
--Group objects by shift clicking in browse tool
--Move objects by holding mouse down and draging
--Copy and Clear groups of objects after selecting by using menus
-- Align objects after selecting, hold mouse down at align loc and press
-- the arrow key i.e. align left use left arrow key
-- Turn AHE on and Off using the Checkbox installed in the Pref Card
of Home

The globals are CWSlist is where the selected objects ids are cwloc is the card window location to hide the card and selectcomp is a flag for when the selections are compleated.

Gobo resets the hilites and puts empty into CWSList. The first section is AutoScriptedit Stuff.

{3}
on mouseStillDown --**AutoHyperEdit**--
Global cwslist,cwLoc,selectcomp
if selectcomp is true then gobo
put empty into CWSList
if the optionkey is down
then
if the target contains field then set locktext of target to false
else
if the optionkey is down then
set the visible of pattern window to not the visible of pattern
window
set the loc of pattern window to the mouseloc
set the visible of tool window to not the visible of tool window
set the loc of tool window to the mouseloc
exit mouseStillDown --------
end if
end if
end if
if the mouseloc is within 0,0,10,10
then
put the loc of card window into CWLoc
set loc of card window to -504,-315
exit mousestilldown
end if
if the mouseloc is within 500,333,512,346
then
set loc of card window to CWLoc
exit mouseStillDown
end if
put char 6 of the target into C6
if C6 is quote then AutoScriptEdit
if C6 is i then AutoScriptEdit
if C6 is quote then exit mousestilldown
if C6 is i then exit mousestilldown
if the mouseV <item 2 of rect of target then edit script of target
else
------------------CWS
put empty into foundit
put false into offdetected
if cwslist is empty
then
if the shiftkey is down
then
repeat until offdetected is true
if the shiftkey is down
then
shiftselect

Here we go to the routine that selects objects.

{4}
put false into foundit
else
movegroup
wait until the mouse is down
repeat with y = the number of items in CWSlist down to 1
if the mouseloc is within the rect of item y of cwslist
then
put false into foundit
exit repeat
else
put true into foundit
end if
end repeat
end if
if foundit is true
then if the shiftkey is up then put true into offdetected
end repeat
choose btn tool
select item 1 of cwslist
put true into selectcomp
end if
end if
end if
--pass mouseStillDown
end mouseStillDown --**AutoHyperEdit**--
on AutoScriptEdit
if the mouseH < 2 then edit script of this bkgnd
if the mouseH > 510 then edit script of this card
if the mouseV < 2 then edit script of this stack
end AutoScriptEdit
on openfield --**AutoHyperEdit**--
if the optionkey is down
then
if the mouseV <item 2 of rect of target
then
edit script of target
set locktext of target to false
exit openfield
end if
set locktext of target to true
end if
pass openfield
end openfield --**AutoHyperEdit**--

This traps the menu selections so that copy buttons etc will work on groups of objects

{5}
on domenu stuff --**AutoHyperEdit**--
global WhatsMyCardName,CWSList,selectcomp
if selectcomp is true
then
if stuff is clear button
then
clrobj
exit domenu
else if stuff is Copy Button then
put the long name of this card into WhatsMyCardName
pass domenu
else if stuff is cut button then put tip into top
else if stuff is paste button then
pasteobj
exit domenu
else if stuff is Copy fieldthen
put the name of this card into WhatsMyCardName
pass domenu
else if stuff is paste field then pasteobj
else if stuff is clear field then clrobj
pass domenu
exit domenu
end if
pass domenu
end domenu --**AutoHyperEdit**--

This is the Object clearing routine.

{6}
on clrobj
global CWSList
lock screen
repeat with p= the number of items in CWSlist down to 1
set cursor to busy
put item p of CWSlist into it
select it
type x with commandkey
end repeat
choose browse tool
unlock screen
put empty into Cwslist
end clrobj

This is the object pasting routine

{7}
on pasteobj
global CWSList,WhatsMyCardName,selectcomp
put false into selectcomp
set lockscreen to true
set lockmessages to true
repeat with x= the number of items in CWSlist down to 1
if second word of item x of CWSList ¬
is field then choose field tool else choose btn tool
set cursor to busy
push card
go to WhatsMyCardName
put item x of CWSlist into it
if second word of it is btn then set hilite of it to false
if first word of it is btn then set hilite of it to false
select it
type c with commandkey
pop card
if first word of it is Bkgnd then type b with cmdkey
type v with commandkey
if first word of it is Bkgnd then type b with cmdkey
end repeat
choose browse tool
set lockscreen to false
set lockmessages to false
put empty into CWSlist
put empty into WhatsMyCardName
put false into selectcomp
choose browse tool
end pasteobj
on gobo
global CWSList,turnoff,selectcomp
repeat with x= the number of items in CWSlist down to 1
if second word of item x of CWSList is btn then set the hilite
of item x of CWSlist to not the hilite of item x of CWSlist
if first word of item x of CWSList is btn then set the hilite of
item x of CWSlist to not the hilite of item x of CWSlist
end repeat
put empty into CWSList
end gobo

Here I had to test for different objects. I tried to put if the mouseloc is within the rect of a variable then.... where the variable contained an objuct such as btn and another variable. This did not work it is a pity I could have cut the script down considerably. Because of this I have to handle the object types seperately.

{8}
on shiftselect
global CWSlist,w,x,y,z
repeat until the shiftkey is up
repeat while the mouse is down
repeat with w = the number of cd btns down to 1
if the mouseloc is within the rect of btn w then HITCBtn
end repeat
repeat with x = the number of bkgnd btns down to 1
if the mouseloc is within the rect of bkgnd btn x then HITBBtn
end repeat
repeat with y = the number of cd flds down to 1
if the mouseloc is within the rect of cd fld y then HITCFld
end repeat
repeat with z = the number of bkgnd flds down to 1
if the mouseloc is within the rect of bkgnd fld z then HITBFld
end repeat
end repeat
end repeat
end shiftselect
on HitBFld
global CWSlist,z
put false into foundit
if the commandkey is down then set the visible of bkgnd fld z to not
the visible of bkgnd fld z
if the number of items in CWSlist =0
then
put Bkgnd field id  & the id of Bkgnd fld z & ,after CWSList
play harpsichord tempo 100 b#x7
exit HitBFld
end if
repeat with p = the number of items in CWSlist down to 1
put item p of CWSList into it
if it = Bkgnd field id  & the id of Bkgnd fld z
then
delete item p of CWSList
play harpsichord tempo 100 b#x7
exit HitBFld
end if
end repeat
put Bkgnd field id  & the id of bkgnd fld z & ,after CWSList
play harpsichord tempo 100 b#x7
end HitBFld
on HitCFld
global CWSlist,y
put false into foundit
if the commandkey is down then set the visible of cd fld y to not the
visible of cd fld y
if the number of items in CWSlist =0
then
put Card field id  & the id of cd fld y & ,after CWSList
play harpsichord tempo 100 b#x7
exit HitCFld
end if
repeat with p = the number of items in CWSlist down to 1
put item p of CWSList into it
if it = Card field id  & the id of cd fld y
then
delete item p of CWSList
play harpsichord tempo 100 b#x7
exit HitCFld
end if
end repeat
put Card field id  & the id of cd fld y & ,after CWSList
play harpsichord tempo 100 b#x7
end HitCFld
on HitBBtn
global CWSlist,x
put false into foundit
if the commandkey is down then set the visible of bkgnd btn x to not
the visible of bkgnd btn x
set the hilite of bkgnd btn x to not the hilite of bkgnd btn x
if the number of items in CWSlist =0
then
put bkgnd btn id  & the id of bkgnd btn x & ,after CWSList
play harpsichord tempo 100 b#x7
exit hitBBtn
end if
repeat with p = the number of items in CWSlist down to 1
put item p of CWSList into it
if it = bkgnd btn id  & the id of bkgnd btn x
then
delete item p of CWSList
play harpsichord tempo 100 b#x7
exit hitBBtn
end if
end repeat
put bkgnd btn id  & the id of bkgnd btn x & ,after CWSList
play harpsichord tempo 100 b#x7
end HitBBtn
on HitCBtn
global CWSlist,w
put false into foundit
if the commandkey is down then set the visible of btn w to not the
visible of btn w
set the hilite of btn w to not the hilite of btn w
if the number of items in CWSlist =0
then
put btn id  & the id of btn w & ,after CWSList
play harpsichord tempo 100 b#x7
exit hitCBtn
end if
repeat with p = the number of items in CWSlist down to 1
put item p of CWSList into it
if it = btn id  & the id of btn w
then
delete item p of CWSList
play harpsichord tempo 100 b#x7
exit hitCBtn
end if
end repeat
put btn id  & the id of btn w & ,after CWSList
play harpsichord tempo 100 b#x7
end HitCBtn

This section moves the objects.

{9}
on movegroup
global CWSList
wait until the mouse is down
put the mouseLoc into mLoc
put empty into mH
put empty into mV
repeat with i = 1 to the number of items in CWSList
put item i of CWSList into iList
put item 1 of the loc of iList - item 1 of mLoc & , after mH
put item 2 of the loc of iList - item 2 of mLoc & , after mV
end repeat
repeat while the mouse is down
get the mouseLoc
lock screen
repeat with i = 1 to the number of items in CWSList
put it into iList
add item i of mH to item 1 of iList
add item i of mV to item 2 of iList
set loc of item i of CWSList to iList
end repeat
unlock screen
end repeat
end movegroup

I added this section very quickly because I already had the underlying selection and moving structures. As you can see it is very simple.

{10}
on arrowkey whichkey
global CWSList
if the mouse is down then
if whichkey = left then
put the mouseH into L
repeat with i = 1 to the number of items in CWSList
put the width of item i of Cwslist into w
set the left of item i of Cwslist to L
set the width of item i of Cwslist to w
end repeat
end if
if whichkey = right then
put the mouseH into R
repeat with i = 1 to the number of items in CWSList
put the width of item i of Cwslist into w
set the right of item i of Cwslist to R
set the width of item i of Cwslist to w
end repeat
end if
if whichkey = up then
put the mouseV into T
repeat with i = 1 to the number of items in CWSList
put the height of item i of Cwslist into h
set the top of item i of Cwslist to T
set the height of item i of Cwslist to h
end repeat
end if
if whichkey = down then
put the MouseV into B
repeat with i = 1 to the number of items in CWSList
put the height of item i of Cwslist into h
set the bottom of item i of Cwslist to B
set the height of item i of Cwslist to h
end repeat
end if
exit arrowkey
end if
pass arrowkey
end arrowkey --**AutoHyperEdit**--
Non-Comercial use only - All Rights Reserved
Fred Stauder, Hypercard Editor, (HyperChat) MacTutor
---- AutoHyperEdit by Fred Stauder, June 1988 ---

You should get the stack because of the animation and sound ideas it contains. The key thing is to plan your stacks keep them modular so that they can be added to and be polite and use the pass statement so that other peoples scripts will work. For example a stack that uses on mouseStillDown and does not pass it will stop AutoHyperEdit working in that Stack.

Send your Articles, ScriptTips, SpeedTips, etc. to:

Fred Stauder, AppleLink D0280

Ecofin Reseach and Consulting

Lavaterstrasse 45

Zurich 8002

Switzerland

or

To the MacTutor Office

Community Search:

MacTech Search:

Software Updates via MacUpdate

SpamSieve 2.9.27 - Robust spam filter fo...

SpamSieve is a robust spam filter for major email clients that uses powerful Bayesian spam filtering.
SpamSieve understands what your spam looks like in order to block it all, but also learns what... Read more

VueScan 9.5.62 - Scanner software with a...

VueScan is a scanning program that works with most high-quality flatbed and film scanners to produce scans that have excellent color fidelity and color balance. VueScan is easy to use, and has... Read more

Fantastical 2.3.2 - Create calendar even...

Fantastical 2 is the Mac calendar you'll actually enjoy using. Creating an event with Fantastical is quick, easy, and fun:
Open Fantastical with a single click or keystroke
Type in your event... Read more

PCalc 4.4.4 - Full-featured scientific c...

PCalc is a full-featured, scriptable scientific calculator with support for hexadecimal, octal, and binary calculations, as well as an RPN mode, programmable functions, and an extensive set of unit... Read more

Alfred 3.2.1 - Quick launcher for apps a...

Alfred is an award-winning productivity application for OS X. Alfred saves you time when you search for files online or on your Mac. Be more productive with hotkeys, keywords, and file actions at... Read more

OmniPlan 3.6 - Robust project management...

With OmniPlan, you can create logical, manageable project plans with Gantt charts, schedules, summaries, milestones, and critical paths. Break down the tasks needed to make your project a success,... Read more

Backblaze 4.2.0.990 - Online backup serv...

Backblaze is an online backup service designed from the ground-up for the Mac. With unlimited storage available for $5 per month, as well as a free 15-day trial, peace of mind is within reach with... Read more

AppDelete 4.3.1 - $7.99

AppDelete is an uninstaller that will remove not only applications but also widgets, preference panes, plugins, and screensavers along with their associated files. Without AppDelete these associated... Read more

Apple GarageBand 10.1.4 - Complete recor...

The new GarageBand is a whole music creation studio right inside your Mac -- complete with keyboard, synths, orchestral and percussion instruments, presets for guitar and voice, an entirely... Read more

Adobe Lightroom 6.8 - Import, develop, a...

Adobe Lightroom is available as part of Adobe Creative Cloud for as little as $9.99/month bundled with Photoshop CC as part of the photography package. Lightroom 6 is also available for purchase as a... Read more

Latest Forum Discussions

Galaxy on Fire 3 - Manticore brings the series back for another round of daring space battles. It's familiar territory for folks who are familiar with the franchise. If you've beaten the game and are looking to broaden your horizons, might we... | Read more »

The best apps for your holiday gift exch...

What's that, you say? You still haven't started your holiday shopping? Don't beat yourself up over it -- a lot of people have been putting it off, too. It's become easier and easier to procrastinate gift shopping thanks to a number of apps that... | Read more »

MyTona, based in the chilly Siberian city of Yakutsk, has brought a little festive fun to its hidden object game Seekers Notes: Hidden Mystery. The Christmas update introduces some new inhabitants to players, and with them a chance to win plenty of... | Read more »

PINE GROVE 1.0
Device: iOS Universal
Category: Games
Price: $1.99, Version: 1.0 (iTunes)
Description:
A pine grove where there are no footsteps of people due to continuous missing cases. The case is still unsolved and nothing has... | Read more »

Niantic teases new Pokémon announcement...

After rumors started swirling yesterday, it turns out there is an official Pokémon GO update on its way. We’ll find out what’s in store for us and our growing Pokémon collections tomorrow during the Starbucks event, but Niantic will be revealing... | Read more »

3 reasons why Nicki Minaj: The Empire is...

Nicki Minaj is as business-savvy as she is musically talented and she’s proved that by launching her own game. Designed by Glu, purveyors of other fine celebrity games like cult favorite Kim Kardashian: Hollywood, Nicki Minaj: The Empire launched... | Read more »

Clash of Clans is getting its own animat...

Riding on its unending wave of fame and success, Clash of Clans is getting an animated web series based on its Clash-A-Rama animated shorts.As opposed to the current shorts' 60 second run time, the new and improved Clash-A-Rama will be comprised of... | Read more »

Leaks hint at Pokémon GO and Starbucks C...

Leaked images from a hub for Starbucks employees suggests that a big Pokémon GO event with the coffee giant could begin this very week. The images appeared on Reddit and hint at some exciting new things to come for Niantic's smash hit game.
| Read more »

DietSensor, Inc., a developer of smart food and nutrition applications designed to fight diabetes and obesity and help improve overall fitness, has announced the launch of its DietSensor app for... Read more

Best Buy has dropped their price on the 64GB Apple TV to $159.99 including free shipping. That’s $40 off MSRP.
32GB Apple TVs are on sale right now for $98 on Sams Club’s online store. That’s $51 off... Read more

12-inch Retina MacBooks, Apple refurbished, n...

Apple has restocked a full line of Certified Refurbished 2016 12″ Retina MacBooks, now available for $200-$260 off MSRP. Refurbished 2015 models are available starting at $929. Apple will include a... Read more

Apple has Certified Refurbished 13″ MacBook Airs available starting at $849. An Apple one-year warranty is included with each MacBook, and shipping is free:
- 13″ 1.6GHz/8GB/128GB MacBook Air: $849 $... Read more

Apple refurbished iMacs available for up to $...

Apple has Certified Refurbished 2015 21″ & 27″ iMacs available for up to $350 off MSRP. Apple’s one-year warranty is standard, and shipping is free. The following models are available:
- 21″ 3.... Read more

Apple’s Education discount saves up to $300 o...

Purchase a new Mac or iPad using Apple’s Education Store and take up to $300 off MSRP. All teachers, students, and staff of any educational institution qualify for the discount. Shipping is free:
-... Read more

MacTech is a registered trademark of Xplain Corporation. Xplain, "The journal of Apple technology", Apple Expo, Explain It, MacDev, MacDev-1, THINK Reference, NetProfessional, Apple Expo, MacTech Central, MacTech Domains, MacNews, MacForge, and the MacTutorMan are trademarks or service marks of Xplain Corporation. Sprocket is a registered trademark of eSprocket Corporation. Other trademarks and copyrights appearing in this printing or software remain the property of their respective holders. Not responsible for typographical errors.

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.