Jump to content
UBot Underground

Recommended Posts

Hi,

 

I own a very expensive piece of software that consists of different files inside a folder. The software itself has no UI as such. The software is run by a collection of batch files and excel spreadsheet. My idea is to build an interface for my software with Ubot. But in order to do that I must first try to "discover" how to get uBot see my "main" folder.

 

Can anyone please help me with that? I know how to select a file, but I'm lost on folders.... :-) Any help is highly appreciated.

 

PS. Please be gentle... I'm still a "uBot Virgin"... lol

 

 

 

Link to post
Share on other sites

I think you should place your UBot compiled exe into the same folder as your files are (root folder, so you have access to all sub folders from there), then use "$special folder(application)" to retrieve the path.

  • Like 1
Link to post
Share on other sites

Hi uBotDev, thank you very much for the reply... but you're waaayyyy ahead of me  :huh:  I haven't even created the bot yet... :-) The problem is... I don't know how to make uBot "see" a folder... I signed up to http://ubottraining.com (and gone through the 30 day training...), but I still don't know. I've used WinAutomation in the past for Windows Automation and they had a very easy "select-folder" command. I do realize that uBot is more Web Automation, but there must be a way to make ubot select a folder on the C:\ Drive... I think from there on I would be able (using my spaghetti code :D  ) to retrieve a list of the files inside that folder...

 

But a great thank you for the reply anyway, I may need it for later at compilation time... :D  

Link to post
Share on other sites

Hi again uBotDev... I had a look at your website... and this is almost exactly how my software works... http://ubotdev.com/free-plugin-advanced-shell It's all a bunch of batch files creating data from an excel spreadsheet... P.S. Just signed up too   :D.

Link to post
Share on other sites

Hi uBotDev, thank you very much for the reply... but you're waaayyyy ahead of me  :huh:  I haven't even created the bot yet... :-) The problem is... I don't know how to make uBot "see" a folder... I signed up to http://ubottraining.com (and gone through the 30 day training...), but I still don't know. I've used WinAutomation in the past for Windows Automation and they had a very easy "select-folder" command. I do realize that uBot is more Web Automation, but there must be a way to make ubot select a folder on the C:\ Drive... I think from there on I would be able (using my spaghetti code :D  ) to retrieve a list of the files inside that folder...

 

But a great thank you for the reply anyway, I may need it for later at compilation time... :D  

I usually do this like this: when the bot is started I save (working) folder path to variable, which I can later use, when I want to load data, store date,...

 

Here is an example which will define folders and do some action:

on load("Bot Loaded") {
    comment("Define main folder")
    set(#FOLDER Main, "c:\\myappfolder", "Global")
    comment("You can even define and create sub-folders (images in this case)")
    set(#FOLDER Images, "{#FOLDER Main}\\images", "Global")
    create folder(#FOLDER Main, "images")
}
comment("Do some reading and writing...")
clear list(%LIST)
add list to list(%LIST, $get files(#FOLDER Main, "Yes"), "Delete", "Global")
save to file("{#FOLDER Images}\\list.txt", %LIST)

This example uses hard-coded path, but you could use "$special folder" function mentioned above (this way you can move the main folder and you don't have to change code).

 

I use "on load" so that paths are defined only once, when bot is opened. Notice that when you copy paste this code you will have to re-open Ubot Studio or run commands inside "on load" manually, but you will be OK the next time you open UBot project.

 

Hi again uBotDev... I had a look at your website... and this is almost exactly how my software works... http://ubotdev.com/free-plugin-advanced-shell It's all a bunch of batch files creating data from an excel spreadsheet... P.S. Just signed up too   :D.

That plugin will allow you to run Command Prompt hidden and retrieve the output that it will produce (not possible with native UBot command "shell"). The easiest way for you will be to execute those files from UBot, but you could also replace those files with UBot commands/functions.

 

Good luck with your project.

Link to post
Share on other sites

If your using Stan/Pro here is a onload script... just put it in a ui stat monitor and make a define command called onload

 

<script type="text/javascript">
    window.setTimeout(function() { ubot.runScript('onload()') }, 500)
</script>

  • Like 1
Link to post
Share on other sites

If your using Stan/Pro here is a onload script... just put it in a ui stat monitor and make a define command called onload

 

<script type="text/javascript">

    window.setTimeout(function() { ubot.runScript('onload()') }, 500)

</script>

I didn't know that STD and PRO don't have onload.

 

However, just ignore the onload command then, just add the code without it. Btw, UBot won't allow you to copy paste the whole code at once, so you will have to copy and paste it line by line (command by command).

Link to post
Share on other sites
Hi guys thank you so much for your help. Edward_2, Thank you for your help, as in my case the software doesn't always run from the same folder... Even though it's the same software, I have 1 folder for each project that I need to do. So I will need to select a different folder every time I run the software... 

 

UBotDev I think your shell command may help me avoid a LOT of irritation (lol) My software (bought) starts up 20 batch files in sequence, and every time 1 starts it pops up the cmd-prompt window... I hope to "suppress" them with your plugin... Thank you.

 

P.S. I have uBot Pro... just upgraded a week ago...  :D

Edited by carlstarus
Link to post
Share on other sites

Hi guy's,

 

I've done this: 

 

ui button("Select Folder") {
    set(#MyFolder$get files("C:\\1-MOWG-SITE\\518-CELLULITE-SUB""Yes"), "Global")
    set(#MySystemFolder"{#MyFolder}\\SYSTEM""Global")
}

 

The problem I'm having is how do I make the button "Select" a folder? In this (my example) case it's kinda "hard coded"  (1-MOWG-SITE\\518-CELLULITE-SUB)... I need the button to open a browser window on my machine so I can select the folder I need to work with myself.  :unsure:

 

Any takers ?  :)

 

Best regards,

carlstarus

Edited by carlstarus
Link to post
Share on other sites

You could use:

ui open file("File", #FOLDER Main)

But you would have to remove file name to use that as a folder.

 

There is another option: you can install Aymens "file management" plugin, which has a function "$folder browser dialog".

 

Btw, do you really need UI to select folder? If you'll only be using 1 folder, you can hardcore its path...

Link to post
Share on other sites

You could use:

ui open file("File", #FOLDER Main)

But you would have to remove file name to use that as a folder.

 

There is another option: you can install Aymens "file management" plugin, which has a function "$folder browser dialog".

 

Btw, do you really need UI to select folder? If you'll only be using 1 folder, you can hardcore its path...

 

 

Thanks for the reply UbotDev. Yes, I have more then 100 separate folders... each with their own project and "instance" of the software... So I need to select the one I'll be working with. I also constantly have to create new projects...  ;) The folders could also be located in different directories... Some on the C:\ Drive and other in my E:\ Drive... 

Edited by carlstarus
Link to post
Share on other sites

I didn't know that STD and PRO don't have onload.

 

However, just ignore the onload command then, just add the code without it. Btw, UBot won't allow you to copy paste the whole code at once, so you will have to copy and paste it line by line (command by command).

Ya Im an expert as to what Pro can and cant do ROFL Unfortunately

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