I'm working on a script where I need to allow the user to select a folder on their system.
This WinAPI will apparently do the job, but I find it incredibly hard to follow - it seems to need you to call a different function (API?) both before and after SHBrowseForFolder, and I have no idea about the arguments/structures required.
Is anyone able to get this up and working, or aware of an alternative I could use instead?
http://msdn.microsoft.com/en-us/library/bb762115(v=vs.85).aspx
WinAPI - calling SHBrowseForFolder from RGSS
● ARCHIVED · READ-ONLY
-
-
Ruby has a Dir class. I think writing a new scene instead of calling this function is a good alternative (especially because it would look like the rest of the game). You can use Window_Help and Window_Command (commands are the directories). Do you need something else?
-
I know about the Dir class. I did consider writing a new class that would handle it all and avoid the API. But this is just a single task that I need for a (possibly) rather large and complex script. I don't really want to spend that much time implementing something that would mimic the behaviour.
Maybe for now I'll just put the full path in variables and when I release the script I'll tell people they'll have to change it to whatever they want to use.
Not elegant, but it'll let me move on to the REAL script that I'm trying to develop.
Oh - it's a development script, not something players will ever see, so it doesn't need to look like the rest of the game. :)
I did see a reference to a require wins which is apparently a Ruby script/tool/plugin/whatever, but it requires installing and I can't really ask people to do that just to use the script. Maybe it's not as difficult as I think? -
I see. It's definitely possible to use this function, but it's also not something that should be written in Ruby. But I'll take a look at it. Any restrictions on the RGSS version (RGSS3 only would make things easier)?
Edit: The following code needs some serious cleanup, but should work in every version.
Edit 2: Removed old version. Click here to get the current one. -
OMG I love you soooooo much right now!!!!
Thank you - it works perfectly!
I will be sharing my script with the community when it's done and will include this snippet (with credit to you, naturally). If you think it needs a cleanup and would like to do that before I release it, go for it, then just post back the new version. Otherwise, it works, and that's all that really matters to me, so I'm also happy to include it as-is.
Also, I AM using RGSS3, but my script might also work for VX and XP - I'll have to test them out when I'm done. Is there anything in the above that you think might cause issues in older makers?
Another question ... is there a way to make it start in the working folder by default? -
I've cleaned it up.If you think it needs a cleanup and would like to do that before I release it, go for it
No, I don't think so. As I've said before, it should work with XP and VX. If it doesn't, then I'll fix it.Is there anything in the above that you think might cause issues in older makers?
Yes, there is, but the RGSS doesn't have a way to create callback functions. So the actual answer is no.Another question ... is there a way to make it start in the working folder by default? -
Thank you for that.
I just do this?
folder_name = BrowseForFolder.select('Choose your folder')