TweetFollow Us on Twitter

User log, tools
Volume Number:5
Issue Number:5
Column Tag:Programmer's Workshop

User Log and Programming Tools

By Dave Kelly, MacTutor Editorial Board

It was just a few short weeks ago that I was cleaning out our ‘nVir’ attack. Yea, about 8 out of 10 of our Macs had the dreaded disease. The guy that wrote it probably thinks he is real funny right now. Ha, Ha. Well, after about 15-20 hours worth of checking floppy disks and cleaning systems I’m not laughing. That just goes to show you that even when you think you are fine it could still get you. At least my own Mac at home was still clean.

Making a fuss like that in a big company doesn’t go over very well. The management has sent out an edict that all Macintoshes must be checked for viruses once each day. That’s a bit much, wouldn’t you say? In addition, they want every user (there are many more users than there are Macs) to log in each disk that they insert into a Macintosh. “WHAT?” you say. That’s right, write down on a log sheet your name and what disk you inserted into the system. I don’t need to tell you that most people don’t bother to write anything on the log sheets. This was bound to backfire somehow. Probably someone will think that few people use the Macintosh (this is obviously not true since it is hard to even get on a Mac during the day, and I have to bring my work home) and not allow us to buy more (much needed) computers.

There are a few options open to solve this problem. We could just lock up everyone’s floppy disks so that they can’t take them home, or buy a commercially available activity tracking system such as MacInUse to log each user in, or we could write a quick and dirty program to do at least part of the job for us. Buying a copy of software for every Mac we have doesn’t appeal to anyone since we do have a strict budget. I hope they realize how much free use of equipment they get when employees to work at home on their own computers. We must be able to backup and transport data via floppy disk. I opted to write a short program to do the job. I didn’t have the time to make it do everything, but it will meet the basic need to log everyone in.


The trick involved in this program is to get the program to run again after any application runs and when it quits, return back to the Finder. I didn’t want to remove any features from the Macintosh such as the Finder. It would be easier to just replace the Finder with another application but that would make it hard for users to copy their own disks, etc. There are two global memory locations that are used to make this work. The first one, CurApName at $910 gives us the name of our application in case someone changed the name. The second one, FinderName at $2E0 is the name of the finder which is used to tell the system which program to run when an application quits. By putting CurApName into FinderName our application will run after each time another application quits provided that our application is put in the system folder.

The program ‘Who?’ is a very simple program to record usage and on the computer. You may use 1 or more passwords (in case there are several people using the system). The passwords are stored in a STR# resource in the application. The passwords are not encrypted because most of the users that I come in contact with don’t have ResEdit or even if they did they wouldn’t know how to use it. The ones that do are going to get past this sort of password protection anyway. Remember, the main purpose is not to keep people out, but to log activity. You may edit passwords by changing the STR# resource.

When the program runs, a modal dialog box comes up to request the password and user’s name. The user must type in a name or the program will not end. (‘Enter Your Name here!’ is not a valid user name). When all the information has been filled in the user selects the OK button and if the password matches one of the STR# resource items, the program continues. At this point, the FinderName global is updated to the current application name as explained above. Next the available volumes are searched so that they can also be logged in. The purpose of this was to give some traceability if the virus appears again. We want to be able to trace to some extent who may have disks that are infected. This is not foolproof however because the user can always switch disks while running under another application. The function ‘GetIndVolume’ for searching for mounted volumes is found in technical note #24 by Bryan Stearns. This is a good one to keep around for future use.

The ‘Who?’ program finishes by fetching the time and date and storing the data to a file on disk, then launching the Finder. The log-in data file is set to invisible to make it harder to erase from the disk. It can be accessed via a word processor to examine who? has been using the Mac. I included a way to reset the FinderName back to Finder and make the log-in file visible. By typing ‘ShowLog’ (case sensitive) for the password, the log will become a visible file. By using ‘RestoreFinder’ (also case sensitive) for the user name, the FinderName global will be set to Finder. That’s about all there is to it. To set up the application, drag it into the system folder and then select it. Next choose ‘Set StartUp’ from the Finder’s Special menu. If you use ‘RestoreFinder’ be sure to ‘Set StartUp’ again or the system will get confused the next time you startup.

There is a lot of things that could be done to change this program to add features which you may feel are needed. While this by no means keeps the virus bug from coming, it does provide a bit of traceability to help in the clean up process.

program who;

 DialogID = 4912;{Resource ID number}
 FinderName = $2E0;{Global location of Finder name}
 CurApName = $910; {Global location of Current Application name}

 type {this type sets up structure for launching applications}
 pLaunchStruct = ^LaunchStruct;
 LaunchStruct = record
 pfName: StringPtr;
 param: integer;
 end; { LaunchStruct}
 itemhit: integer;
 theDialog: Dialogptr;
 itemtype, index: integer;
 item2, item3: handle;
 box: rect;
 text2, text3, thepassword: str255;
 access, done: boolean;
 Filenameptr: STRINGptr;
 fName: str255;
 Finderptr: stringptr;
 pMyLaunch: pLaunchStruct;
 myLaunch: LaunchStruct;
 d: DateTimeRec;
 datafile: str255;
 data: text;

 procedure Launchit (pLnch: pLaunchStruct);  {Launch an application}
 $205F, $A9F2;

 procedure writedata;{store the log in file to disk}
 whichvol, VolRefNum: integer;
 volName: str255;
 Result: OSErr;
 fndrInfo: FInfo;
 flgptr: ptr;
 datafile := ‘Log’; {set filename for data file}
 open(data, datafile);    {open the file}
 seek(data, maxlongint);  {find the end of the file}
 writeln(data, text3, ‘  ‘, text2, ‘  ‘, d.Month : 3, ‘/’, d.Day : 2, 
‘/’, d.Year : 4, d.Hour : 3, ‘:’, d.Minute : 2, ‘:’, d.Second : 2);
 whichVol := 1;  { start searching for disks in 1st vol.}
 repeat { find all the volumes that are currently mounted}
 Result := GetIndVolume(whichVol, volName, VolRefNum);
 if Result <> nsvErr then
 begin  {store the volumes on line to system disk}
 writeln(data, whichvol, ‘:  ‘, volName);
 whichVol := whichVol + 1;
 until Result = nsvErr;
 Result := GetFInfo(datafile, 0, fndrInfo);
 if BitAnd(fndrInfo.fdFlags, fInvisible) <> 16384 then
 fndrInfo.fdFlags := fndrInfo.fdFlags + fInvisible;
 if text2 = ‘ShowLog’ then
 fndrInfo.fdFlags := fndrInfo.fdFlags - fInvisible;
 Result := SetFInfo(datafile, 0, fndrInfo);

begin {start of main program}
 access := false;
 text2 := ‘Enter Password here!’;
 text3 := ‘Enter Your Name here!’;
 theDialog := getnewdialog(dialogID, nil, POINTER(-1));
 getditem(thedialog, 2, itemtype, item2, box);
 setItext(item2, text2);
 getditem(thedialog, 3, itemtype, item3, box);
 setItext(item3, text3);
 SelIText(theDialog, 2, 0, 32767);
 itemhit := 10;
 modaldialog(nil, itemhit);
 until itemhit = 1;
 getItext(item2, text2);
 getItext(item3, text3);
 done := false;
 index := 1;
 getindstring(thepassword, DialogID, index);
 if (text2 = thepassword) and (thepassword <> ‘’) then
 access := true;
 if access = true then
 done := true;
 if thepassword = ‘’ then
 done := true;
 index := index + 1;
 until done = true;
 if access = false then
 setItif text3 = ‘Enter Your Name here!’ then
 access := false;
 until access = true;
 Filenameptr := STRINGptr(CurApName);
 fName := Filenameptr^;
 Filenameptr := STRINGptr(FinderName);
 Filenameptr^ := fName;
 if text3 = ‘RestoreFinder’ then
 Filenameptr^ := ‘Finder’;
 pMyLaunch := @myLaunch;
 fName := ‘Finder’;
 with pMyLaunch^ do
 pfname := @fName;
 param := 0;

unit Filestuff;
{ From Macintosh Technical Notes #24 }
{ by Bryan Stearns}

 function GetIndVolume (whichVol: integer; var volName: str255; var volRefNum: 
Integer): OSErr;


 function GetIndVolume;  {(whichVol: integer, var volName: str255, var 
volRefNum: Integer): OSErr;}

{Return the name and vRefNum of volume specified by whichVol}

 volPB: HParamBlockRec;
 error: OSErr;
 with volPB do   {makes it easier to fill in!}
 ioNamePtr := @volName; {make sure it returns the name}
 ioVRefNum := 0; {0 means use ioVolIndex}
 ioVolIndex := whichVol;  {use this to determine the volume}
 end; {with}
 error := PBHGetVInfo(@volPB, false);{do it}
 if error = noErr then
 volRefNum := volPB.ioVRefNum;
 end; {if no error}
{other information is available from this record; see the FILE }
{Manager’s description of PBHGetVInfo for more details}
 GetIndVolume := error; {return error code}

end.  {of unit}


resource  ‘ICN#’ (128, purgeable)
    0x07ff 0xffe0 0x39e0 0x079c 
    0xff70 0x0eff 0x83d8 0x1bc1 
    0x80fc 0x3f01 0x81ce 0x7381 
    0x8303 0xc0c1 0x8201 0x8041 
    0x8631 0x8c61 0x8631 0x8c61 
    0x8631 0x8c61 0x8201 0x8041 
    0x8303 0xc0c1 0x81cf 0xf381 
    0x81ff 0xff81 0x8101 0x8081 
    0x8301 0x80c1 0x8300 0x00c1 
    0x8300 0x00c1 0x8700 0x00e1 
    0x8700 0x00e1 0xa500 0x00a5 
    0xa500 0x00a5 0xa580 0x01a5 
    0xa7bb 0xdde5 0xa6f9 0x9f65 
    0xacc0 0x0335 0xb8ee 0x771d 
    0xb0f4 0x2f0d 0xe1fb 0xdf87 
    0xc3ff 0xffc3 0x82d7 0xeb41 ;

    0x07ff 0xffe0 0x3fff 0xfffc 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 
    0xffff 0xffff 0xffff 0xffff 

userdefined resource  ‘Dave’ (0)

resource  ‘BNDL’ (130)
    ‘Dave’,     0,
    ‘FREF’, {1, 129};
    ‘ICN#’, {0, 128}

resource  ‘FREF’ (129)

resource  ‘STR#’ (4912 , “Passwords”)

resource  ‘DLOG’ (4912)
    {64, 32, 180, 354},
    “Please Log in\0xc9”

resource  ‘DITL’ (4912)
    {76, 128, 96, 188},
      Button {enabled, “OK”};
    {15, 123, 34, 303},
      EditText {enabled, “Enter Password Here!”};
    {42, 123, 61, 303},
      EditText {enabled, “Enter Your Name Here!”};
    {15, 43, 33, 116},
      StaticText {enabled, “Password:”};
    {42, 16, 61, 119},
      StaticText {enabled, “Name/Initials:”}

Mac Programming Tools

Some mention has been made in the past regarding programming tools which create the Macintosh user interface. In October, 1988, MacTutor presented a comparison of Prototyper™ 1.0, MacExpress, and FaceIt™ all products to help programmers with the user interface. In order to update the list of these programs, I would be amiss if I did not mention Invention Software’s Professional Programmer’s EXTENDER™ (Full Source Code Version) and say a few words about the new release of Prototyper™ 2.0.

EXTENDER™ consists of a very large set of routines which may be used to implement all or portions of the Macintosh interface. It consists of C or Pascal source code, your choice, which you must compile with your application. Unlike the FaceIt™ which must have the library file available when running the application, EXTENDER™ allows you to use and compile all or parts of the routines as needed. The main problem with this is that the possible routines you may use are are as numerous as the first three volumes of Inside Macintosh.

EXTENDER™ comes with your choice of language disks and a huge binder which reminded me of the early Macintosh development days when Inside Macintosh was only available as loose leaf pages. (You can still get Inside Macintosh as loose leaf pages if you want). Routines included are:

• Menu

• Windows

• Controls

• Scroll Bars

• Dialogs and Alert Boxes

• Text Editing

• Bit Maps

• Graphics

• Printing

• The List Manager

• Popup menus

• Input/Output routines

• Event handling

Each of the categories above are organized in a tutorial/reference format so you can study and learn how to implement the routines by observing and practicing the demos provided. Be prepared to do a lot of reading.

There are updates available from time to time which will correct some of the problems which come up. If there are problems it is nearly always more difficult to debug someone elses code than to debug your own. The problem is that whenever generic routines are used there are cases or exceptions when you want to do something just a bit different. In EXTENDER™ that requires modifying code that someone else wrote.

Prototyper™ 2.0 is a major new release from SmethersBarnes. If you thought that Prototyper™ 1.0 was great, you’ll love this version. Dozens of new features have been added to Prototyper™ based on comments of programmers and user interface designers. In particular Prototyper™ 2.0 adds:

• New Code Generators

• Enhanced Screen Layout Capabilities

• Macintosh User Interface Feature Additions

So what’s new? The following is a list of new features which will convince you that you should upgrade or buy Prototyper™ 2.0:

C code generation

C programmers have been begging for this since version 1.0 was released. Two separate code generators are included with Prototyper™ 2.0, one for C generation and one for Pascal. The Pascal generator creates source code for LightSpeed Pascal 2.0, Turbo Pascal, MPW Pascal, and TML Pascal II. The C generator creates source code for LightSpeed C, MPW C 2.0 and MPW C 3.0.

Screen Layout

The layout features you have seen in version 1.0 have been improved so that you can manipulate zones similar to the way you would in drawing programs. It is much easier to group and align objects. Screen grids and a new coordinate window let you position zones exactly down to the pixel.

Popup & hierarchical menus

The menu editor now supports one level of hierarchical menus. Most applications will probably never need more than one hierarchical level. Popup menus are included in the window palettes so you can place them anywhere in your window.

Set location

The window editor has been enhanced to support any size of monitor. Self centering options may be selected to center the window for any size screen. The screen grid mentioned above helps align objects on the window also.


You can now link menus, buttons, and menu items to enable/disable each other or to open or close windows. The standard dialogs for ‘Print’ and ‘Page Setup’ can be linked to open. The flow of an entire application can be establish through this simple mechanism. It is as easy as linking HyperCards together.

Other Features

You can now import and export resources from other applications. A ‘Print to file’ option lets you output your screen designs to a MacPaint file to be used for documentation or other purposes. ‘Demo’ windows have been added to allow you to created canned graphics and word processing windows. Prototyper™ 2.0 includes a new and much improved manual. The manual includes a tutorial, and detailed information about every aspect of the program.

After using EXTENDER™ and Prototyper™ for some time now I will have to say the I prefer Prototyper™. EXTENDER™ has so many routines to become familiar with that I feel it would take about as long to learn it as to use Inside Macintosh and get to know the routines that are standard. With tools like Prototyper™ around I can create the structural part of my user interface with the minimum of discomfort.


Community Search:
MacTech Search:

Software Updates via MacUpdate

Opera 47.0.2631.83 - High-performance We...
Opera is a fast and secure browser trusted by millions of users. With the intuitive interface, Speed Dial and visual bookmarks for organizing favorite sites, news feature with fresh, relevant content... Read more
Vivaldi 1.12.955.36 - An advanced browse...
Vivaldi is a browser for our friends. In 1994, two programmers started working on a web browser. Our idea was to make a really fast browser, capable of running on limited hardware, keeping in mind... Read more
Apple Configurator 2.5 - Configure and d...
Apple Configurator makes it easy to deploy iPad, iPhone, iPod touch, and Apple TV devices in your school or business. Use Apple Configurator to quickly configure large numbers of devices connected to... Read more
Smultron 10.0 - Easy-to-use, powerful te...
Smultron 10 is an elegant and powerful text editor that is easy to use. You can use Smultron 10 to create or edit any text document. Everything from a web page, a note or a script to any single piece... Read more
BetterTouchTool 2.304 - Customize multi-...
BetterTouchTool adds many new, fully customizable gestures to the Magic Mouse, Multi-Touch MacBook trackpad, and Magic Trackpad. These gestures are customizable: Magic Mouse: Pinch in / out (zoom... Read more
Drive Genius 5.0.5 - $49.50 (50% off)
Drive Genius features a comprehensive Malware Scan. Automate your malware protection. Protect your investment from any threat. The Malware Scan is part of the automated DrivePulse utility. DrivePulse... Read more
Apple Keynote 7.3 - Apple's present...
Easily create gorgeous presentations with the all-new Keynote, featuring powerful yet easy-to-use tools and dazzling effects that will make you a very hard act to follow. The Theme Chooser lets you... Read more
Apple Numbers 4.3 - Apple's spreads...
With Apple Numbers, sophisticated spreadsheets are just the start. The whole sheet is your canvas. Just add dramatic interactive charts, tables, and images that paint a revealing picture of your data... Read more
Apple Pages 6.3 - Apple's word proc...
Apple Pages is a powerful word processor that gives you everything you need to create documents that look beautiful. And read beautifully. It lets you work seamlessly between Mac and iOS devices, and... Read more
Smultron 9.4.2 - Easy-to-use, powerful t...
Smultron 9 is an elegant and powerful text editor that is easy to use. Use it to create or edit any text document. Everything from a web page, a note or a script to any single piece of text or code.... Read more

ARise (Games)
ARise 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: **ARKit only Puzzle game****Chapter 1 available now - More worlds coming soon!** ARise is an experience about perspective. Using the AR... | Read more »
The best games to play while you wait fo...
SteamWorld Dig 2 is out this week on PC and Switch, and people are understandably excited. This clever series by Image and Form combines our favorite metroidvania mechanics with an esquisite universe, excellent storytelling, and true wit. While... | Read more »
Drag'n'Boom beginner's gu...
Have you ever wanted to burn and pillage a village as a bloodthirsty dragon? If you answered yes to that question, Drag'n'Boom offers you the perfect chance to do so, casting you as an adorable little dragon that wants to set humankind aflame. It... | Read more »
Thimbleweed Park (Games)
Thimbleweed Park 1.0.0 Device: iOS Universal Category: Games Price: $9.99, Version: 1.0.0 (iTunes) Description: A brand new adventure game from Ron Gilbert and Gary Winnick, creators of the classics Monkey Island and Maniac Mansion!... | Read more »
The best simulation games on mobile
There's nothing like a good sim -- from the seemingly ridiculous to the incredibly mundane, you can be there's a simulation game out there for your every whim. [Read more] | Read more »
INKS guide - how to create works of pinb...
INKS puts a clever new spin on everyone's favorite classic arcade game, pinball. The core mechanics are the same -- keep a little ball pinging around the board for as long as possible without letting it fall into the precarious holes in the board.... | Read more »
Warbands: Bushido (Games)
Warbands: Bushido 1.0 Device: iOS Universal Category: Games Price: $3.99, Version: 1.0 (iTunes) Description: Warbands:Bushido is a miniatures board game with cards, miniatures, dice and beautiful terrains to fight on, with both... | Read more »
The best mobile games like Divinity: Ori...
Divinity: Original Sin 2 launched this week to the excitement of RPG fans everywhere. The game, which derives a lot of of its story and mechanics from old-school isometric RPGs and Dungeons & Dragons, has unseated PlayerUnknown's... | Read more »
Iron Marines guide - beginner tips and t...
Iron Marines is a brilliant RTS title that feels a bit like Starcraft. It's got a sci-fi setting and some of the most spectacular strategy mechanics we've seen in mobile games to date. With that said, the RTS genre can be a bit tricky to break... | Read more »
The best new games we played this week -...
The work week can be tough, but on the bright side, it's almost overandthere are bunches of brand new games to try out this weekend. This week definitely makes up for last week's sleepiness ten-fold. We've got one of the finest RTS game on mobile... | Read more »

Price Scanner via

Is iPhone X Really The Future Of The Smartpho...
Should iPhone X even be called a telephone? It does of course support telephony and texting, but its main feature set is oriented to other things. It is also debatable whether it makes any rational... Read more
OtterBox Announces Full Case Lineup for iPhon...
Apple revolutionized the smartphone industry 10 years ago with the original iPhone, and OtterBox has set the standard of protection from the very beginning by protecting every generation of iPhone.... Read more
LifeProof Introduces What’s NEXT Cases for iP...
LifeProof built its reputation on sleek, ultra-protective iPhone cases. From 360-degree coverage to the first screenless waterproof case, the protection pioneer has always pushed the limits.... Read more
Apple Refurbished 2016 15-inch MacBook Pros a...
Apple has Certified Refurbished 2016 15″ Touch Bar MacBook Pros available starting at $1949. An Apple one-year warranty is included with each model, and shipping is free: – 15″ 2.7GHz Touch Bar Space... Read more
Wednesday deal: 15-inch MacBook Pros for up t...
B&H Photo has 2017 15″ MacBook Pros on sale for $150-$200 off MSRP. Shipping is free, and B&H charges sales tax in NY & NJ only: – 15″ 2.8GHz MacBook Pro Space Gray: $2199, $200 off MSRP... Read more
2.6GHz Mac mini on sale for $599, $100 off MS...
B&H Photo has the 2.6GHz Mac mini (MGEN2LL/A) on sale for $599 including free shipping plus NY sales tax only. Their price is $100 off MSRP. Read more
Snag a 15-inch 2.2GHz Retina MacBook Pro, App...
Apple has Certified Refurbished 2015 15″ 2.2GHz Retina MacBook Pros available for $1699. That’s $300 off original MSRP, and it’s the lowest price available for a 15″ MacBook Pro currently offered by... Read more
Apple Refurbished 3TB Time Capsule for $279,...
Apple has Certified Refurbished 3TB Time Capsules available for $279 including free shipping plus Apple’s standard one-year warranty. Their price is $120 off MSRP. Read more
19% off Smart Battery Cases for iPhone 7
Amazon has both Black and White Smart Battery Cases for iPhone 7s available for $80.41 including free shipping. Their price is $18.59, or 19%, off MSRP. Read more
Back on sale: 10.5-inch 64GB iPad Pros for $5...
MacMall has 10.5″ 64GB Apple iPad Pros on sale again for $599 including free shipping. That’s $50 off MSRP and the lowest price available for this model from any reseller. Read more

Jobs Board

*Apple* Retail - Multiple Positions - Apple,...
Job Description: Sales Specialist - Retail Customer Service and Sales Transform Apple Store visitors into loyal Apple customers. When customers enter the store, Read more
*Apple* News Product Marketing Mgr., Publish...
Job Summary The Apple News Product Marketing Manager will work closely with a cross-functional group to assist in defining and marketing new features and services. Read more
Development Operations and Site Reliability E...
Development Operations and Site Reliability Engineer, Apple Payment Gateway Job Number: 57572631 Santa Clara Valley, California, United States Posted: Jul. 27, 2017 Read more
*Apple* Solutions Consultant - Apple Inc. (U...
…about helping others on a team while also delighting customers? As an Apple Solutions Consultant (ASC), you will discover customers needs and help connect them Read more
Software/Data Engineer, *Apple* Media Produ...
Job Summary Apple Media Products is the team behind the App Store, Apple Music, iTunes, and many other high profile products on iPhone, Mac and AppleTV. Our Data Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.