Bootnow and running scripts

User discussion and information resource forum for BootIt Bare Metal.

Bootnow and running scripts

Postby WillASM » Tue Jan 17, 2012 3:01 pm

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!!!
WillASM
 
Posts: 4
Joined: Sat Dec 03, 2011 7:50 am

Re: Bootnow and running scripts

Postby TeraByte Support(PP) » Tue Jan 17, 2012 6:18 pm

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
Paul Purviance
TeraByte Support
TeraByte Support(PP)
 
Posts: 1108
Joined: Thu Aug 11, 2011 5:51 pm

Re: Bootnow and running scripts

Postby WillASM » Wed Jan 18, 2012 3:11 am

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! ;)
WillASM
 
Posts: 4
Joined: Sat Dec 03, 2011 7:50 am

Re: Bootnow and running scripts

Postby DrTeeth » Thu Jan 19, 2012 1:34 pm

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).
DrTeeth
 
Posts: 970
Joined: Fri Aug 12, 2011 11:58 am

Re: Bootnow and running scripts

Postby WillASM » Thu Jan 19, 2012 3:34 pm

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!!!
WillASM
 
Posts: 4
Joined: Sat Dec 03, 2011 7:50 am

Re: Bootnow and running scripts

Postby Brian K » Tue Jan 24, 2012 11:21 pm

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.
Brian K
 
Posts: 1181
Joined: Thu Aug 11, 2011 6:11 pm

Re: Bootnow and running scripts

Postby WillASM » Wed Jan 25, 2012 2:54 pm

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.
WillASM
 
Posts: 4
Joined: Sat Dec 03, 2011 7:50 am

Re: Bootnow and running scripts

Postby Brian K » Wed Jan 25, 2012 7:40 pm

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.
Brian K
 
Posts: 1181
Joined: Thu Aug 11, 2011 6:11 pm

Re: Bootnow and running scripts

Postby TeraByte Support(PP) » Wed Jan 25, 2012 7:58 pm

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?
Paul Purviance
TeraByte Support
TeraByte Support(PP)
 
Posts: 1108
Joined: Thu Aug 11, 2011 5:51 pm

Re: Bootnow and running scripts

Postby Brian K » Wed Jan 25, 2012 8:09 pm

TeraByte Support(PP) wrote:Were you trying to do something specific?


No, nothing specific. I was just trying to understand your scripts.

Thanks Paul.
Brian K
 
Posts: 1181
Joined: Thu Aug 11, 2011 6:11 pm

Next

Return to BootIt Bare Metal