Dec 31, '09 07:30:00AM • Contributed by: titaniumtroop
Opera stores information about Speed Dial links in a text file located at ~/Library » Preferences » Opera Preferences » speeddial.ini. This script closes Opera and changes the date in the URL in the speeddial.ini file.
NOTE: This script uses killall to close Opera, since cron will not properly execute AppleScript. Use care on a multiuser computer.
#!/usr/bin/perl -w
use strict;
my $homedir = $ENV{ HOME };
open(SPEEDREAD, "<$homedir/Library/Preferences/Opera\ Preferences/speeddial.ini") || die "Couldn't open speeddial.ini file.\n";
my $filedump = '';
if (`ps -ax | grep "Opera"` =~ /Applications\/Opera/) {
`killall 'Opera'`;
}
while(<SPEEDREAD>) {
my $line = $_;
if ($line =~ m/Url=http:\/\/www.wunderground.com\/history\/airport\/(\w+)\/\d+?\/\d+?\/\d+?\/MonthlyHistory.html/) {
my $airport = $1;
(my $year, my $month, my $day) = split(',',`date "+%Y,%m,%d"`);
chomp $day;
print "DATE:\t$year-$month-$day\n";
$filedump .= "Url=http:\/\/www.wunderground.com\/history\/airport\/$airport/$year/$month/$day/MonthlyHistory.html\n";
}
else {
$filedump .= $line;
}
}
close(SPEEDREAD);
open(SPEEDWRITE, ">$homedir/Library/Preferences/Opera\ Preferences/speeddial.ini");
print SPEEDWRITE $filedump;
close(SPEEDWRITE);