Jump to content
UBot Underground

Scheduling, Command Line and Passing Variables


Recommended Posts

Hi Guys

 

I wonder if this feature is included at all: I'm writintg a script that needs to get a variable from the user before it does its tasks. At the moment, I'm using an Auto It script called form a batch file. It is setup in task scheduler automatically, and runs once only to post to blogs etc. however it needs to grab a variable to get the right photos/text etc. Is there a way of calling the bot from a task scheduler task in windows and pass a variable to it (eg: Enter this in the command line

schtasks /create /tn "blogpostcombination1234" /tr "C:\bot.bat" /sc once /st 17:35:49 /sd 11/27/2012 /ru User /rp pass

 

The bat file looks like this:

 

 

bot.exe /play blogpostcombination1234

)

 

Any ideas?

  • Like 1
Link to post
Share on other sites

To pass a parameter to a batch file, you need to call the batch file with the parameter value at the end of the command, separated by a space from the .bat file name itself.

From within your ubot, like this:

 

shell("CMD.exe /C \"\"C:\\Program Files\\MyAwesomeBAT.bat\" \"{#var_Variable_Parameter_To_Pass_To_Bat_File}\"")

 

Inside your .bat file, the passed value is accessed with %1

 

To pass 2 variables, separate them with a space in the command line and get the second variable's value in the .bat file with %2

... and so forth...

 

Notice that you HAVE to enclose the command you pass to SHELL with double quotes (and remember to escape them properly if you code directly in Code View) in order to be able to pass parameters.

 

That's the basics - you will need to adapt it to your needs, of course.

 

HTH...

  • Like 1
Link to post
Share on other sites

Thanks VaultBoss, but what I'm after is a batch file that runs a bot and passes a variable to the bot itself. As far as I can tell, the only command line parameters to can send to a bot are /play and /auto. Can you send a variable to the bot via the command line?

Link to post
Share on other sites

No, you are right, you can't directly...

 

All you can do is think outside the box: let the variable be a file that your bot reads when launched.

Make sure to change the file accordingly, prior to launching the bot.

Link to post
Share on other sites

Make bot read variables from txt file in appl dir.With bat file 1.write txt file to appl dir with vars needed . Next pass command line with /auto only.

Good luck

Link to post
Share on other sites
  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...