Git Product home page Git Product logo

Comments (2)

in420weblaze avatar in420weblaze commented on May 22, 2024

Hello, I have managed to create a function to launch the RuneLite client with the settings, however it seems tKinter <or Python?> doesn't like to play nice unless you thread that button. This allows you to launch the client, and still use the OSBC UI. However, I think because not everything is multithreaded that this approach will not work?

Let me know. Below is what I did in the home_view_osrs.py with a complete flow:

import threading

self.grid_rowconfigure(9, weight=0)  # - Launch btn
# Launch Btn
self.btn_launch = customtkinter.CTkButton(master=self,
                                       text="Launch",
                                       #fg_color="gray40",
                                       #hover_color="gray25",
                                       command=threading.Thread(target=self.__launchrunelite_with_settings).start)
self.btn_launch.grid(row=9, column=0, sticky="nwes", padx=40, pady=(0, 15))
def __launchrunelite_with_settings(self):
    # Start by grabbing the logged in user
    currentUser = os.getlogin()

    # src path for our runelite bot settings
    PATH = Path(__file__).parent.parent.resolve()  # src directory

    # executable path for runelite, taking the current logged in user
    # this is a default path for a windows user
    EXECPATH = f"C:\\Users\\{currentUser}\\AppData\\Local\\RuneLite\\RuneLite.exe"

    # executable args for runelite to direct the client to launch with bot settings
    EXECARGS = f" --clientargs \"--config={PATH}\\runelite_settings\\settings.properties\""

    #possible outdated method, but only method I could manage to get to work
    self.main.toggle_btn_state(enabled=True)
    os.system(EXECPATH + EXECARGS)

from os-bot-color.

kelltom avatar kelltom commented on May 22, 2024

Just placing your updated code here for reference:

# UI Code
self.grid_rowconfigure(9, weight=0)  # - Launch btn

# Launch Btn
self.btn_launch = customtkinter.CTkButton(master=self,
                                        text="Launch",
                                        #fg_color="gray40",
                                        #hover_color="gray25",
                                        command=self.__launchrunelite_with_settings)
self.btn_launch.grid(row=9, column=0, sticky="nwes", padx=40, pady=(0, 15))
from subprocess import DETACHED_PROCESS, Popen

def __launchrunelite_with_settings(self):
    # src path for our runelite bot settings
    PATH = Path(__file__).parent.parent.resolve()

    # currently logged in user <windows>
    currentUser = os.getlogin() 

    # executable path for runelite, taking the current logged in user
    # this is a default path for a windows user
    EXECPATH = f"C:\\Users\\{currentUser}\\AppData\\Local\\RuneLite\\RuneLite.exe"

    # executable args for runelite to direct the client to launch with bot settings
    EXECARG1 = "--clientargs"
    EXECARG2 = f"--config={PATH}\\runelite_settings\\settings.properties"

    self.main.toggle_btn_state(enabled=True)
    client = Popen([EXECPATH, EXECARG1, EXECARG2], creationflags=DETACHED_PROCESS)

from os-bot-color.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.