<pre>
package getAdd ;
#Purpose to exctract all currently opened pages from an Opera session on Windows XP
#save them in Addresses.txt on the Desktop and Links
use strict ;
use Tie::File ;
use Win32 ;
our $sessionFile = "C:/Documents and Settings/$ENV{USERNAME}/Application Data/Opera/Opera/profile/sessions/autosave.win" ;
our $outputFile = "C:/Documents and Settings/$ENV{USERNAME}/Desktop/Addresses.txt" ;
our ($fileString , @addresses , @out ) = ();
our $outputPage = "C:/Documents and Settings/$ENV{USERNAME}/Desktop/Links.html" ;
#Action
main() ;
sub main
{
parseFile() ;
showAddresses();
`$outputFile`
}
sub parseFile
{
{
local( $/, *FILE ) ;
open (FILE , $sessionFile ) or
die "Cannot find $sessionFile !!! " ;
$fileString = <FILE>; #slurp the whole file into one string !!!
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 "
<html>
<head>
<title>Links</title>
</head>
<body>
<div>" ;
foreach (@out )
{ chomp ;
print F "<a href=\"$_\">$_</a><br/>" ;
}
print F "
</div>
</body>
</html> \n"
}
1 ;
__END__
</pre>
Getting the Current TabItem when the Tab is not selected in WPF
-
[image: Banner]
This is a quick reminder to self on how to retrieve a TabItem from a WPF
TabControl *when the tab is not currently selected* because I ru...
1 week ago
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 !!!!