#Purpose to exctract all currently opened pages from an Opera session on Win 7
# and save them onto the Desktop as text and html file
use strict ;
use Tie::File ;
use Win32 ;
our $sessionFile = "C:/Users/userName/AppData/Roaming/Opera/Opera/sessions/autosave.win" ;
our $outputFile = "C:/Users/userName/Desktop/Addresses.txt" ;
our ($fileString , @addresses , @out ) = ();
our $outputPage = "C:/Users/userName/Desktop/Links.html" ;
#Action
main() ;
sub main
{
parseFile() ;
showAddresses();
`$outputFile` ;
`cmd /c start /max Opera "file://localhost/$outputPage"` ;
}
sub parseFile
{
{
local( $/, *FILE ) ;
open (FILE , $sessionFile ) or
die "Cannot find $sessionFile !!! " ;
$fileString =
close FILE ;
# $fileString =~ s/((http.*?)\n)+/\$1/ig;
@addresses = ($fileString =~ /(http.*?)\n/gi); # matches,
#copy paste
#http://www.ayni.com/perldoc/perl5.8.0/pod/perlfaq4.html#How-can-I-remove-duplicate-elements-from-a-list-or-array-
my $prev = "not equal to $addresses[0]";
@out = grep($_ ne $prev && ($prev = $_, 1), @addresses);
}
} #eof parseFile
sub showAddresses
{
open (FH , ">$outputFile") or
die "cannot open $outputFile !!! " ;
foreach (@out )
{
chomp ;
print FH "$_" . "\n" ;
}
close FH ;
open (F , ">$outputPage") or
die "cannot open $outputPage!!! " ;
print F "
\n"
}
1 ;
__END__
download from here
No comments:
Post a Comment
- the first minus - Comments have to be moderated because of the spammers
- the second minus - I am very lazy at moderating comments ... hardly find time ...
- the third minus - Short links are no good for security ...
- The REAL PLUS : Any critic and positive feedback is better than none, so your comments will be published sooner or later !!!!