Page 1 of 2

Bootnow and running scripts

Posted: Tue Jan 17, 2012 10:01 pm
by WillASM
I finally got around to updating from NG to BM and am really happy with the new version!
I do miss the Image Sets, but have figured out how to set up scripts to automate my
backups and that works great. The only thing I really would like to be able to do is pass
some parameters to my scripts with Bootnow using the /run=filename.tbs command.

Would it be possible to add that to a future version of Bootnow? The ability to pass
parameters to a script from Bootnow would open up a lot of options for me as far as
writing scripts goes for sure...

Thanks again for the new version!!!

Re: Bootnow and running scripts

Posted: Wed Jan 18, 2012 1:18 am
by TeraByte Support(PP)
If you don't mind doing a little scripting, you could use TBOSDT to pass the parameters in a file and then read the file to get the parameters.

For example, this script will write the parameters sent to it to a file named PARAMS.TXT in the BIBM partition:
setparms.tbs

Code: Select all

sub main()
	// set locking
	ext("set option locking 1")
	
	// mount BIBM partition (use correct ID)
	ext("open fs 0: 0 0x80") 

	// open parameters file
	f=open("0:\PARAMS.TXT", "in-out-trunc")

	// output script parameters
	for i = 1 to argc()
		writel(f,arg(i))
	next
	
	// close file
	close(f)
	
	// unmount BIBM partition
	ext("close 0:")
	
end sub
This script will read the PARAMS.TXT file and display the parameters:
getparms.tbs

Code: Select all

sub main()
	// mount BIBM partition (use correct ID)
	ext("open fs 0: 0 0x80") 

	// open parameters file
	f=open("0:\PARAMS.TXT", "in-out")

	// read parameters
	s=readl(f)
	while s<>""
		if right(s,1)="^n" then 
			s=left(s,len(s)-1)
		end if
		printl(s)
		s=readl(f)
	wend	
	
	// close file
	close(f)
	
	// unmount BIBM partition
	ext("close 0:")
	
end sub
You could then create a batch file in Windows that runs with the desired parameters:

Code: Select all

"C:\Program Files (x86)\TeraByte Unlimited\TeraByte OSD Tool Suite Pro\win\tbosdtw.exe" c:\scripts\setparms.tbs prm1 prm2 parm3
C:\bootnow\bootnow.exe 1/run=getparms.tbs

Re: Bootnow and running scripts

Posted: Wed Jan 18, 2012 10:11 am
by WillASM
Very clever solution! I thought something like this might be possible while looking through the pdf for TBOSDT.
The example scripts you provided make this look much easier to accomplish than I thought it would be.
I will try this out and let you know how it goes...

Thank you for the example scripts! ;)

Re: Bootnow and running scripts

Posted: Thu Jan 19, 2012 8:34 pm
by DrTeeth
On Tue, 17 Jan 2012 17:18:37 PST, just as I was about to take a herb,
TeraByte Support(PP) disturbed my reverie and wrote:

>If you don't mind doing a little scripting,

There was talk so time back of TB making a wizard interface to help
build scripts. I assume that this is no longer planned.
--

Cheers

DrT
______________________________
We may not be able to prevent the stormy times in
our lives; but we can always choose to dance
in the puddles (Jewish proverb).

Re: Bootnow and running scripts

Posted: Thu Jan 19, 2012 10:34 pm
by WillASM
Just wanted to let you know that the scripts work perfectly for what I needed, Thanks again..
WillASM

DrTeeth wrote:On Tue, 17 Jan 2012 17:18:37 PST, just as I was about to take a herb,
TeraByte Support(PP) disturbed my reverie and wrote:

>If you don't mind doing a little scripting,

There was talk so time back of TB making a wizard interface to help
build scripts. I assume that this is no longer planned.
--

Cheers

DrT
______________________________
We may not be able to prevent the stormy times in
our lives; but we can always choose to dance
in the puddles (Jewish proverb).
This indeed would be very useful!!!

Re: Bootnow and running scripts

Posted: Wed Jan 25, 2012 6:21 am
by Brian K
Paul,

I just returned from holidays and I'm stumped by the first script. How do you use the first script? I just get an empty params.txt in the BIBM partition.

Re: Bootnow and running scripts

Posted: Wed Jan 25, 2012 9:54 pm
by WillASM
Brian K wrote:Paul,

I just returned from holidays and I'm stumped by the first script. How do you use the first script? I just get an empty params.txt in the BIBM partition.

First thing is are you setting the correct ID for the BIBM partition?

// mount BIBM partition (use correct ID)
ext("open fs 0: 0 0x80")

Second are you actually sending parameters to the script when running it.

"C:\Program Files (x86)\TeraByte Unlimited\TeraByte OSD Tool Suite Pro\win\tbosdtw.exe" c:\scripts\setparms.tbs prm1 prm2 parm3

The scripts work fine for me, hope you sort it out.

Re: Bootnow and running scripts

Posted: Thu Jan 26, 2012 2:40 am
by Brian K
WillASM wrote: Second are you actually sending parameters to the script when running it.
No I wasn't. Thanks. I can now see
/uy
/rb:4

in params.txt. Is that correct?

I assume the first script is setparms.tbs and the second is getparms.tbs

I'm confused as to what C:\bootnow\bootnow.exe 1/run=getparms.tbs actually does.

Re: Bootnow and running scripts

Posted: Thu Jan 26, 2012 2:58 am
by TeraByte Support(PP)
Brian,

You're correct, the first one is "setparms.tbs" and the second one is "getparms.tbs". I intended to name them, but it got missed when I posted it.

The getparms script does nothing really. It's just sample code of how to read the PARAMS.TXT file. In this case, it reads the file and prints the contents, which are the parameters that were saved in it.

You would just use the code where needed (e.g. in your custom scripts) to access the parameters that were passed. Then your script can do what it needs to depending on them. For example, if you had a custombackupscript.tbs that you wanted to run via BootNow using parameters, you would place the getparms code into your custombackupscript.tbs file (modified as required) to access them. Your custom script would be run from Winodws using BootNow (bootnow.exe 1/run=custombackupscript.tbs) after you ran setparms to set the parameters.

Were you trying to do something specific?

Re: Bootnow and running scripts

Posted: Thu Jan 26, 2012 3:09 am
by Brian K
TeraByte Support(PP) wrote: Were you trying to do something specific?
No, nothing specific. I was just trying to understand your scripts.

Thanks Paul.