Jump to content
UBot Underground

Best way to load/save configurations?


Recommended Posts

I haven't really been able to find a good way to do this so I'm hoping someone here can point me in the right direction.

 

My bot has a lot of initial settings the user can choose, which are all done through an external ui.php file on my server that the bot navigates to at the start. But for future use, I want people to save various "campaigns" to their local computer, so that they can reload them again later depending on what they want to do.

 

I don't see an obvious solution to this in UBot itself, other than the simple UI Save File and UI Open File options that just give a simple dialog to select a file. These are inelegant at best because the user would have to select the file path, and then run the bot. In the case of loading a file that's not so bad, but for saving one... it's very weird. And how would the user differentiate between loading and saving anyway?

 

I'd prefer to just have something on my UI page for loading or saving. Problem here is these are not seen by UBot until the bot is run, so choosing a file and whatnot on the form, won't be able to pass anything to the bot.

 

So basically I'm just confused... not even sure if any of the above makes sense.

 

I just want a simple way for a user to be able to click a button to save a file, and click another button to load a file, and have everything handled.

 

Anyone got any answers for me?

 

Thanks!!

 

Jonathan

Link to post
Share on other sites

Jonathan, I don't know if it's the most prudent solution, but if you are using php scripting on your server, why not set up a MySQL db to store and call data from? (i.e. The UI sends user input directly to the database).

 

John

Link to post
Share on other sites

Yeah I thought about that briefly, but we're talking about users saving their own data, which could include "sensitive" information like content they plan to post, etc. I don't think storing that stuff on my side is really a good solution. Personally I'd want to know that I was saving stuff like that, to my own local machine.

 

Any other suggestions?

 

Jonathan

Link to post
Share on other sites

I don't see an obvious solution to this in UBot itself, other than the simple UI Save File and UI Open File options that just give a simple dialog to select a file. These are inelegant at best because the user would have to select the file path, and then run the bot. In the case of loading a file that's not so bad, but for saving one... it's very weird.

Have a 'ui open file' with a 'ui check box' next to it; each labeled as required (and do the same for 'ui save file'). I don't know what your bot does, but the check box could be labeled for example, 'Load at start'.

 

If you mean that you don't want the user to specify a file path, then (whilst this is not as flexible) just have a check box and hard code the path to for example, 'my documents'.

 

And how would the user differentiate between loading and saving anyway?

Because the options/dialogs would be labeled differently.
Link to post
Share on other sites

Ah ok, I hadn't thought to combine a checkbox along with the fields. That's a workaround of sorts... still it violates everything users are familiar with in terms of clicking a button to save or load. Selecting a checkbox to enable saving, and then having to run the bot in order to save, would be extremely unintuitive I think.

 

Is there any way to do this via javascript? Somehow create buttons on my HTML UI that would use the normal type='file' form approach, but the data being saved would be pulled out of UBot's variables?

 

I don't think this is possible since I don't believe we have access to any UBot variables via anything other than UBot itself while the bot is running but I could be wrong. This would be my preferred approach, as I could keep everything within the UI of the bot itself rather than splitting things up between my UI and the UBot top-of-page UI.

 

Jonathan

Link to post
Share on other sites

That's a workaround of sorts... still it violates everything users are familiar with in terms of clicking a button to save or load. Selecting a checkbox to enable saving, and then having to run the bot in order to save, would be extremely unintuitive I think.

If you mean that you would like users to open and save files using a button, at any time during when the bot is being played/run, then currently that's not possible, as there is no button on the UI, and no direct handling of Windows events, e.g. button clicks.

 

One solution would be to use a checkbox to mimic the behavior of a button, i.e. by having a loop running in a thread, polling to see whether the checkbox has been checked.

 

Another option is to create a UI in .NET, etc. which saves the project file and have Ubot read the file.

Link to post
Share on other sites

Well what I'd ideally like to happen is this:

 

User presses Play and is taken to my UI page. Bot is then paused after an alert telling them to select their settings and hit play again, is displayed. There would be two buttons at the top of my UI page, a Load and a Save button. The load button would prompt the user for a file, and then fill out all the fields of the UI page with the information in that file. The save button would do the opposite - take the information currently in the fields (which, after the bot has been run, will also be stored in variables), prompt the user for a location to save to, and write everything out to a file for later use.

 

The key thing here is that I'd like the buttons to be in my HTML interface rather than in UBot itself, if possible.

 

Can this be accomplished?

 

Jonathan

Link to post
Share on other sites

The load button would prompt the user for a file, and then fill out all the fields of the UI page with the information in that file.

If by UI Page/HTML interface you mean a website page, then it would be possible for the user to load and save a file.

 

The save button would do the opposite - take the information currently in the fields (which, after the bot has been run, will also be stored in variables), prompt the user for a location to save to, and write everything out to a file for later use.

If the data in the fields is supposed to be the same as in the bot, then not sure how the bot and website would interact (unless you mean the bot would navigate to the website and fill in the fields with the stored data).

Link to post
Share on other sites

Yes the bot navigates to a php page on my own server, which contains the interface. I've thought about just using a simple form with type="file" for the loading & saving, but I'm getting mixed up on how to get the information out of those fields and saved into a file, or out of a file and into the fields. I think this should be relatively straight forward but for some reason I'm getting hung up on the interaction between UBot and the web page.

 

What am I missing here?

 

Jonathan

Link to post
Share on other sites

Here is an example I made for a member that asked for it a while back. It was created in the old 3.1 version, but I did open it up to make sure it would run the right way in 3.3

 

This may give you some ideas on storing users settings and info.

 

Well what I'd ideally like to happen is this:

 

User presses Play and is taken to my UI page. Bot is then paused after an alert telling them to select their settings and hit play again, is displayed.

 

With the "Wait for" you wouldn't need to use a pause in your script. Here just take a look at the example, if it helps great.

 

 

Make sure to extract this into your documents folder before running it.

 

 

 

Good Luck

Bot Settings Example.zip

Link to post
Share on other sites

Thanks for this, I'll definitely give it a look. I'll consider using Wait For... I use it all the time but hadn't thought it made sense in this instance... but I'll see if maybe it does after all.

 

Thanks,

 

Jonathan

Link to post
Share on other sites

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...