<< Click to Display Table of Contents >> Navigation: 3. Script Language > ! User-Macros > ! Smart Package Robot 's Script language |
Sample Code
Firefox-Library
These Subprogrammes are just Samples that i use to Click inside Firefox*-Browser
.
*For Details and Download see here: Firefox-Browser.
To use these Macros in your Script you may need to change some german Texts to fit to your your favourite language and Browser Version.
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'
'
'SPR Script-file: Firefox-Library
'Purpose:
'Author: Theo Gottwald
'Creation date: 11-08-2020 at 20:18:48
'===========================================================
'#EXE:?path\
'#SPI:ForceWrite
'
' COMMANDS:
' RUN FIREFOX and open Site www.fa2.de
' P1 - Site that should be opened
' %Firefox www.fa2.de
'
' Open a new TAB-Page
' P1 - Site to be opened
' P2 - optional - Number of site if multiple with same Text
' %New_TAB
'
' Locate the Firefox Mainwindow
' %Locate_TW
'
' Trage Link in Firefox ein
' P1 - Link to open
' %Firefox_Set_Site $$LNK
'
' Close Firefox
' %Firefox_Close
'===========================================================
' Main Script
'===========================================================
' This is teh site we are going to open
VAR.$$LNK=https://vk.com/friends?section=out_requests
VAR.$$PAR=-new-window
VAR.$$TAB=Freundschaftsanfragen
' This will locate FF and run it
' If the window is too large (1840,1644) change size in Library
VAR.$$PAX="$$LNK" $$PAR
%Firefox $$PAX
WII.10
' This will open a second TAB-Page with that link
%New_TAB $$LNK
%Firefox_Set_Site $$LNK
' Now we have 2 TAB's from the same site in Firefox
' This will Locate TAB #1 in Firefox with the given Text
' Changing the number will locate the TAB #2 (with the same text)
' To locate another Tab you only need to change the text and use $$NUM=1
MBX.Now we locate TAB #1 (which has the same Text)
%Locate_TAB $$TAB|1
MBX.Now we locate TAB #2 (which has the same Text)
%Locate_TAB $$TAB|2
MBX.Now we locate TAB #1 (which has the same Text)
%Locate_TAB $$TAB|1
' Here you can do your CLicks on the Site
' Sample Click
GSB.Loc_TW
AGR.43!WII.MOS.|Nicht mehr abonnieren||1|3|60
' Here comes your Script
%Firefox_Close
ENR.
'===========================================================
' Sub-Programmes
'===========================================================
'
: %Locate_TW 0
GSB.Loc_TW
END%
:Loc_TW
NEW.$$HWN
STW.ct|MozillaWindowClass|Mozilla Firefox
SWP.0,0|1840,1644|T
HTV.$$HWN
ELS.
STW.h|$$HWN
EIF.
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
' Kann ohne Parameter aufgerufen werden,
' oder mit einem Parameter mit dem Link für die neue Site
'
: %New_TAB 0
#IF PARAMS=1
SAV.Save|$$LNA
VAR.$$LNA=§§§01
GSB.New_TAB
PAU.1
%Firefox_Set_Site $$LNA
SAV.Restore
#EIF
#IF PARAMS=0
GSB.New_TAB
#EIF
END%
'-----------------------------------------------------------
:New_TAB
GSB.Loc_TW
AGR.43!WII.MLI.|Einen neuen Tab öffnen (Strg+T)||1|3|60
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
'
: %Firefox_Set_Site 1
SAV.Save|$$TXT
GSB.Set_Site|§§§01
SAV.Restore
END%
:Set_Site
VAR.$$TXT=§§_01
GSB.Loc_TW
AGR.43!WII.MLI.|Startseite||1|3|60
NAV.Rr|R|42
MLI.
KBC.Paste Over|$$TXT
SKP.{Enter}
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
'
' P1 - Text that is on the TAB we want
' P2 - optional the number of the TAB if it has the same Text like on other TABs
' normally Nr. is 1
' The minimum Number of Parameters is 1 thats why we have a "1" here after The Macroname
'
: %Locate_TAB 1
SAV.Save|$$NUM|$$TXT
VAR.$$TXT=§§§01
#IF PARAMS=1
VAR.$$NUM=1
GSB.Loc_TAB
#EIF
#IF PARAMS=2
VAR.$$NUM=§§§02
GSB.Loc_TAB|§§§01
#EIF
SAV.Restore
END%
'-----------------------------------------------------------
:Loc_TAB
GSB.Loc_TW
AGR.42!WII.MOS.|$$TXT||$$NUM|3|60
GSB.Loc_TW
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
'
: %Firefox 1
GSB.Lab_Run_Firefox|§§§01
END%
'-----------------------------------------------------------
:Lab_Run_Firefox
SAV.Save|$$PAT|$$NAM|$$RES|$$EXE|$$LNK
'-----------------------------------------------------------
IAI.Mozilla Firefox
VAR.$$LNK=§§_01
GSB.Lab_FF_starten
ELS.
MBX.Firefox ist nicht installiert.
END.
EIF.
RET.
:Lab_FF_starten
VAR.$$NAM=$tos$
GII.$$NAM|$$RES|u
BLB.$$RES|$$RES
BLB.$$RES|$$RES
' $$PAT enthällt Programmpfad ohne "\"
VAR.$$PAT=$$RES
VBT.$$PAT|"
VAR.$$EXE=$$PAT\Firefox.exe
IEF.$$EXE
EXE.$$EXE|$$LNK
ELS.
MBX.Kann FF nicht starten.
END.
EIF.
SAV.Restore
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
: %Firefox_Close 0
GSB.Lab_Close_FF
END%
:Lab_Close_FF
GSB.Loc_TW
CLW.$$HWN
STW.ct|MozillaDialogClass|schließen?&OR:close
' AGR. uses a waiting time of 60 seconds, you can change it below.
AGR.43!WII.MOS.|Tabs schließen&OR:close||1|3|60
MLI.
RET.
'-----------------------------------------------------------
'
'-----------------------------------------------------------
'-----------------------------------------------------------
'===========================================================