Is there any way to run different "lines from file" resources on the same element?

Support
  • Is there any way to perform different "lines from file" resources on the same element? For example I have 5 resources "lines from file" each containing a different email list, after using a certain amount of emails from list "a" it would start using emails from list b

  • @Jesorg

    Yes, you can perform different "lines from file" resources on the same element in Browser Automation Studio (BAS). Here's how you can do it:

    Create multiple "Lines from File" resources in BAS, each containing a different list of emails.
    Add a "Variable Manager" action to your script to create a variable that will hold the current email list that is being used.
    Use a loop to iterate through the emails in the current email list, using the "Lines from File" action to get the next email from the list.
    After you have used a certain number of emails from the current list, switch to the next email list by updating the value of the variable you created in step 2.
    Here's an example script that demonstrates how to do this:

    scss

    
    // Create an array of "Lines from File" resources
    var emailLists = [  Resources["List A"].GetResource(),
      Resources["List B"].GetResource(),
      Resources["List C"].GetResource(),
      Resources["List D"].GetResource(),
      Resources["List E"].GetResource()
    ];
    
    // Create a variable to hold the current email list index
    var currentEmailListIndex = 0;
    
    // Loop through the emails in the current email list
    for (var i = 0; i < 100; i++) { // Use 100 emails from each list
      // Get the next email from the current email list
      var email = emailLists[currentEmailListIndex].ReadLine();
    
      // Do something with the email, such as logging in to an account
    
      // Check if we have used enough emails from the current list
      if (i % 20 == 0 && i != 0) { // Switch to a new list after every 20 emails
        currentEmailListIndex++;
        if (currentEmailListIndex >= emailLists.length) {
          currentEmailListIndex = 0; // Start over with the first list
        }
      }
    }
    
    

    This script creates an array of "Lines from File" resources and a variable to hold the current email list index. It then loops through the emails in the current email list, getting the next email from the list and performing some action with it. After a certain number of emails (in this case, every 20 emails), it switches to the next email list by updating the value of the current email list index. When it reaches the end of the list of email lists, it starts over with the first list. You can customize this script to fit your specific use case by adjusting the number of emails to use from each list, the frequency of switching to a new list, and the actions to perform with each email.

  • Thanks for the answer