SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Advanced Member
    Join Date
    Oct 2010
    Location
    USA
    Posts
    578
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Calling Function...is this right?

    Browser("Systima Test").Page("Systima Test_2").WebEdit("WhoFor__customerName").Set RandomString(7)
    Call RandomName(8,rName)
    MsgBox rName

    Function RandomName(chrs,rName)
    For i = 1 To chrs
    Randomize
    vRandChar = Int((26 * Rnd) + 1)
    rName = rName & Chr(vRandChar + 64)
    Next
    End Function

    Hers is the original script
    Browser("Systima Test").Page("Systima Test").WebEdit("Site__name").Set "Any Name"

    And instead of having "Any Name" as the value, I would like to generate a Random name.

  2. #2
    Member
    Join Date
    Aug 2008
    Posts
    150
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Calling Function...is this right?

    TestString = RandomName(8)
    Browser("Systima Test").Page("Systima Test_2").WebEdit("WhoFor__customerName").Set TestString

    Function RandomName(chrs)
    For i = 1 To chrs
    Randomize
    vRandChar = Int((26 * Rnd) + 1)
    rName = rName & Chr(vRandChar + 64)
    Next
    RandomName = rName
    End Function

  3. #3
    Member
    Join Date
    Feb 2007
    Location
    London
    Posts
    391
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Calling Function...is this right?

    Hi Oceans

    Your error here was down to your programming - in mehlerr's example above he first of all assigns the random string to a variable:

    TestString = RandomName(8)

    This will set TestString to the output of the RandomName function. From here he sends the TestString as a parameter when performing the .set method:

    Browser("Systima Test").Page("Systima Test_2").WebEdit("WhoFor__customerName").Set TestString

  4. #4
    Senior Member
    Join Date
    Mar 2009
    Posts
    184
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Calling Function...is this right?

    Or:

    Browser("Systima Test").Page("Systima Test_2").WebEdit("WhoFor__customerName").Set RandomName(8)

    or

    Browser("Systima Test").Page("Systima Test_2").WebEdit("WhoFor__customerName").Set RandomName(randomNumber(5,10))

    The second one will call the fucntion with a random number between 5 and 10. So you would get a random lengthed random name.

    Peace

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 10.00%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 06:54 PM.

Copyright BetaSoft Inc.