<< Click to Display Table of Contents >> Navigation: 3. Script Language > Browser and Office (Acc.-Engine) > Browser and Office Commands |
MiniRobotLanguage (MRL)
CBR. Command
Send or receive Data from/to the Mini-Browser
Intention
Using CBR. you can control the Mini-Browser (=MB). For this to work, the MB must have been started using the LBR. command. This ensures that there is a technical connection between the Script and the MB.
CBR. can switch or close sites in the MB. It can even give you the HTML or Text that is currently on the WEB-Site.
For more details on the Mini-Browser (MB) see there.
One special usage for CBR. is
CBR.errclear
Any error tha occurs while loading a site will stay until it is "confirmed" from the script.
This is to make sure that you have seen that error.
CBR.errclear
Will clear the internal Error variables. Note that in case of successive Errors, the last will overwrite any previous Error, no matter if that one was confirmed or not.
Please see the 3.1 Systemvariables for more Information on Errorhandling with the MB.
CBR. is a multi-purpose command that includes multiple possible subcommands.
Usage is simple:
' Start the Mini-Browser
LBR.Size=1024,980|Pos=0,0|svf=0|Site=www.it-berater.org
' Wait until the Starting Site is loaded,
' please look at the Logo on the site, left upper corner.
' The loading will not be "done" until it has been
' completely aninmated!
WBR.
' Use CBR to open a new site also
CBR.new|www.fa2.de
' Wait until that site is loaded
WBR.
' Select the first TAB
CBR.select|1
' Switch the selected TAB to this site
CBR.Goto|www.smart-package.com
WBR.
' Wait 5 seconds
PAU.5
' Select the second TAB
CBR.select|2
' Cose it
CBR.Close
WBR.
MBX.Ready
' then the SPR-Browser will close
' because we started it with "svf=0"
ENR.
Syntax
CBR.P1[|P2]
Parameter Explanation
P1 - Subcommand, the following Subcommands are currently supported. Note that for all of the subcommands there is a long form that is better readable, as well as a short form, that can be used to write faster.
• "New" - open a new TAB in the MB
CBR.New[|page to load]
CBR.New
CBR.New|about:blank
CBR.New|www.fa2.de$crlf$www.c10.de
CBR.New|$$TXT
• "Close","Cl." - Close the active TAB
or close a TAB using a numeric Index (1..X)
CBR.Close
CBR.Close|(number)
CBR.Close|2
CBR.Close|$$NUM
• "TClose","tc." - Close a TAB using a pattern
CBR.TClose|$$PAT
CBR.TClose|Theo$OR:Site
• "Select","s." - Select a TAB using a number (1..X)
CBR.Select|$$NUM
CBR.Select|3
• "TSelect","ts." - Select a TAB using a pattern
CBR.TSelect|$$PAT
CBR.ts.|Theo$OR:Site
• "Exit","ex." - Exit MiniBrowser
CBR.Exit
CBR.ex.
• "Goto","gt." - Goto this site ...
CBR.Goto|$$SIT
CBR.gt.|www.fa2.de
• "ErrClear","er." - Confirm / Clear Error
CBR.ErrClear
CBR.ErrClear
• "gback","gb." - Press Back Button (1 or more times)
' Press "Back" 2 times
CBR.gback|2
' Press "Back" 1 time
CBR.gback
• "gforward","gf." - Press Forward Button (1 or more times)
' Press "Forward" 2 times
CBR.gforward|2
' Press "Back" 1 time
CBR.gf.
• "GHome","gh." - Load Default page
CBR.GHome
CBR.gh.
• "gsearch","gs." - Load Search Site
CBR.gsearch
CBR.gs.
• "refresh","rf." - Load actual Site again/refresh Site
CBR.refresh
' refresh 2 times
CBR.rf.|2
• "silent","si." - Set/Reset IE-Silent Mode
CBR.silent|1
CBR.si.|0
• "SetFocus","sf." - SetFocus on current Tab or numeric TAB
' SetFocus on TAB 1
CBR.SetFocus|1
' SetFocus on current TAB
CBR.sf.
• "iHTML","ih." - Get Site HTML
' Get Site HTML into Variable
CBR.iHTML|$$HTM
' Get HTML on TOS
CBR.ih.
• "iText","it." - Get Site Text
' Get Site Text into Variable
CBR.iText|$$TXT
' Get Text on TOS
CBR.it.
• "GetZoom","gz." - Get Site Zoom-Factor (10-1000)
' Get Site Zoom into Variable
CBR.GetZoom|$$TXT
• "SetZoom","sz." - Set Site Zoom-Factor (10-1000)
' Set Site Zoom
CBR.sz.|200
' Formulas are allowed
CBR.sz.|(10*$$TXT)
• "getwindow","gw." - Locate selected TAB Browser-Control
This will locate the Browser Control like if you would
have used SCW.
' Locate Control and put Control Handle into $$TXT
CBR.getwindow|$$TXT
' Locate Control and place Control Handle on TOS
CBR.it.
• "ScrollTo","st." - Scroll to defined Position
CBR.ScrollTo|45,344
' Formulas in () are allowed
CBR.ScrollTo|(45+$$NUM),(344-$$IXX)
• "XScroll","xp." - Get actual X-Scrolling Position
' Get X-Pos. into Variable
CBR.xp.|$$TXT
• "YScroll","yp." - Get actual Y-Scrolling Position
' Get Y-Pos. into Variable
CBR.yp.|$$TXT
• "XSize","xs." - Get actual X-Scrolling Size
' Get X-Size. into Variable
CBR.xs.|$$TXT
• "YSize","ys." - Get actual Y-Scrolling Size
' Get Y-Size. into Variable
CBR.ys.|$$TXT
• "Scroll","sc." - Scroll Browser
' Scroll PageDown 4 times
CBR.Scroll|pageDown,4
' Scroll 1 time PageUp
CBR.Scroll|scrollbarPageUp
The "Scroll" Subcommand has additional options. With some of these, you can give an additional numeric parameter that specifies how often you want to to the specified action.
- "scrollbarDown","Down" - scroll down,
like a click on the Scrolldown Button
' Press "Scrolldown" 1 time
CBR.Scroll|scrollbarDown,1
- "scrollbarUp","Up" - scroll Up, like a click on the Scroll-Left Button
' Press "scrollbarUp" 2 times
CBR.Scroll|scrollbarUp,2
- "scrollbarLeft","left" - scroll left, like a click on the Scroll-Left Button
' Press "scrollbarLeft" 2 times
CBR.Scroll|scrollbarLeft,2
- "scrollbarRight","Right" - scroll right,
like a click on the Scroll-Right Button
' Press "scrollbarRight" 2 times
CBR.Scroll|scrollbarRight,2
- "scrollbarPageDown" - scroll full page down
' Press "scrollbarPageDown" 1 times
CBR.Scroll|scrollbarPageDown,1
- "scrollbarPageUp" - scroll full page Up
' Press "scrollbarPageUp" 2 times
CBR.Scroll|scrollbarPageUp,2
- "scrollbarPageRight" - scroll full page to right
' Press "scrollbarPageRight" 2 times
CBR.Scroll|scrollbarPageRight,2
- "scrollbarPageLeft" - scroll full page to left
' Press "scrollbarPageLeft" 2 times
CBR.Scroll|scrollbarPageLeft,2
Depending on the chosen Subcommand the further Parameters P2 to P4 differ and may be
needed or not.
P2 - (optional) Depending on the chosen Subcommand this Parameter may
be needed or not.
Example
'**************************************
' CBR. Sample Locate WEB-Elements
' and compute Link
'**************************************
'
LBR.Size=1024,980|Pos=0,0|svf=0|site=www.fa2.de
WBR.
CBR.gw.
FOR.$$NUM|1|40
AGR.40|||$$NUM
GAI.v|$$LNK
DBP.Link ($$CNT):$crlf$$$LNK
MMV.
NEX.
MBX.Browser exit
CBR.exit
ENR.
'**************************************
' CBR. Sample 1 (New and Close)
'**************************************
'
LBR.Size=1024,980|Pos=0,0|svf=0
PAU.2
' Open 2 new default sites
CBR.New
CBR.New
' Open a new blank page
CBR.New|about:blank
PAU.5
CBR.Close
CBR.Close
CBR.Close
PAU.5
$$TXT=www.fa2.de$crlf$www.facebook.com
CBR.New|$$TXT
WBR.
PAU.5
ENR.
'**************************************
' CBR. Sample "Close, TClose and Exit"
'**************************************
'
LBR.Size=1024,980|Pos=0,0|svf=0
PAU.2
CBR.New|www.fa2.de
CBR.New|www.it-berater.org
' open a blank page
CBR.New|about:blank
WBR.
MBX.Closing TAB by textual pattern
CBR.TClose|Theo&AND:Site
MBX.Closing Tab by Number (1...x)
CBR.Close|1
MBX.Closing active TAB
CBR.Close
MBX.Browser exit
cbr.exit
MBX.Browser is gone!
ENR.
'**************************************
' CBR. Sample "Select, TSelect and Exit"
'**************************************
'
LBR.Size=1024,980|Pos=0,0|svf=0
PAU.2
CBR.New|www.fa2.de
CBR.New|www.it-berater.org
' open a blank page
CBR.New|about:blank
WBR.
MBX.Selecting TAB by textual pattern
CBR.TSelect|Theo&AND:Site
MBX.Selecting Tab by Number (1...x)
CBR.Select|1
MBX.Closing active TAB
CBR.Close
MBX.Browser exit
CBR.exit
MBX.Browser is gone!
ENR.
'**************************************
' CBR. Sample "Text, iHTML and Exit"
'**************************************
'
LBR.Size=1024,980|Pos=0,0|svf=0
' open a blank page
CBR.New|about:blank
WBR.
' Switch active TAB to this page
CBR.Goto|www.fa2.de
WBR.
CBR.iText|$$TXT
MBX.Text from this Site: $crlf$$$TXT
' Open another TAB
CBR.New|www.it-berater.org
WBR.
CBR.ihtml|$$TXT
MBX.HTML-Source of this Site: $crlf$$$TXT
MBX.Closing active TAB
CBR.Close
MBX.Browser exit
CBR.exit
MBX.Browser is gone!
ENR.
'**************************************
' CBR. Sample "Get Offset"
'**************************************
'
LBR.Size=1024,980|Pos=0,0|svf=0|site=www.fa2.de
WBR.
CBR.ho.|$$HOF
CBR.vo.|$$VOF
MBX.Hor. Offset=$$HOF$crlf$Vert. Offest=$$VOF
MBX.Browser exit
CBR.exit
ENR.
'**************************************
' CBR. Sample "ScrollTo"
'**************************************
'
LBR.Size=1024,980|Pos=0,0|svf=0|site=www.fa2.de
WBR.
FOR.$$CNT|1|2000|20
GSB.check
CBR.Scrollto|$$CNT,1
GSB.check
CBR.Scrollto|1,$$CNT
GSB.check
NEX.
MBX.Browser exit
CBR.exit
ENR.
' Subprogram
:check
' Find out Scroll-Positions
CBR.xp.|$$TXT
DBP.Xpos=$$TXT
CBR.yp.|$$TXT
DBP.Ypos=$$TXT
RET.
'**************************************
' CBR. Sample "Get-/Set Zoom"
'**************************************
'
LBR.Size=1024,980|Pos=0,0|svf=0|site=www.fa2.de
WBR.
FOR.$$CNT|10|1000|10
CBR.SetZoom|$$CNT
CBR.GetZoom|$$TXT
DBP. Zoom is: $$TXT
NEX.
MBX.Browser exit
CBR.exit
ENR.
Remarks
At nearly all places, where you need numerical parameters, you can also use Formulas in (). Even if it is not explicitly stated in the description.
Limitations:
The two Scroll-commands (ScrollTo/Scroll) depend to some degree on the used WEB-Environment/IE-Control. However one of them should work in any environment. In most circumstances both should work.
See also:
• ! Smart Package Robot 's Browser and Office Commands
• LBR. - Launch (Mini-)Browser