Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

pudge (1)

  (email not shown publicly)
AOL IM: Crimethnk (Add Buddy, Send Message)

I run this joint, see?

Journal of pudge (1)

Tuesday September 11, 2007
11:34 AM

Stupid Mac::Glue Tricks: Safari Slideshow

[ #34419 ]

Safari 3 has greater scripting abilities. This script will allow a user to use the frontmost window, full of tabs, as a basic slideshow. It will start at the current tab (unless the current tab is the last tab, in which case it will start with the first tab) and pause 7 seconds on each before moving on to the next. If you switch the tabs in between, the script will pick up from where you are now, not where you left off.

Of course, requires updating your glue file to Safari 3, if you've not done so. Just re-run sudo gluemac /Applications/

I put an alias to the script in my Safari scripts folder so I can access it through Script Menu.

use warnings;
use strict;
our $sleep_time = 7;
use Mac::Glue;
my $safari = new Mac::Glue 'Safari';
my $window    = $safari->obj(window => 1);
my $tab_count = $window->count(each => 'tabs');
my $current = $window->prop('current tab');
my $index   = $current->prop('index');
sleep $sleep_time;
my $i = 0;
until ($i >= $tab_count) {
    $i = $index->get;
    $i = 0 if $i >= $tab_count;
    $current->set(to => $window->obj(tab => ++$i));
    sleep $sleep_time;

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.