Hi folks,

A bit off topic this one, I'm afraid (sorry Tab), but I am no longer able to send 
messages to DirectL for some reason.

I got a request from a friend about getting media out of an old projector. She had 
lost the original files (etc. etc.). Now, we all know there are tools out there to get 
the media out of a protected movie, or a dcr, but projectors are a bit more tricky. On 
Windows, I think one is out of luck, but on Mac, there is a workable solution.

Luckily, all projectors going back to D4 (and possibly before) respond to the 
'miscellaneous do script' apple event. At one time, this event had proper 
'terminology' which meant you could open any applescript editor and fire off something 
like this;

tell application "Director 5"
  activate
  do script "set the stageColor to random(255)" 
end tell

'do script' behaves exactly like 'do' in lingo, with all the quirks associated with 
that. (Delay for compilation, scope issues etc.)

All well and good, until D7, where the 'do script' terminology disappeared, although 
the apple event remains, and is accessible with the 'raw apple event code' <<misc 
dosc>>. 

Note: I've typed the chevrons with doubled greater-than and less-than signs but you 
should use option-H and shift-option-H to get the proper chevron characters. (This is 
an endless headache on Applescript mailing lists and newsgroups of course).

So, I've knocked up this little Applescript which will dump all the cast libs from any 
projector (using 'save castlib') in the folder of your choice. The casts will be named 
"c1.cst", "c2.cst" etc. In my tests, it seems to be working fine, but let me know if 
you come up against any unpleasantness.

This script is for educational and emergency use only and is in NO WAY intended to 
help folks steal other people's pics and sounds and what not. If you think I'm being 
irresponsible in releasing this information, I'll admit that this technique is open to 
abuse, but only by losers. If you want to do that kind of stuff, you're not just 
foolish, you're also a bit of a loser, I reckon. Script text is (as everyone should 
know) not available through these kinds of hacks, so don't even think about it. 

Besides, I believe there's much to be learned by opening up other people's movies and 
projectors, and seeing how they are put together, and it's also worth being aware of 
the technique if you really want your projector to be protected in some extra special 
way. 

I've used old style 'verbose' lingo syntax so that you can use the script with old 
projectors. I've been testing with D6.5 projectors, but it ought to work at least as 
far back as D4. (Not sure when 'save castlib' appeared though).

I hope the code doesn't get truncated by email linebreaks too much. The toughest thing 
about writing this script was mixing the Lingo and Applescript escape sequences for 
quote marks. Nearly went mad!

Once again, don't forget to adjust the chevrons before compiling the script in your 
favourite applescript editor. 
Enjoy:


on run
    
    set prmpt to "Please locate your projector"
    set f to (choose file with prompt prmpt)
    
    set i to (info for f)
    
    -- cursory check to see whether it's an application...
    if file type of i is not "APPL" then 
        my abortWithAlert("Not an application file")
    end if
    
    -- choose where to output the castlibs
    set out to (choose folder with prompt "Output castlibs to...")
    set out to out as string
    
    -- build the hack lingo handler
    set hndlr to "on hak\"&return&\"  tell the stage\"&return&\""
    set hndlr to hndlr & "    set n to the number of castlibs\"&return&\" "
    set hndlr to hndlr & "   repeat with c = 1 to n\"&return&\"      save castlib c, "
    set hndlr to hndlr & "\"&quote&\"" & out & "c\"&quote&\" & c & 
\"&quote&\".cst\"&quote&\"\""
    set hndlr to hndlr & "&return&\"    end repeat\"&return&\"  end 
tell\"&return&\"end"
    
    -- write the handler to a new script cast member
    set lingostring to "set the scripttext of member (new(#script)) to \"" & hndlr & 
"\""
    -- call it...
    set lingostring to lingostring & return & "hak()"
    
    -- ok, now we're ready to actually do it...
    tell application (f as string)
        activate
        <<event miscdosc>> "Alert \"Ready to export castlibs to " & outFold & "\""
        <<event miscdosc>> lingostring
        <<event miscdosc>> "halt" -- optional
    end tell
    
    
end run

on abortWithAlert(str)
    beep
    display dialog str buttons {"Rats"} default button 1 giving up after 10
    error number -128 -- abort entire script
end abortWithAlert


[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email 
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for 
learning and helping with programming Lingo.  Thanks!]

Reply via email to