How To make a reusable code using sensetalk

Hi , I am trying to make function like following
function Login

DoubleClick "MozillaFirefox"
(* *)
Click (Image:"MozillaFirefoxStartPageJLJJUtI", WaitFor:2)
TypeText "http://localhost:8080/servoy-webclient/solutions/solution/sampleuse_navigation"
TypeText Return
Click "Username"
TypeText "superuser"
Click "Password"
**few steps more

Click "LOGIN"

end Login

Now when I try to call this function as Login it does not work , Please suggest what to improve

Comments

  • Hi..its simpler than wat u have tried.

    Remove the line "Function Login"
    Now save the rest of the lines in script.
    You can call this script from another script just by using its name.
    Ex
    Run ScriptName


    This is if your re-usable script is in same suite..
    if its from another suite, u can just specify the whole path.
    Ex
    Run D\Testsuite\scrips\test.script
  • vitaluvitalu Member
    Hi saurabhdevgun,

    See below answer for your query
    function Login 
    
    DoubleClick "MozillaFirefox" 
    (* *) 
    Click (Image:"MozillaFirefoxStartPageJLJJUtI", WaitFor:2) 
    TypeText "http://localhost:8080/servoy-webclient/solutions/solution/sampleuse_navigation" 
    TypeText Return 
    Click "Username" 
    TypeText "superuser" 
    Click "Password" 
    **few steps more 
    
    Click "LOGIN" 
    
    end Login 
    

    The function name is LOGIN
    Just you can call anywhere in script.
    If suppose this function is developed in one script called Eggplant.script
    So you can just call
    Put Eggplant.LOGIN
    
    So script will go to Eggplant script and call the LOGIN function.

    Just try, let me know if you have doubt

    Thanks,
    Vital U
    [email protected]
    9739779968
  • Hello,

    You may also find the information on this page helpful: http://docs.testplant.com/?q=content/re-using-code
Sign In or Register to comment.