Monday, November 20, 2017

#1 2015-05-06 11:40:24 am

artphotodude
Member
Registered: 2012-10-15
Posts: 45

RETRO - Applescript just completed for you OS9 enthusiasts!

After the recent completion of http://macscripter.net/viewtopic.php?id=43892, seriously thought about how viable it was to still be keeping all my music, movies and such compatible with Mac OS9 (yep, pretty hopeless, I know) tongue

But the good folks at TenFourFox ( http://www.floodgap.com/software/tenfourfox/ ) updated Classilla ( http://www.floodgap.com/software/classilla/ ), their browser for OS9 and after a year of OSX scripting, enjoyed a day of going back to the 16-bit window trim and Ridiculous Zippiness that OS9 still offers - seriously, if an android pad ever came out running real OS9, I'd be all over that stuff!!  That was the system for $40,000+ drum-scanners, film-recorders and essentially: "Mac for Productivity", rather than the Yuppie-Bling it has become now  (in service to the great iTunes Cash-Register-Overlord in the sky)!

So back to the issue of OS9 media compatibility:  The biggest thing missing, is the availability of a decent video-playback environment, like VLC/XBMC.  QuickTime 6 (lack of H.264 not withstanding) is still pretty spry and even offers really nice playback support for Flash/SWF animation files with sound.

As it turns out, some of the code from the app above was able to compress to Applescript 1.8.3 and here with now have QT Theatré http://macintoshgarden.org/apps/qt-thea … ack-in-os9

It allows for selecting folders of QT-compatible videos and then plays them either alphabetically or randomly based on a button selection.  The multi-segmented video playback module from PPC Media Center above worked with just a few changes. An actual positive change is that since the videos are not streaming, but instead already saved, it can contrast each movies "Current Time" vs "Duration" values and uses that info to close each movie once it is done and opens the next.  This is nice when one 'Pauses' a video, as it will happily resume and then close/open the next just like say VLC does today.

The random function is the real showpiece though.  Quality randomness is, of course, not random at all but instead "random of the unplayed-choices remaining":  because with straight random, you sometime get the same video playing twice/three times in a row.  So, the list movieList, that comes from the directory chosen, gets copied over to  newMovieList in total (minus the video just played) and then movieList gets set to newMovieList each repeat/playback.  Works very well.

The only problem is simply stopping the script.  The only thing that works is to force-quit, but this actually wasn't too bad in use, as the current video just needs to get paused, then "Command-Tab" over and force-quit.

After this little project, it becomes very CLEAR just how much Shell Scripting has added to Applescript. Sometimes We Have to See Where We've BEEN, to Appreciate Where We ARE!

Applescript:


----
-- "QT Theatré" for QuickTime Player 6.0.3 (Mac OS 9.2.2). Written by Adam Albrec (game_creator@hotmail.com)
----

-- Prevents timeout during operation.
with timeout of 86400 seconds
   
   -- Prompts user to select directory of QuickTime documents.
   set moviePath to (choose folder with prompt " *** Select Folder & Click CHOOSE ***") as alias
   tell application "Finder" to set movieList to every file of moviePath as list
   set n to the number of items of movieList
   
   -- Prompts user for normal or random playback.
   display dialog " Select Playback Mode" buttons {"Normal", "Random", "Cancel"}
   if result = {button returned:"Normal"} then
       
       -- Normal playback Mode.
       set mvNmbr to "1" as number
       repeat n times
           tell application "QuickTime Player"
               open item mvNmbr of movieList
               set ttlChck to the name of item mvNmbr of movieList
               try
                   repeat
                       tell application "QuickTime Player"
                           set currentTime to (current time of movie ttlChck)
                           set durationTime to (duration of movie ttlChck)
                       end tell
                       delay 0.5
                       if currentTime is durationTime then
                           tell application "QuickTime Player"
                               close movie ttlChck
                           end tell
                           exit repeat
                       end if
                   end repeat
               end try
               set mvNmbr to mvNmbr + 1
           end tell
       end repeat
       
   else
       
       -- Random playback mode.
       repeat n times
           tell application "Finder" to set rndmVid to some item of movieList
           tell application "QuickTime Player"
               open rndmVid
               set ttlChck to the name of rndmVid
               try
                   repeat
                       tell application "QuickTime Player"
                           set currentTime to (current time of movie ttlChck)
                           set durationTime to (duration of movie ttlChck)
                       end tell
                       if currentTime is durationTime then
                           tell application "QuickTime Player"
                               close movie ttlChck
                           end tell
                           exit repeat
                       end if
                       delay 0.5
                   end repeat
               end try
           end tell
           set newMovieList to {}
           set x to "1"
           set y to the number of items of movieList
           repeat y times
               if item x of movieList is not rndmVid then
                   set newMovieList's end to item x of movieList
               end if
               set x to x + "1"
           end repeat
           set movieList to newMovieList
       end repeat
       
       -- End of script.
   end if
end timeout

Model: MDD G4 DP 1.42 GHz
AppleScript: 1.8.3
Browser: Classilla 9.3.3
Operating System: Mac OS 9.2.x

Last edited by artphotodude (2015-05-07 03:01:04 pm)

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)