3 ruby scripts 2010-08-09 09:06 pm Here are 3 ruby scripts.########################################=beginFile name isreadfromfile.rbselect a staff and run this scriptand select a file from promptthen this will replace the staff with the file contentcurrent directory isC:\Program Files\Noteworthy Software\NoteWorthy Composer 2Config directory isC:\Documents and Settings\Administrator\Local Settings\Application Data\Noteworthy Software\nwc2\Configadd the following command line into Config fileRuby Read from file=ruby.exe scripts\readfromfile.rb <PROMPT:Enter input file name:=|file1.xml|file2.xml>=endifile = "temp/" + $*[0] # $* is arguments#ifile = "test.xml"#ofile = "test9test.xml"xml = open(ifile).read#ofile = File.new(ofile, "w")#ofile.print ifile#ofile.closeprint xmlexit 0########################################=beginFile name isdump2file.rbselect a staff and run this scriptand select a file from promptthen this will dump the staff into the filecurrent directory isC:\Program Files\Noteworthy Software\NoteWorthy Composer 2Config directory isC:\Documents and Settings\Administrator\Local Settings\Application Data\Noteworthy Software\nwc2\Configexit 99 -- mini windowexit 0 -- nwc score editoradd the following command line into Config fileRuby Dump 2 File=ruby.exe scripts\dump2file.rb <PROMPT:Enter output file name:=|file1.xml|file2.xml>=endofile = "temp/" + $*[0] # $* is argumentsofile = File.new(ofile, "w")STDIN.read.split("\n").each do |a| ofile.print a + "\n"endofile.closeexit 0#################################=beginFile name isstdinprint.rbselect a staff and run this scriptthen this will dump it into mini windowcurrent directory isC:\Program Files\Noteworthy Software\NoteWorthy Composer 2Config directory isC:\Documents and Settings\Administrator\Local Settings\Application Data\Noteworthy Software\nwc2\Configwithout "exit" or with exit 0, output will replace the selection insertion(no selection) point will repace all starveswith "exit 99", output will be displayed in the mini windowadd the following command line into Config fileRuby STDIN Print=ruby.exe scripts\stdinprint.rb=endprint "This is a text"STDIN.read.split("\n").each do |a| print aendexit 99 #Standard output#exit 0 #nwc score output Quote Selected Last Edit: 2010-08-10 11:44 am by notebyruby