#COMMAND GENERATOR
#How this works ?!
#C:\Documents and Settings\$userName\Desktop\CopyPaste.ysg #change file name if you want
# copy paste from the portal one row containing workstations into the first line of this file
#run the command perl exctract.pl on the folder where the perl script is . ENJOY
#OR GENERATE A STANDALONE EXECUTABLE WITH PERL2EXE OR PP
use Tie::File;
use strict ;
our $userName = $ENV{USERNAME} ;
my $file = "C:\\Documents and Settings\\$userName\\Desktop\\CopyPaste.ysg" ;
my $ini_file = "C:\\Documents and Settings\\$userName\\Desktop\\exctract.ini" ;
my $row;
my @clean_list = ();
my $pathToRemDir='C:\\Documents and Settings\\All Users\\Application Data\\Symantec\\pcAnywhere\\Remotes\\' ;
my $pathToCqfDir='C:\\Documents and Settings\\All Users\\Application Data\\Symantec\\pcAnywhere\\Command Queues\\' ;
my $extension1='.CHF';
my $extension2='.cqf';
# READ ALL ROWS TO LIST
my @array = () ;
tie @array, 'Tie::File', $file or die "Cannot tie the $file" ;
print $array[0] , "\n\n\n" ;
my @list = split ('\s' ,$array[0] ) ;
foreach (@list )
{
$_=~ s/^s*(.*?)s*$/$1/; #Trim leading and trailing whitespace from $mystring
if ($_ =~ m/^$/)
{ #debug print "empty element" ;
#debug sleep 2 ;
next ;
}
else
{
push( @clean_list , $_ ) ;
}
}
@list = @clean_list ;
my $found = 0 ;
my $c = 0 ;
foreach (@array)
{
if ($_=~m/^end$/i) #find the end string
{ $found = 1; #set the flag to found
#debug print "found is $found , default is $_ \n " ;
@array=@array[0..$c]; #slice the array
push @array , "\n\n" ; #add 2 lines
}
$c ++ ;
} #eof foreach
tie my @ini_array, 'Tie::File', $ini_file or die "Cannot tie the $file" ;
foreach my $command (@ini_array )
{
unless ($command =~ /AGENT/gi)
{ push @array , $command ;
next ;
}
foreach my $agent (@list )
{
print "my \$agent is $agent \n " ;
my $tmp = $command ;
$tmp =~ s/AGENT/$agent/ ; #replace it once
push @array , $tmp;
} #eof foreach my $agent (@list )
push @array , "\n" ; #add one ine (one is added automatically )
} #foreach my $command (@ini_array )
untie @ini_array;
untie @array ;
`$file` ; #open the file ;
#EXAMPLE INI FILE - PLACE ON DESKTOP
#THE SYNTAX IS start /min "AGENT" cmd /c srp AGENT cmd /c
#CAUSES THE COMMAND TO START IN A SEPARATE WINDOW TITLED WITH THE WORKSTATION NAME
#ALSO THE WINDOW IS STARTED MINIMIZED AND THE NEXT ONE STARTS IMMIDIATELY
#MY WINDOWS xp CRASHED AT THE 150ths so ... take care
#cmd /c shutdown.exe -f -r -m \\AGENT
sub changeSomeSettings
##start /min "AGENT" cmd /c srp AGENT cmd /c changeSomeSettingFromCommandLine.exe SETTING_NAME SETTING_VALUE
sub moveFilesFromOnePlaceToAnother
#start /min "AGENT" cmd /c srp AGENT cmd /c move
C:/some/files/from/some/folder/*.files C:/tosome/some/other/folder/*.files
#TIP use the funcJumbe
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 !!!!