TweetFollow Us on Twitter

Jul 97 - Tips

Volume Number: 13 (1997)
Issue Number: 7
Column Tag: Tips & Tidbits

Jul 97 - Tips & Tidbits

by Steve Sisak

In article <19970223210019110631@stcc010.ulaval.ca>, <cbrunet@geocities.com> (Charles Brunet) wrote:
When I call FSpDelete in my application, the document is not always deleted from the Finder. Sometime, I must create an other document with the same name to erase it. Is it possible to ask Finder to forget this file right now? I have the same problem when I create a document. It take some time before it appear in the Finder.

How to update the informations in the Finder? If you have a scriptable finder, you can send it an update event. Here is a snippet from an (as of yet) unreleased piece of software:

OSErr
ICTyper::SendFinderAEUpdate(FSSpec &inFile)
{
  OSErr  err = noErr;
  AEDesc   processDesc;
  AppleEvent   ae, aeReply;
  ae.descriptorType = aeReply.descriptorType = processDesc.descriptorType
= typeNull;
  ae.dataHandle = aeReply.dataHandle = processDesc.dataHandle = nil;
  
  Try_ {
   DescType finderType = 'MACS';
   err =
::AECreateDesc(typeApplSignature,&finderType,sizeof(DescType),&processDesc);
   FailOSErr_(err);
   
   err  = ::AECreateAppleEvent('fndr', 'fupd',&processDesc,
                    
kAutoGenerateReturnID,kAnyTransactionID,&ae);
   FailOSErr_(err);
   
   err =
::AEPutParamPtr(&ae,keyDirectObject,typeFSS,&inFile,sizeof(inFile));
   FailOSErr_(err);

   err = ::AESend(&ae,&aeReply, kAENoReply | kAENeverInteract,
kAENormalPriority,
        kAEDefaultTimeout,nil,nil);
   FailOSErr_(err);
  }
  Catch_(catchErr) {err = catchErr;} EndCatch_
  
  if (processDesc.descriptorType != typeNull) :AEDisposeDesc(&processDesc);
  if (ae.descriptorType != typeNull) ::AEDisposeDesc(&ae);
  if (aeReply.descriptorType != typeNull) :AEDisposeDesc(&aeReply);
  return err;
}

Jim Correia
pmth02jc@umassd.edu


Screen Shots the Gnarly Way

One thing you can't do on the standard MacOS today is take a screen snapshot with a menu being displayed (or indeed, with the mouse down). There are lots of third-party solutions to this, but in fact there is a way to get such a screen snapshot, by installing no additional software other than MacsBug. And since all readers of this magazine already have MacsBug installed (well, don't you?), that means you can indeed take screen snapshots with menus displayed on your Mac!

CAUTION: this technique can crash your machine, or have other unexpected consequences. Perhaps you should look on it as Another Fun Thing to Do With MacsBug, to show off to your fellow geeks at parties, rather than as a serious technique for regular use.

First of all, type cmd-shift-3 to invoke the standard screen snapshot FKEY. This is purely to make sure the FKEY code is loaded in memory; you can throw away the PICT file it creates at this point. Next, hold down the mouse button to display the menu that you want to take a snapshot of. While still holding the button down, use your other hand to press the interrupt button (or key sequence) to break into MacsBug. Once the MacsBug screen appears, you can release the mouse button.

Use the "hx" command, if necessary, to switch to the system heap. Now use the command

 hd FKEY

to find out where the code for FKEY 3 is loaded. You will see a display that looks something like this:

 Displaying the System heap at 00002000
   Start  Length   Tag Mstr Ptr Lock Prg Type  ID  File   Name
  0038F52C 0000046C+08  R  0019DA1C    P  FKEY 0003 0002
 #1 block listed, which uses #1152 bytes, storing #1132 bytes

(If you see more than one FKEY loaded, the one you want will have "0003" under the ID column.) Make a note of the hexadecimal number under "Start" -- that is the start address of the FKEY code. Next, enter the following commands:

 sp := sp-4
 sl sp pc
 pc := xxxxxxxx

(replace the "xxxxxxxx" with the start address of FKEY 3 you obtained before.) Finally, enter the command "g" to resume execution. You should hear the click of the snapshot being taken, followed by the disappearance of the menu that was being displayed. But if you have a look at the resulting snapshot PICT file, you will see that it shows the menu!

Assuming your machine stays up that long (hee-hee)...

Lawrence D'Oliveiro
LDO@waikato.ac.nz

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Combo Quest (Games)
Combo Quest 1.0 Device: iOS Universal Category: Games Price: $.99, Version: 1.0 (iTunes) Description: Combo Quest is an epic, time tap role-playing adventure. In this unique masterpiece, you are a knight on a heroic quest to retrieve... | Read more »
Hero Emblems (Games)
Hero Emblems 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: ** 25% OFF for a limited time to celebrate the release ** ** Note for iPhone 6 user: If it doesn't run fullscreen on your device... | Read more »
Puzzle Blitz (Games)
Puzzle Blitz 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Puzzle Blitz is a frantic puzzle solving race against the clock! Solve as many puzzles as you can, before time runs out! You have... | Read more »
Sky Patrol (Games)
Sky Patrol 1.0.1 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0.1 (iTunes) Description: 'Strategic Twist On The Classic Shooter Genre' - Indie Game Mag... | Read more »
The Princess Bride - The Official Game...
The Princess Bride - The Official Game 1.1 Device: iOS Universal Category: Games Price: $3.99, Version: 1.1 (iTunes) Description: An epic game based on the beloved classic movie? Inconceivable! Play the world of The Princess Bride... | Read more »
Frozen Synapse (Games)
Frozen Synapse 1.0 Device: iOS iPhone Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: Frozen Synapse is a multi-award-winning tactical game. (Full cross-play with desktop and tablet versions) 9/10 Edge 9/10 Eurogamer... | Read more »
Space Marshals (Games)
Space Marshals 1.0.1 Device: iOS Universal Category: Games Price: $4.99, Version: 1.0.1 (iTunes) Description: ### IMPORTANT ### Please note that iPhone 4 is not supported. Space Marshals is a Sci-fi Wild West adventure taking place... | Read more »
Battle Slimes (Games)
Battle Slimes 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: BATTLE SLIMES is a fun local multiplayer game. Control speedy & bouncy slime blobs as you compete with friends and family.... | Read more »
Spectrum - 3D Avenue (Games)
Spectrum - 3D Avenue 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: "Spectrum is a pretty cool take on twitchy/reaction-based gameplay with enough complexity and style to stand out from the... | Read more »
Drop Wizard (Games)
Drop Wizard 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Bring back the joy of arcade games! Drop Wizard is an action arcade game where you play as Teo, a wizard on a quest to save his... | Read more »

Price Scanner via MacPrices.net

Apple’s M4 Mac minis on sale for record-low p...
B&H Photo has M4 and M4 Pro Mac minis in stock and on sale right now for up to $150 off Apple’s MSRP, each including free 1-2 day shipping to most US addresses. Prices start at only $469: – M4... Read more
Deal Alert! Mac Studio with M4 Max CPU on sal...
B&H Photo has the standard-configuration Mac Studio model with Apple’s M4 Max CPU in stock today and on sale for $300 off MSRP, now $1699 (10-Core CPU and 32GB RAM/512GB SSD). B&H also... Read more

Jobs Board

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