Stupid Mac::Glue Tricks: Safari Slideshow
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/Safari.app.
I put an alias to the script in my Safari scripts folder so I can access it through Script Menu.
Of course, requires updating your glue file to Safari 3, if you've not done so. Just re-run sudo gluemac
I put an alias to the script in my Safari scripts folder so I can access it through Script Menu.
#!/usr/bin/perl
use warnings;
use strict;
our $sleep_time = 7;
use Mac::Glue;
my $safari = new Mac::Glue 'Safari';
$safari->activate;
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;
}
Leave a comment