Jump to content



VaultBoss

Member Since 02 Jan 2012
Offline Last Active Aug 03 2013 04:09 PM
-----

Topics I've Started

[TOOLS] Useful Software - Process Lasso - for 'taming' nasty, resource eating W...

16 May 2013 - 03:35 AM

I felt that this is worth letting all UBotters know:

 

Today, GAOTD (GiveAwayOfTheDay) website has one of THE most powerful tools to grab for free by anybody:

 

http://www.giveawayo...way of the Day)

 

I am not trying to promote GAOTD per se, although it is a very valuable resource and website, but I am sure many people here would find this piece of software extremely useful.

 

I have no affiliation with neither GAOTD, nor the sw dev for this one; just my deep appreciation of their stellar efforts to make our lives easier (and less expensive) by providing such premium, usually paid tools, for free.

 

Enjoy!


[Good Reads on Automation] - See what other people do...

11 March 2013 - 06:54 AM

Today it just occurred to me that this forum lacks an external resources library or reference guide of sorts, for people looking at automation from (maybe) different standpoints.

 

So here is this thread - please feel free to add what you guys read on other places, where you learn stuff, news, etc...

 

This is NOT the place to write extended how to's or explain tips & tricks in detail, per se, but rather just what the links are about, in a few words, followed by the resource link itself.

 

If you want to explain a new technique or have a tip or trick to share, open your own thread in the appropriate section and just link to it from here.

 

Let's keep this thread as clean as possible.  Thanks!

 

What do YOU read?..


[FREE] $TimeStill a Return Date Bits Function with $date default values

23 January 2013 - 11:10 AM

This might be useful for many people - the idea came from a real request by uniquebot on this thread here, as a matter of fact.
 
Here is a Custom Function, called $TimeStill that would return various bits of info extracted from a string of the same format that $date natively returns (or from that function directly) and alternatively, returns the specified bits even w/o a defined parameter passed, based on current $date output from the System.
 
The following code starts with a loop that only showcases the various types of inputs and the results the $TimeStill custom function will return.
 
Basically, you can call it, specifying what you want to extract from the time/date string, separate bits such as:

  • year
  • month
  • day
  • hour
  • minute
  • seconds

or even a list of them all, when

  • list is the specified type,

or when

  • none of the above is specified (by default)

Also, the $TimeStill custom command/function will use $date return string, if no time string input is passed to it.
 
In extremis, if you call the function with both parameters empty, it will return a list of the current $date output elements (bits of info) such as year, month, etc... in the exact order the $date function gives them: 
 

MM/DD/YYYY HH:MM:SS

 
Here is the code:
 

loop(1) {
    set(#TIME, $date, "Global")
    set(#TIME_YEAR, $TimeStill(#TIME, "Year"), "Global")
    set(#TIME_MONTH, $TimeStill(#TIME, "monTH"), "Global")
    set(#TIME_DAY, $TimeStill(#TIME, " daY "), "Global")
    set(#TIME_HOUR, $TimeStill(#TIME, "hour "), "Global")
    set(#TIME_MIN, $TimeStill(#TIME, " Minute"), "Global")
    set(#TIME_SEC, $TimeStill(#TIME, "second"), "Global")
    set(#TIME_LIST, $TimeStill(#TIME, "LIST"), "Global")
    set(#TIME_NOType, $TimeStill(#TIME, ""), "Global")
    set(#TIME_NOTimeList, $TimeStill("", "list"), "Global")
    set(#TIME_NOTimeYear, $TimeStill("", "year"), "Global")
    set(#TIME_NOTimeNoType, $TimeStill("", ""), "Global")
}
divider
define $TimeStill(#var_INP_DATE, #var_INP_OUTPUT) {
    set(#var_LOC_DATE, $trim(#var_INP_DATE), "Global")
    if($comparison($text length(#var_LOC_DATE), "=", 0)) {
        then {
            set(#var_LOC_DATE, $date, "Global")
        }
        else {
            set(#var_LOC_DATE, $change text casing(#var_LOC_DATE, "Lower Case"), "Global")
        }
    }
    set(#var_LOC_OUTPUT_Type, $trim(#var_INP_OUTPUT), "Global")
    divider
    if($comparison($text length(#var_LOC_OUTPUT_Type), "=", 0)) {
        then {
            set(#var_LOC_OUTPUT_Type, "list", "Global")
        }
        else {
            set(#var_LOC_OUTPUT_Type, $change text casing($trim(#var_INP_OUTPUT), "Lower Case"), "Global")
        }
    }
    set(#var_LOC_DATE_LST, $replace regular expression(#var_LOC_DATE, "[^\\d]", $new line), "Global")
    clear list(%lst_LOC_TimeStill)
    add list to list(%lst_LOC_TimeStill, $list from text(#var_LOC_DATE_LST, $new line), "Don\'t Delete", "Global")
    divider
    if($contains(#var_LOC_OUTPUT_Type, "year")) {
        then {
            set(#var_OUT_TimeStill, $list item(%lst_LOC_TimeStill, 2), "Global")
        }
        else if($contains(#var_LOC_OUTPUT_Type, "month")) {
            set(#var_OUT_TimeStill, $list item(%lst_LOC_TimeStill, 0), "Global")
        }
        else if($contains(#var_LOC_OUTPUT_Type, "day")) {
            set(#var_OUT_TimeStill, $list item(%lst_LOC_TimeStill, 1), "Global")
        }
        else if($contains(#var_LOC_OUTPUT_Type, "hour")) {
            set(#var_OUT_TimeStill, $list item(%lst_LOC_TimeStill, 3), "Global")
        }
        else if($contains(#var_LOC_OUTPUT_Type, "min")) {
            set(#var_OUT_TimeStill, $list item(%lst_LOC_TimeStill, 4), "Global")
        }
        else if($contains(#var_LOC_OUTPUT_Type, "sec")) {
            set(#var_OUT_TimeStill, $list item(%lst_LOC_TimeStill, 5), "Global")
        }
        else if($contains(#var_LOC_OUTPUT_Type, "list")) {
            set(#var_OUT_TimeStill, #var_LOC_DATE_LST, "Global")
        }
    }
    divider
    return(#var_OUT_TimeStill)
}


and the .ubot file for download:
 
Attached File  TIME-TimeStill-Return-Date-Bits-Function.ubot   1.26KB   22 downloads
 
Enjoy!
 
 
P.S.

 

For reasons of testing, so that you can see the variable values in the DEBUGGER, the code shows the define function's variables set as "Global".
 
However, in a working environment, these should all be set to "Local" in my opinion, so keep in mind that I would personally switch so, but feel free to do whatever you like, of course - the code will still work, but in multithreading environments might be prone to errors.
 
Caveat:
Also, if you want to use it repeatedly to extract each piece of data in a loop or something, there is a slight danger of errors if you would be using the $date for each function call repeatedly (as by the nature of the beast which is time, the values might change from the beginning of the loop till the end)
 
Imagine you start by returning the YEAR of the current date with it, exactly at 12/31/2013 23:59:59 and while you're looping, the year passes by and you will then get the corresponding results derived from the next day, of the next month of the next year... etc... I think you got the point.
 
In such a case, to make sure you won't ever be faced with such disastrous 'time-shifts' LOL ... you should pin down the starting date string by adding it to a time variable that calls $date only once and then use the $TimeStill command only with that variable as input parameter in the loop.


[Best Tools] Collaborative coding & project management platform

20 January 2013 - 06:10 AM

This thread is dedicated to ideas, suggestions and usage tips/tricks for collaborative work related to software coding and team management (as well as time management) for more than one single coder.

 

So, assuming you guys would want to collaborate with somebody else in a UBot coding project, what is your preferred tool (and especially WHY? = pro/cons arguments)

 

Hope to get some good suggestions here, as I am planning on starting such a project and as long as I have been a 'lone wolf' until now, I would really appreciate the feedback.

 

Thanks!


[Email Access Settings] POP3 vs. IMAP4 alternative

17 January 2013 - 06:09 AM

Recently, I had to implement email related commands into one of my bots, to check a Gmail account for certain emails and after that delete the emails.

 

I started with POP3 settings, which worked great and fast, but I wasn't able to delete the emails, only to read them.

 

TIP:

After finding and using another solution (IMAP) to achieve the said results, a fellow UBot Forum member (entroqy) hinted at a Gmail account setting that might have helped, if I were aware of it prior to my attempt, that is making sure I allow POP3 to delete emails in my GMAIL Settings Page.

 

Some other webmail services may have 'delete emails' set as default, but gmail has 'keep emails on server' as their default setup there.

 

However, this made me want to look more into the two protocols that webmail services usually allow users to use to remotely access their accounts and that are also implemented in UBot:

 

POP3 vs. IMAP4

 

POP (stands for Post Office Protocol) - is like a one-way ticket.  It delivers your email from the server at once, in a one-time 'pop', in 3 steps:

  1. It connects to the server (through an Internet connection),
  2. downloads a copy of your awaiting messages via POP, and
  3. then disconnects.

There is no synchronization between your local copy and your email server.  Furthermore, POP is prone to losing messages or downloading the same messages multiple times.

 

IMAP (stands for Internet Message Access Protocol) - is the true two-way email management solution.  Any change made in any IMAP client (this includes UBot implementation) is synchronized with the remote email server.  Unlike POP, IMAP avoids loss of data through the two-way syncing process.

 

---------

 

If you're trying to decide between using POP3 vs. IMAP4, based on my experience, I would say that:

  • It is best to use POP when you only want to quickly check emails to see if say.. anything new was received, etc... as overall, I found POP to offer a much better speed which is sensibly obvious when you check large email accounts with many emails stored there already.
  • It is best to use IMAP when you want to grab the emails and store them on a local database/file of sorts and at the same time delete them from the remote server, to keep the email load there low and improve the speed of the connection every time you re-connect (the fewer emails the faster to get them and sync)

---------

 

Based on info shared freely on this forum and other places, especially lowridertj-botguru's contribution on this thread, I tried to assemble a file with connection settings for various webmail services that I will attach to this post.

 

Mind you, I am using only Gmail myself, so the other webmail settings are not tested by me, but feel free to PM me and I will update the file if you find anything that doesn't work as expected.

 

Attached File  Email-Connections-Params.csv   822bytes   17 downloads

 

I also have a small DEFINE script that basically loads the necessary connection data from that file, so that you don't need to ever remember all the needed settings but just select the proper webmail/protocol combo instead.

 

This script reads the above file and builds a table with the needed connection parameters. 

Inside the script there is another table built from yet another external file, containing your various accounts login details. 

For obvious reasons, that file is specific to each user, so I'm including a sample only (you will need to add your own logins inside)

 

Attached File  Email-Accounts-Logins.csv   129bytes   14 downloads

 

Based on the input variables (protocol and Email) the DEFINE selects the necessary data from the two tables and connects to the remote server, bringing the emails locally and adding them to a table (that you can choose to save as an external file later < add your own code here!) while at the same time attempting to delete them from the remote server IF that is at all possible.

 

loop(1) {
    set(#var_ENV_InboxTable_File, $ConnectWebMail("IMAP With SSL", "SteveOnGAEs@Gmail.com"), "Global")
}
divider
define $ConnectWebMail(#var_INP_EConn_Protocol, #var_INP_EConn_Account) {
    divider
    set(#var_INP_EConn_Protocol, $trim(#var_INP_EConn_Protocol), "Global")
    set(#var_LOC_EConn_Protocol, $change text casing(#var_INP_EConn_Protocol, "Lower Case"), "Global")
    divider
    set(#var_INP_EConn_Account, $trim(#var_INP_EConn_Protocol), "Global")
    set(#var_LOC_EConn_Account, $change text casing(#var_INP_EConn_Account, "Lower Case"), "Global")
    divider
    set(#var_LOC_Email_Acc_Web_Mail, $replace regular expression(#var_LOC_Email_Acc_Web_Mail, "(.+@)", $nothing), "Global")
    divider
    clear table(&tbl_ENV_Email_Connections)
    clear table(&tbl_ENV_EmailAccounts)
    clear table(&tbl_Inbox_Emails)
    divider
    if($comparison(#var_ENV_Email_AccLists_CHK, "=", 1)) {
        then {
            comment("Email Accounts Connect Details Already Loaded")
        }
        else {
            clear table(&tbl_ENV_Email_Connections)
            create table from file("D:\\My Stuff\\UBots Bots\\UBot V4 Bots\\Accounts\\Email-Connections-Params.csv", &tbl_ENV_Email_Connections)
            clear table(&tbl_ENV_EmailAccounts)
            create table from file("D:\\My Stuff\\UBots Bots\\UBot V4 Bots\\Accounts\\Email-Accounts-Logins.csv", &tbl_ENV_EmailAccounts)
            set(#var_ENV_Email_AccLists_CHK, 1, "Global")
        }
    }
    divider
    set(#var_CYC_Email_Con_CRT, $table total rows(&tbl_ENV_Email_Connections), "Global")
    loop while($comparison(#var_CYC_Email_Con_CRT, ">", 0)) {
        decrement(#var_CYC_Email_Con_CRT)
        divider
        set(#var_CYC_Email_Acc_ConnType, $table cell(&tbl_ENV_Email_Connections, #var_CYC_Email_Con_CRT, 1), "Global")
        set(#var_LOC_Email_Acc_ConnType, $trim(#var_CYC_Email_Acc_ConnType), "Global")
        set(#var_LOC_Email_Acc_ConnType, $change text casing(#var_LOC_Email_Acc_ConnType, "Lower Case"), "Global")
        divider
        if($comparison(#var_LOC_Email_Acc_ConnType, "=", #var_LOC_EConn_Protocol)) {
            then {
                set(#var_CYC_Email_Acc_EmServer, $table cell(&tbl_ENV_Email_Connections, #var_CYC_Email_Con_CRT, 2), "Global")
                set(#var_CYC_Email_Acc_Rem_Port, $table cell(&tbl_ENV_Email_Connections, #var_CYC_Email_Con_CRT, 3), "Global")
                divider
                set(#var_CYC_Email_Acc_CRT, $table total rows(&tbl_ENV_EmailAccounts), "Global")
                loop while($comparison(#var_CYC_Email_Acc_CRT, ">", 0)) {
                    decrement(#var_CYC_Email_Acc_CRT)
                    divider
                    set(#var_CYC_Email_Acc_EAddress, $table cell(&tbl_ENV_EmailAccounts, #var_CYC_Email_Acc_CRT, 0), "Global")
                    set(#var_LOC_Email_Acc_EAddress, $trim(#var_CYC_Email_Acc_EAddress), "Global")
                    set(#var_LOC_Email_Acc_EAddress, $change text casing(#var_LOC_Email_Acc_EAddress, "Lower Case"), "Global")
                    divider
                    set(#var_CYC_Email_Acc_Password, $table cell(&tbl_ENV_EmailAccounts, #var_CYC_Email_Acc_CRT, 1), "Global")
                }
            }
        }
    }
    divider
    connect to mail server(#var_INP_EConn_Protocol, #var_LOC_Email_Acc_EAddress, #var_CYC_Email_Acc_Password, #var_CYC_Email_Acc_EmServer, #var_CYC_Email_Acc_Rem_Port) {
        clear table(&tbl_Inbox_Emails)
        create table from emails(&tbl_Inbox_Emails)
        set(#var_CYC_Email_CRT, $table total rows(&tbl_Inbox_Emails), "Global")
        loop while($comparison(#var_CYC_Email_CRT, ">", 0)) {
            decrement(#var_CYC_Email_CRT)
            delete email(#var_CYC_Email_CRT)
        }
    }
}

You will have to alter the location of these two external data files, according to where you want to store them on YOUR computer.

 

Enjoy!

 

P.S.

Here is also the .ubot file:

 

Attached File  Connect-to-WebMail-Sample-Bot.ubot   1.5KB   23 downloads