Kev 69 Posted January 24, 2014 Report Share Posted January 24, 2014 Hi all, Ok if you haven't read the first tutorial then here it is: http://www.ubotstudio.com/forum/index.php?/topic/15245-run-ubot-software-on-iphones-step-by-step-tutorial/ The next thing I want to mention here is what I think is the next logical step moving away from 24/7 bots to bots on demand. I've made a video doing a macro version of the whole process, with a live running example for you to view. Watch the 2:25 seconds in full screen mode so as you can fully see what's going on. https://www.youtube.com/watch?v=HXici3opx4Y What's happening here? I input data into a form.Form submits to database.Form triggers a folder creationFolder creation triggers batch file to start /autoBot does the work.Bot closes. Viola - bots on demand! 3 Quote Link to post Share on other sites
positivity13 4 Posted January 24, 2014 Report Share Posted January 24, 2014 Wow this is definetly the next step! How do you get it to trigger once the form posts to the database? Quote Link to post Share on other sites
HelloInsomnia 1103 Posted January 24, 2014 Report Share Posted January 24, 2014 Nice one, you just gave me so many ideas! Quote Link to post Share on other sites
Kev 69 Posted January 25, 2014 Author Report Share Posted January 25, 2014 Nice one, you just gave me so many ideas!^^^ He gets it Quote Link to post Share on other sites
WarrenIndLLC 0 Posted January 25, 2014 Report Share Posted January 25, 2014 Yes I would like to know how the database triggers it as well! Last step would be to throw the bot on a VPS and add the VPS's IP address as the wildcard so it runs even if you have your computer off. Probably would have to make some kind of log/error log just in case though! Quote Link to post Share on other sites
Kev 69 Posted January 25, 2014 Author Report Share Posted January 25, 2014 Each person will find their own unique way to use it (just like how I've done) and when you do I'd love for you to share it here so others can learn that method. However, if you're using Jotform then you'll know that there is an integration within the actual form you're using and this will allow you to create a new folder on your VPS or computer even though the jotform is hosted remotely. The local folder creation is important and a requirement. The integration is through Dropbox. If you've followed the steps I mentioned AND are using jotform with Dropbox integration then you'll know that when you submit a form it will create a new folder/file inside your Dropbox (installed on your PC or VPS). The next thing you need to figure out is "how do I know when the folder has been triggered?" and once the folder's created how do I a) start my bot and reset the whole thing so as I can do it all again? There's enough here to get you 95%-100% of the way there. 1 Quote Link to post Share on other sites
Sanjeev 46 Posted January 25, 2014 Report Share Posted January 25, 2014 Task scheduler can trigger tasks on event - can folder creation be set as one such events? Quote Link to post Share on other sites
WarrenIndLLC 0 Posted January 25, 2014 Report Share Posted January 25, 2014 Each person will find their own unique way to use it (just like how I've done) and when you do I'd love for you to share it here so others can learn that method. However, if you're using Jotform then you'll know that there is an integration within the actual form you're using and this will allow you to create a new folder on your VPS or computer even though the jotform is hosted remotely. The local folder creation is important and a requirement. The integration is through Dropbox. If you've followed the steps I mentioned AND are using jotform with Dropbox integration then you'll know that when you submit a form it will create a new folder/file inside your Dropbox (installed on your PC or VPS). The next thing you need to figure out is "how do I know when the folder has been triggered?" and once the folder's created how do I a) start my bot and reset the whole thing so as I can do it all again? There's enough here to get you 95%-100% of the way there. Oh I'm already there. I've got everything set up and it works great... almost. Now I'm not using JotForm or DropBox. But I have already setup my form on my WordPress website that when the customer inputs the info it then gets put in the DB. The bot then pull such info from DB when ran manually like it should and it does it's magic. So I'm just trying to figure out how to start the bot once there's new information/information at all in the DB. Then reset and close when it's finished. So I'm just trying to work that out but I'm somewhat stuck on it for the time being. Any advice would be greatly appreciated. Quote Link to post Share on other sites
Edward_2 85 Posted January 26, 2014 Report Share Posted January 26, 2014 I was thinking their may be an easier way of doing this. When a bot is on a VPS is can import a text file from whereever with a list of variables/jobs, maybe have a hidden webform that can edit these variables. Then the bot will check the file every so often an complete the tasks. Quote Link to post Share on other sites
Kev 69 Posted January 26, 2014 Author Report Share Posted January 26, 2014 I was thinking their may be an easier way of doing this. When a bot is on a VPS is can import a text file from whereever with a list of variables/jobs, maybe have a hidden webform that can edit these variables. Then the bot will check the file every so often an complete the tasks.But now you're bot has to be running 24/7 to check this, right? Quote Link to post Share on other sites
WarrenIndLLC 0 Posted January 26, 2014 Report Share Posted January 26, 2014 Well, what I'm working on is Connecting to the MySQL database (on my server) from the VPS using SQL. I'm reading up to see if I can somehow make a new file when new information is submitted and then having a batch file run the bot when the new folder is there. So wish me luck. haha Quote Link to post Share on other sites
Kev 69 Posted January 26, 2014 Author Report Share Posted January 26, 2014 I looked at this a bit. MySQL TRIGGERS is what I found. In the end though I thought of the other method using Dropbox. If you do find a way that will run a batch file when a table is updated using a TRIGGER (I think) it might work real well. Do let me know how you go. Quote Link to post Share on other sites
WarrenIndLLC 0 Posted January 27, 2014 Report Share Posted January 27, 2014 Ok. I'm getting closer but I'm not a batch programming expert so if anybody has any input that would be amazing. I know you can read MySQL and even run queries from a batch file. So the idea is to: 1. Run a batch file on a loop that can be hidden in the background (I have a code for this for a separate file so this can be done). The batch would be on a 5 second loop and I already have the code for this as well. 2. The first thing the loop should do is connect to MySQL with the credentials, run a query and save that query to file (if data is present and the text file would be in an IF statement). I've seen multiple codes for this but am having a hard time finding the right one that goes with W7 (which is also Windows 2008 Server) 3. Then comes the IF statements. IF there's data, then Save/Create txt.file. And IF there's txt.file, then delete file and open bot. 4. Already have a separate batch file that the bot runs at the end in the Shell Command that will close the bot. So if anybody is semi fluent in batch coding that would be amazing. Otherwise, I'll continue to do a ton of research on this to see if I can find something that works. Quote Link to post Share on other sites
Kev 69 Posted January 27, 2014 Author Report Share Posted January 27, 2014 Take a look at this, it might help http://stackoverflow.com/questions/5402765/batch-file-to-connect-mysql-and-run-commands To me it seems rather complex so I'd like to see how you get it going. If you don't get it going by the weekend I'll give it a try myself next week however you've got this far so I think you'll get it. I'm simply monitoring a folder for changes (Dropbox) using a free folder watching software. Quote Link to post Share on other sites
WarrenIndLLC 0 Posted January 27, 2014 Report Share Posted January 27, 2014 Yes, I saw that link earlier today. I've got it currently able to login to MySQL and run the query with the batch file. Now just trying to figure out how to save a new text file when information is on LIMIT 1, then delete the text file and IF text file is there then run bot. I feel like I'm getting close. Quote Link to post Share on other sites
Kev 69 Posted January 27, 2014 Author Report Share Posted January 27, 2014 Don't bother with saving the file but why not start the bot then /auto and then stop your MySQL batch file. Have the bot do it's thing then just before you close the bot run your original batch file in a new thread and the. Close the main bot. Will that do it? Quote Link to post Share on other sites
WarrenIndLLC 0 Posted January 28, 2014 Report Share Posted January 28, 2014 DUH! I don't know why I didn't think of that. IF information is present, then start bot. IF not then continue the loop to check for new information. IF bot is open then when bot is finished then it can run the MySQL bat file and the the CLOSE bat to close itself. Quote Link to post Share on other sites
WarrenIndLLC 0 Posted January 28, 2014 Report Share Posted January 28, 2014 So close I can taste it. I didn't bother waiting around to see if I could start the bot with an IF command in the batch file. But I'm able to save a new text file after I run the MySQL query. I'm pretty much there, my ONLY issue is that after it runs the query, if there is no information in the query then it will still save a blank text file. I'm using the text file as my IF statement. If present do this, if not do that. So I have to figure out how to only save the text file if there's info in the DB and then it's ready. Quote Link to post Share on other sites
dmbfan 9 Posted January 28, 2014 Report Share Posted January 28, 2014 So close I can taste it. I didn't bother waiting around to see if I could start the bot with an IF command in the batch file. But I'm able to save a new text file after I run the MySQL query. I'm pretty much there, my ONLY issue is that after it runs the query, if there is no information in the query then it will still save a blank text file. I'm using the text file as my IF statement. If present do this, if not do that. So I have to figure out how to only save the text file if there's info in the DB and then it's ready.Another option might be to let the text file save and then evaluate the file to determine its size. If the file size>0 then proceed. The get file info function allows you to evaluate the file size and I think it is available in this free plugin: http://www.ubotstudio.com/forum/index.php?/topic/13237-free-file-management-plugin-multiple-commands-and-functions/ 1 Quote Link to post Share on other sites
WarrenIndLLC 0 Posted January 28, 2014 Report Share Posted January 28, 2014 Actually thanks for the great idea! I can't use the plugin for what I'm trying to do, but I was able to put a string in the batch file that compare the size of the text file with an if statement and it's works amazing! I believe I have everything just about 100% now. 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.