How to run something once on every start of runner



  • You can use this little LS to collect usage data etc. It will run your defined block/blocks once per runners start. Than skip it until you stop and restart. Enjoy!

    IF "<REGISTER>" Exists
    JUMP #START
    ENDIF
    SET GVAR "REGISTER" "OK"
    ##Put block/script here that you want to run only once on checking started
    ##Rename your first block to START so it can jump to configs real start
    
    #START FUNCTION Constant ##Real configs start 
    


  • Hello,
    looks like this trick is not working anymore ? i have a 100% working config, but when i do this it goes in full retry so i guess it Jumps all the time and it never execute the piece of code before the #start...
    Can you please confirm it's still the correct way to create a variable that all bots will use ? in order to not doing it each time in all bots ?

    Here is what i'm doing

    IF "<Token>" Exists
    JUMP #Go
    ENDIF
    SET NEWGVAR "Token" ""
    BEGIN SCRIPT JavaScript
    var a = 'abcdef';
    var b = 'AhpMNPkSzAOmt0MZWqkS1AZ1da0RVdpX'; 
    Token = a + b;
    END SCRIPT -> VARS "Token"
    SET GVAR "Token" "<Token>"
    
    #Token FUNCTION Hash SHA1 "<Token>" -> VAR "Token" 
    
    #Go REQUEST POST "https://www.mysite.com"
    

    i tried, with and without NEWGVAR, same problem.... it goes in full retry.


  • Admin

    You should not name Token both the local and the global variables, it might mess things up.



  • OK Thanks !


Log in to reply