Can I open folder where the game is installed with a button action?

Forum organization and occasional community-building.
Forum rules
Questions about Ren'Py should go in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
yoyuchi
Regular
Posts: 61
Joined: Sat Jul 09, 2022 1:39 pm
Contact:

Can I open folder where the game is installed with a button action?

#1 Post by yoyuchi »

Good days, everyone.
I want to open the folder where game is installed with a button action(click action).
I've searched for a solution for hours, but I can't find any information anywhere.
Renpy might not have the ability to open a folder with button click. I asking you experts.
It would be very helpful if you knew the command to open a folder with button action.
I would be disappointed if Renpy didn't have that feature, but...
Any help or advice would be appreciated.

action OpenURL("http://www.yahoo.com")

This is a command statement to open HTML. I thought a command to open a folder would be similar to this.
Please help!!!

User avatar
Donmai
Eileen-Class Veteran
Posts: 1963
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: Can I open folder where the game is installed with a button action?

#2 Post by Donmai »

Hi yoyuchi. It looks like your question is related to Ren'Py scripting. You will have a better chance of getting an answer if you ask in this forum section:
viewforum.php?f=8&sid=665874bcbffc6868be17e6fd95557867
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

ajay1203
Newbie
Posts: 9
Joined: Fri Nov 16, 2018 12:11 pm
Contact:

Re: Can I open folder where the game is installed with a button action?

#3 Post by ajay1203 »

Opening a folder directly from a button action in Ren'Py can be a bit tricky since Ren'Py is mainly focused on visual novels and doesn't have built-in functions for file manipulation like opening folders.

One workaround could be to use the os module in Python, which Ren'Py is based on. You could write a Python function to open the folder using os.startfile and then call that function from your Ren'Py button action.

giorgi1111
Regular
Posts: 163
Joined: Sat May 04, 2024 10:40 pm
Contact:

Re: Can I open folder where the game is installed with a button action?

#4 Post by giorgi1111 »

Os.startfile must be worked on windows only some other examples: import webbrowser, os
path="C:/Users"
webbrowser.open(os.path.realpath(path))
or with os alone

import os
os.system(f'start {os.path.realpath(path)}')
or subprocess

import subprocess,os
subprocess.Popen(f'explorer {os.path.realpath(path)}')
or

subprocess.run(['explorer', os.path.realpath(path)]) try each of this in function example init python: def openfolder(): import os
os.system(f'start {os.path.realpath(path)}') and in imagebutton action Function(openfolder()) try them. Ill try later

ajay1203
Newbie
Posts: 9
Joined: Fri Nov 16, 2018 12:11 pm
Contact:

Re: Can I open folder where the game is installed with a button action?

#5 Post by ajay1203 »

Thanks for the detailed examples! I appreciate you breaking down the different ways to open a folder using Python's os module, webbrowser module, and subprocess module. It's great to have multiple options to try out.

I'll definitely give these a shot and see which one works best for my needs. The os.system approach seems like a simple and straightforward solution, but it's good to know that there are other alternatives available.

giorgi1111
Regular
Posts: 163
Joined: Sat May 04, 2024 10:40 pm
Contact:

Re: Can I open folder where the game is installed with a button action?

#6 Post by giorgi1111 »

I remembered. Renpy allready have OpenDirectory for open any project game base images audio gui folders.i am using it to open renpy folder as its on another desktop. Im using action OpenDirectory(os.path.join(config.basedir, "."), absolute=True) itryed on imagebutton in test project .it works buut opens that test project game folder. You must change path what you want to open.
Image
https://ibb.co/nR7r2z9

Post Reply

Who is online

Users browsing this forum: No registered users