SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 5 of 5

Thread: Loop

  1. #1
    Member
    Join Date
    Jan 2004
    Location
    Cairo
    Posts
    41
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Loop

    Hi
    The site i'm working on should can create Folders, so i want to make a loop to create say 100 folders, the idea is that i'm creating folders with names Folder1, Folder2, where the num is a random number, so i wrote a formula in the DataTable, but i dont know how to make this formula create many folders in sequence, i tried to use Test->settings->data table iterations, but this require that the data table be filled with many values, i only have a formula with no values..can anyone help..

  2. #2
    Member
    Join Date
    Aug 2003
    Location
    Richmond VA
    Posts
    62
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Loop

    I'm not sure that I understand your problem, but to just create folders (I'm not sure what that command is) couldn't you just say something like this?

    dim indexer

    for indexer = 1 to 100
    create folder("Folder" + CSTR(indexer))
    next

  3. #3
    Member
    Join Date
    Jan 2004
    Location
    Cairo
    Posts
    41
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Loop

    Guys...i find a way to solve it, in case that anyones face this problem in future..
    it's quite simple..
    make a for loop with number of iteration u want, and within this loop, declare a varaible for the folder name, for example str = "Folder"& i, where i is the counter in the for loop..
    copy this value to the datatable with the property value, and set it back where you want it to be [img]images/icons/smile.gif[/img]
    et voila [img]images/icons/grin.gif[/img]

  4. #4
    SQA Knight
    Join Date
    Jan 2002
    Location
    Highlands Ranch, CO, USA
    Posts
    2,860
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Loop

    Put the following into a VBS file (common.vbs) and call the function with what you want to create. You will need to do an ExecuteFile, for example ExecuteFile("c:\AutoTest\Libs\common.vbs"), in your script in order to call the function.

    ---------------------
    public Function AddNewFolder(path, folderName)
    Dim fso, f, fc, nf
    Set fso = CreateObject("Scripting.FileSystemObject")

    If(fso.FolderExists (path & folderName)) Then
    AddNewFolder = 0
    'Exit Function
    else
    Set f = fso.GetFolder(path)
    Set fc = f.SubFolders
    If folderName <> "" Then
    Set nf = fc.Add(folderName)
    AddNewFolder = 1
    end if
    end if
    End Function
    -----------------------

    Good luck.

    Jim
    Jim
    -------------------------------------------
    For all the general stuff to know about QA/Test go here http://www.softwareqatest.com/

  5. #5
    Member
    Join Date
    Aug 2003
    Location
    Richmond VA
    Posts
    62
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Loop

    wouldn't this also work?

    Dim fso, f, fc, nf, indexer
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.GetFolder(path)
    Set fc = f.SubFolders
    for indexer = 1 to 100
    Set nf = fc.Add("New Folder" + CSTR(indexer))
    next

 

 

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 11.54%
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 12:12 AM.

Copyright BetaSoft Inc.