Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users

    Recommended Posts

    Posted (edited)

    You can create a batch file with command line arguments for a specific user and script. Now that Dreambot has a built-in scheduler, life is even easier. 

    With the argument "-script script_name_here" we can have an account launch an instance and cycle through several tasks by running just a batch file for each account we want running. I currently have it take my freshly created account details and turn them into a trade-ready account.

     

    You can use a Python script to create bulk batch files from an account.txt file (USN:PASS format):

    import os
    
    # Read accounts from accounts.txt
    with open('accounts.txt', 'r') as file:
        accounts = file.read().splitlines()
    
    # Updated template for the batch file
    batch_template = """java -Xmx500M -jar "C:\\Users\\User\\DreamBot\\BotData\\client.jar" -schedule Fresh -proxyHost 00.000.000.000 -proxyPort 0000 -accountUser "{email}" -accountPass {password} -userhome {email} -covert
    """
    
    # Create batch files for each account
    for i, account in enumerate(accounts, start=1):
        email, password = account.split(':')
        batch_content = batch_template.format(email=email, password=password)
    
        batch_filename = f'account{i}.bat'
        with open(batch_filename, 'w') as batch_file:
            batch_file.write(batch_content)
    
        print(f'{batch_filename} created successfully.')

     

    You should be able to add a timer to close the application after a set period, but I'm still trying to make this work:

    import os
    
    # Read accounts from accounts.txt
    accounts_file_path = 'accounts.txt'
    client_jar_path = 'C:\\Users\\USER\\DreamBot\\BotData\\client.jar'
    
    if not os.path.exists(accounts_file_path):
        print(f"Error: {accounts_file_path} not found.")
        exit()
    
    with open(accounts_file_path, 'r') as file:
        accounts = [line.strip() for line in file]
    
    # Updated template for the batch file
    batch_template = """start java -Xmx500M -jar "{client_jar_path}" -schedule Fresh -proxyHost 00.000.000.000 -proxyPort 0000 -accountUser "{email}" -accountPass {password} -userhome {email} -covert
    timeout /t 900 /nobreak  REM Wait for 900 seconds (15 minutes)
    taskkill /F /IM java.exe
    exit
    """
    
    # Create batch files for each account
    for i, account in enumerate(accounts, start=1):
        try:
            email, password = account.split(':')
        except ValueError:
            print(f"Error: Invalid account format in line {i} of {accounts_file_path}.")
            continue
    
        batch_content = batch_template.format(email=email, password=password, client_jar_path=client_jar_path)
    
        batch_filename = f'account{i}.bat'
        with open(batch_filename, 'w') as batch_file:
            batch_file.write(batch_content)
    
        print(f'{batch_filename} created successfully.')

     

    In theory, you could chain the batch files together and add an exit java.exe line after the timer and before the next batch file is run. This should run the schedule for x time and then close the client, and start the next account. Still working on this part, tho.

     

    Edited by CatnipandMilk
    • 4 weeks later...
    Posted

    can this be ran with instructions for multiple accounts to run at the same time or is it one instance/account per schedule ?

     

    Posted

    You can run as many accounts as you open. It makes a batch file for each account and you can just open all of them at once with CPU/RAM being the limiting factor.

    Posted

    i have a fresh off tut island account. i want it to mine copper (dropping ores) to level 10 and then stop. can you show a script describing this application ?

     

    Posted

    Replace this part:

    # Updated template for the batch file
    batch_template = """start java -Xmx500M -jar "{client_jar_path}" -schedule Fresh -proxyHost 00.000.000.000 -proxyPort 0000 -accountUser "{email}" -accountPass {password} -userhome {email} -covert
    timeout /t 900 /nobreak  REM Wait for 900 seconds (15 minutes)
    taskkill /F /IM java.exe
    exit

    with your script and it's parameters/arguments/CLI commands

    # Updated template for the batch file
    batch_template = """start java -Xmx500M -jar C:/Users/YOURUSER/DreamBot/BotData/client.jar -schedule Fresh -proxyHost 00.000.000.000 -proxyPort 0000 -script "BarMiner" -params "Bronze - Lumbridge" -account "[email protected]" -covert -world f2p
    timeout /t 900 /nobreak  REM Wait for 900 seconds (15 minutes)
    taskkill /F /IM java.exe
    exit

    If you don't have a proxy, just delete that part.

    • 7 months later...
    Posted (edited)

    Thanks for sharing this! I went ahead and made some improvements to the script. Instead of creating separate batch files, we can now launch the clients directly from the Python script itself, no need for batch files anymore. You just need to specify which accounts you want to launch after you run the script, and the script will handle the rest automatically.

    import os
    import subprocess
    import time
    
    def get_script_directory() -> str:
        return os.path.dirname(os.path.abspath(__file__))
    
    def load_accounts(file_path: str) -> list:
        if not os.path.exists(file_path):
            raise FileNotFoundError(f"Error: {file_path} not found.")
        
        with open(file_path, 'r') as file:
            return [line.strip() for line in file if line.strip()]
    
    def display_accounts(accounts: list) -> None:
        print("Available accounts:")
        for index, account in enumerate(accounts, start=1):
            email = account.split(':')[0]
            print(f"{index}: {email}")
    
    def get_selected_indices() -> list:
        try:
            user_input = input("Enter the indices of the accounts you want to open (comma-separated, e.g., 1,3,5): ")
            return [int(i.strip()) - 1 for i in user_input.split(',')]
        except ValueError:
            raise ValueError("Invalid input. Please enter comma-separated numbers.")
    
    def create_command_template(client_jar_path: str) -> str:
        return (
            f'java -Xmx500M -jar "{client_jar_path}" '
            '-schedule Fresh '
            '-proxyHost PROXY_IP -proxyPort PROXY_PORT ' ##Replace "PROXY_IP" & "PROXY_PORT" with your actual proxy IP & Port.
            '-proxyUser PROXY_USERNAME -proxyPass PROXY_PASSWORD ' ##Replace "PROXY_USERNAME" & "PROXY_PASSWORD" with your actual proxy Username & Password.
            '-accountUser "{{email}}" -accountPass {{password}} '
            '-userhome {{email}} -covert'
        )
    
    def launch_clients(accounts: list, selected_indices: list, command_template: str) -> None:
        for index in selected_indices:
            if 0 <= index < len(accounts):
                email, password = accounts[index].split(':')
                command = command_template.format(email=email, password=password)
                subprocess.Popen(command, shell=True)
                time.sleep(1)
            else:
                print(f"Error: Index {index + 1} is out of range.")
    
    def main():
        script_directory = get_script_directory()
        accounts_file_path = os.path.join(script_directory, 'accounts.txt') ##the accounts.txt should be located in the same directory you created the pythons script in.
    
        try:
            accounts = load_accounts(accounts_file_path)
            if not accounts:
                print("No accounts found in the file.")
                return
            
            display_accounts(accounts)
            selected_indices = get_selected_indices()
            client_jar_path = r'C:\Users\WDAGUtilityAccount\DreamBot\BotData\client.jar' ##Make sure you change this directory to your own.
            command_template = create_command_template(client_jar_path)
    
            launch_clients(accounts, selected_indices, command_template)
            print("All selected clients have been launched.")
        except Exception as e:
            print(f"An error occurred: {e}")
    
    if __name__ == "__main__":
        main()

     

    Edited by BotCorpLTC

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.