Posted on

Get Domain Name

define $GetDomainName(#domain) {
    set(#domainOut,$find regular expression(#domain,"\\w+\\.\\w+$"),"Local")
    if($text length($replace regular expression(#domainOut,"\\..*","")) <= 2) {
        then {
            set(#domainOut,$find regular expression(#domain,"\\w+\\.\\w+\\.\\w+$"),"Local")
        }
    }
    return(#domainOut)
}
alert($GetDomainName("test.mydomain.com"))
alert($GetDomainName("amazon.co.uk"))
alert($GetDomainName("shopping.amazon.co.uk"))

 

Posted on

Word Split

clear all data
set(#spliteCount,25,"Global")
set(#words,"We\'ve done everything we can to make UBot Studio as easy to learn as possible. Now it\'s up to you. Make an investment into yourself. Start small with a few hours of training and watch as your potential unfolds.

- Seth Turin

Watch these bite-sized sessions once you\'ve made your purchase. You\'ll simply walk through the concepts of automation and how to implement it in UBot Studio.
Don\'t start from scratch ! Here are several useful pre-made automation solutions for you. More are available in our Bot Bank (inside the software) and the forum.
Visit the UBot Studio Wiki for frequently updated information on UBot Studio commands, features, and ideas for use! Then, visit the Playground to test out these commands and functions! ","Global")
set(#words,$replace(#words,$new line," "),"Global")
loop while($comparison($plugin function("Advanced Data Text File.dll", "$word count", #words),">= Greater than or equal to",#spliteCount)) {
    set(#WordsOut,$plugin function("Advanced Data Text File.dll", "$substring word", #words, 0, #spliteCount, " "),"Global")
    set(#words,$replace(#words,#WordsOut,""),"Global")
    add item to list(%Slides,#WordsOut,"Don\'t Delete","Global")
}
add item to list(%Slides,#words,"Don\'t Delete","Global")

Posted on

Image space transparent

set(#inPut,"{$special folder("Application")}\\TEST.png","Global")
set(#outPut,"{$special folder("Application")}\\image space.png","Global")
plugin command("Advanced Image.dll", "image space", #inPut, #outPut, 100, 50, 200, 200, 000000)
plugin command("Advanced Image.dll", "image background transparent", "{$special folder("Application")}\\image space.png", 000000, "{$special folder("Application")}\\image space transparent.png")
navigate("file:///{$replace("{$special folder("Application")}\\image space transparent.png","\\","/")}","Wait")
run javascript("document.body.style.backgroundColor = \"red\"; ")

Posted on

Start Pause Resume Stop

If you have a large amount of code you need to place several check points.

on load("Bot Loaded") {
    set(#Running,$false,"Global")
}
ui button("Start") {
    if($not(#Running)) {
        then {
            Run()
        }
        else {
        }
    }
}
ui button("Pause") {
    set(#LoopPause,$true,"Global")
}
ui button("Resume") {
    set(#LoopPause,"false","Global")
}
set(#LoopPause,"true","Global")
ui button("Stop") {
    set(#Stop,$true,"Global")
    set(#Running,"false","Global")
}
ui stat monitor("Number: ",#Num)
define Run {
    set(#Running,"true","Global")
    set(#LoopPause,$false,"Global")
    set(#Num,0,"Global")
    set(#Stop,"false","Global")
    loop(10) {
        PauseCheckPoint()
        wait(1)
        increment(#Num)
        PauseCheckPoint()
    }
    set(#Running,"false","Global")
}
define PauseCheckPoint {
    if(#Stop) {
        then {
            stop script
        }
    }
    loop while(#LoopPause) {
        wait(1)
    }
}