Is there any way to let thread automatically edit resource while running?



  • I have 2 questions:

    1. Is there any way to let thread automatically edit resource while running? I see that only human can change resource. For example, I set resource changeSocks value =0. When bad socks happened changeSocks will be set to 1 and the next round proxy will be applied.
    2. Can you add feature that delete lines from file on command not through resource. For example, sometimes thread fails when time out and thread delete lines already. So can I delete that line only when thread succeed or in some particular cases.
      Thanks.


  • Another question: Can I append data from resource load lines from files?
    For example: Write file {{file}} ?



  • @ryantuan said:

    I have 2 questions:

    1. Is there any way to let thread automatically edit resource while running? I see that only human can change resource. For example, I set resource changeSocks value =0. When bad socks happened changeSocks will be set to 1 and the next round proxy will be applied.

    No, but there is global variables and local variables. Local variables are widely used and available during thread lifetime. They are framed with double square brackets.

    Global variables are available during all script lifetime. You can create global variable changeSocks and change it whenever you like. You can also use OnApplicationStart function to initialize it, copy from resource for example.

    1. Can you add feature that delete lines from file on command not through resource. For example, sometimes thread fails when time out and thread delete lines already. So can I delete that line only when thread succeed or in some particular cases.

    Change resource fail number from 1 to greater value if you don't want to delete on fail. If you want to delete lines on cutom condition, set fail number and success number to something like 10000 and execute custom code when you want to delete line:

    R("file")!
    _result().die()

    Where "file" is resource name.



  • @ryantuan said:

    Another question: Can I append data from resource load lines from files?
    For example: Write file {{file}} ?

    I don't understand, you want to append line to file, or concat strings?



  • Re: Is there any way to let thread automatically edit resource while running?

    For example:
    My file
    IloveYou
    Ihateyou

    During execution Iloveyou return fail.
    So I want my file will be
    Ihateyou
    Iloveyou

    And then repeat until success.



  • Set fail number of resource to big value to achieve this.
    0_1461495224083_FilaNumber.png


Log in to reply