Log

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
(Example)
 
(5 intermediate revisions by one user not shown)
Line 1: Line 1:
This command is a [[Flow Commands|Flow Command]]. This command writes a message to a log file.
+
This command is a [[Log Commands|Log Command]]. This command writes a message to a log file.
  
 
'''Log:''' The message that is being logged.
 
'''Log:''' The message that is being logged.
 +
  
 
The log file for the log command is located in your roaming folder found here: C:\Users\YOUR WINDOWS USERNAME HERE\AppData\Roaming\UBot Studio
 
The log file for the log command is located in your roaming folder found here: C:\Users\YOUR WINDOWS USERNAME HERE\AppData\Roaming\UBot Studio
Line 7: Line 8:
 
The log folder can be located at:  C:\Users\YOUR WINDOWS USERNAME HERE\AppData\Roaming\UBot Studio\Log
 
The log folder can be located at:  C:\Users\YOUR WINDOWS USERNAME HERE\AppData\Roaming\UBot Studio\Log
  
Dated log .txt log files are created to log each script:  
+
Dated log .txt log files are created to log each bot's various activities:  
 +
 
  
 
[[File:logfiles.jpg]]
 
[[File:logfiles.jpg]]
 +
 +
 +
Each message logged is also available for viewing through the debugger.
  
  
Line 15: Line 20:
 
<pre>
 
<pre>
 
set(#page were on,$scrape attribute(<id="hplogo">,"alt"),"Global")
 
set(#page were on,$scrape attribute(<id="hplogo">,"alt"),"Global")
log(#page were on)
+
if($comparison(#page were on,"=","Google")) {
 +
    then {
 +
        log("Webpage is Google.com")
 +
    }
 +
    else {
 +
        log("Webpage is NOT Google.com")
 +
    }
 +
}
 +
 
 
</pre>
 
</pre>
  
Line 21: Line 34:
  
  
[[File:log.jpg]]
+
[[File:bllog.jpg]]
  
  
Line 29: Line 42:
  
  
[[File:log0.jpg]]
+
[[File:bllog0.jpg]]
  
  

Latest revision as of 14:35, 16 August 2015

This command is a Log Command. This command writes a message to a log file.

Log: The message that is being logged.


The log file for the log command is located in your roaming folder found here: C:\Users\YOUR WINDOWS USERNAME HERE\AppData\Roaming\UBot Studio

The log folder can be located at: C:\Users\YOUR WINDOWS USERNAME HERE\AppData\Roaming\UBot Studio\Log

Dated log .txt log files are created to log each bot's various activities:


Logfiles.jpg


Each message logged is also available for viewing through the debugger.


[edit] Example

set(#page were on,$scrape attribute(<id="hplogo">,"alt"),"Global")
if($comparison(#page were on,"=","Google")) {
    then {
        log("Webpage is Google.com")
    }
    else {
        log("Webpage is NOT Google.com")
    }
}

Running the script will scrape the required element, which indicates the webpage the browser is on. Once the element is scraped, it is inserted into the log command through a variable and logged in the log file.


Bllog.jpg


Opening the log file shows the following logs to show that the browser is on the correct webpage:

2015-02-15 13:19:34 [LOG] Webpage is Google.com


Bllog0.jpg


Since the browser is not on the expected webpage and the correct element was not detected, the following message is logged on the second run:


2015-02-15 13:19:34 [LOG] Webpage is NOT Google.com
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox