Script
Jump to navigation
Jump to search
Contents
windows for - do - done script, goes through every line and issues command for each
FOR /F %%i IN (hapi.txt) DO echo print|nsradmin -p390113 -i - -s %%i
unix script do - done
bash-2.05# cat list_clients.sh for line in `cat list_of_clients.txt` do echo print|nsradmin -p390113 -i - -s $line done
networker list clients and versions - perl
#!/usr/bin/perl
use strict;
use warnings;
use IPC::Open2;
my $nsradmin = '/usr/bin/nsradmin';
my ($rdr, $wtr);
my $pid = open2($rdr, $wtr, $nsradmin, '-i', '-');
print $wtr "show name\n";
print $wtr "show networker version\n";
print $wtr "print type:nsr client\n";
close $wtr;
my $client;
while(<$rdr>)
{
chomp;
if (s/\\$//) # ends in backslash
{
$_ .= <$rdr>;
chomp;
redo;
}
if (/name\:\s*(.*);/) { $client = $1; next; }
if (/version\:\s*(.*);/) { print "$client,$1\n"; }
}
blender script that does ?
#!BPY
#"""
#Name: 'script name here 3'
#Blender: 245
#Group: 'Wizards'
#Toltip: 'your toltip here'
#"""
__author__ = 'Your Name Here'
__version__ = 'script version here 3'
__url__ = ['your site her, http://you.site.here', 'blender', 'elysiun']
__bpydoc__ = """\
The documentation her please
Make it if you want to release this script on the internet"""
import Blender #import the blender module so tha we can use Blender.*
GUI = True #Toggle Gui
FILE = "c:/numba.txt" #path to the file (must exists)
OBJECT = 'Cube' #the object to chance scale on
def ReadFile():
try:
f = open(FILE, "r") #first we try to open the file
except: #if the file did not open
print "Open file failed"
raise #raise the error again to stop the script
else:
try: #then we try to load the data
x = float(f.readline())
y = float(f.readline())
z = float(f.readline())
except: #If tha data in the file did not follow the strict syntax
print 'Data corrupt'
raise #stopping the script
finally:
f.close() #always remember to close the file when done
return x, y, z
def update():
obj = Blender.Object.Get(OBJECT) #get our object so that we can edit them
x, y, z = ReadFile() #get the size from the file
#set our object scale
obj.SizeX = x
obj.SizeY = y
obj.SizeZ = z
Blender.Redraw()
def main():
time = Blender.sys.time()
update() #So that we can know if any newly implented
print 'script tok:', Blender.sys.time() - time, 'seconds' #features are speedbumps
def button_event(evt): #button event
if evt == 1:
main()
def event(evt, val): #key event
if evt == Blender.Draw.ESCKEY:
Blender.Draw.Exit()
def gui(): #drfawing of buttons
button = Blender.Draw.PushButton('update',1, 10, 10, 200, 50, 'update Object')
if __name__ == "__main__":
if GUI == True:
while True:
gui() # to avoid the Draw, error, redraw, error loop
Blender.Draw.Register(gui, event, button_event) #registring gui, event, and button event
sleep(1)
else:
main()