smartquin 1 Posted November 26, 2012 Report Share Posted November 26, 2012 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 lineschtasks /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? 1 Quote Link to post Share on other sites
VaultBoss 310 Posted November 26, 2012 Report Share Posted November 26, 2012 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... 1 Quote Link to post Share on other sites
smartquin 1 Posted November 27, 2012 Author Report Share Posted November 27, 2012 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? Quote Link to post Share on other sites
VaultBoss 310 Posted November 27, 2012 Report Share Posted November 27, 2012 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. Quote Link to post Share on other sites
smartquin 1 Posted November 27, 2012 Author Report Share Posted November 27, 2012 Thats ok, I have it working already with Auto It as it has to grab the info for a remote server, I just wanted to make it simpler for people when I sell it. Thanks anyway. Quote Link to post Share on other sites
rumen 3 Posted November 27, 2012 Report Share Posted November 27, 2012 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 Quote Link to post Share on other sites
Kreatus (Ubot Ninja) 422 Posted March 17, 2014 Report Share Posted March 17, 2014 Someone posted a free scheduling source code before. I just cant find that thread. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.