Author Topic: Passing command line arguments within a layout  (Read 170 times)

BOXXMAN

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Passing command line arguments within a layout
« on: May 25, 2017, 04:15:08 PM »
How would you go about passing system and rom information as variables to a command line? For example, I am trying to use Rocketlauncher in a layout to bring up the pause menu for the current game in the display by using

fe.plugin_command("/Rocketlauncher/Rocketlauncher.exe", -s [system] -r [name] -p AttractMode -m pause");

However, if I try to pass arguments as magic tokens (which I'm assuming is wrong) in [brackets] it doesn't work. I have also tried enclosing in quotes ["name"], and "[name]", plus just about every way i can think of with or without brackets and quotes. Everything either shows up as a literal string, or crashes the layout. What is the correct way to get these parameters and pass them as arguments? The frontend itself seems to have no problem doing it when inputting the arguments to set up the emulator. Also, it would be appreciated if you could point me in the right direction how to add this of some sort of function that can be called on when one of the "custom" buttons is pressed. Thanks for any help with this. :-[

qqplayer

  • Sr. Member
  • ****
  • Posts: 100
    • View Profile
Re: Passing command line arguments within a layout
« Reply #1 on: June 09, 2017, 03:07:59 AM »
I´m looking for the same thing.
Sorry to say this but I think that this is a great f.e. with tons of posibilities but sometimes I feel totally lost.
Users need more "officiall" support.
The main developer doesnt answer on github...
I can´t find an updated wiki with all the f.e. options...
I know people in this forum helps a lot but you know... maybe the main developer could help us in the right way with most of our problems.

 


BOXXMAN

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Passing command line arguments within a layout
« Reply #2 on: June 09, 2017, 10:42:13 PM »
Yeah, I mean I like the idea of how open it is, but it's kind of a steep learning curve on some things. I could do a lot with Hyperspin using AHK scripts to run other programs that you could pass the variables of rom and system from it easily. However, I like the flexibility and to customize this fe in any way you like. I can do pretty much anything visually I want with it, but figuring out how to pass variables to any external application is aggravating. I could just figure out how to do that, it would be easy to add a manual reader, a secondary marquee display, or any other number of things into a layout that require a variable. I'm still trying to figure it out, I'll let you know if I manage to.

keilmillerjr

  • Sr. Member
  • ****
  • Posts: 263
    • View Profile
Re: Passing command line arguments within a layout
« Reply #3 on: June 10, 2017, 03:25:51 AM »
Hyper Shlt was a pain in the @ss to try and set up. Thats why I initially switched to attract mode. Anyways…

Code: [Select]
fe.plugin_command( executable, arg_string )
The plugin command takes an argument string. Have you tried returning a function inside the string?

Not tested, but try something along these lines and let me know how you make out.

Code: [Select]
fe.plugin_command("/Rocketlauncher/Rocketlauncher.exe", "-s „ + fe.game_info(Info.System) + " -r „ + fe.game_info(Info.Name) + " -p AttractMode -m pause");

BOXXMAN

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Passing command line arguments within a layout
« Reply #4 on: June 10, 2017, 08:58:27 AM »
That gets me a bit closer  to results. I'm not sure how you are making those lower style closing ", and maybe that's why i'ts not working. As it is, I used "" to enclose everything, and it does partially pass the name now, but still with problems. For example, I tried it with Sony Playstation 2 as the system, and it outputs -sSony as the system. So, it is sending the -s as a string as well as the command line switch, and the system name is getting cut off as well. Any ideas?

keilmillerjr

  • Sr. Member
  • ****
  • Posts: 263
    • View Profile
Re: Passing command line arguments within a layout
« Reply #5 on: June 11, 2017, 06:01:52 AM »
That gets me a bit closer  to results. I'm not sure how you are making those lower style closing ", and maybe that's why i'ts not working. As it is, I used "" to enclose everything, and it does partially pass the name now, but still with problems. For example, I tried it with Sony Playstation 2 as the system, and it outputs -sSony as the system. So, it is sending the -s as a string as well as the command line switch, and the system name is getting cut off as well. Any ideas?

Typing in safari on my Mac automatically reverses ending quotes. That's why I said to do something like that. I just moved this week and haven't even fully unpacked. Make sure you include a space after and before your param flags. As far as the system name being short, try printing it to terminal and see if it yields the same or different result.

BOXXMAN

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Passing command line arguments within a layout
« Reply #6 on: June 11, 2017, 11:53:22 AM »
That gets me a bit closer  to results. I'm not sure how you are making those lower style closing ", and maybe that's why i'ts not working. As it is, I used "" to enclose everything, and it does partially pass the name now, but still with problems. For example, I tried it with Sony Playstation 2 as the system, and it outputs -sSony as the system. So, it is sending the -s as a string as well as the command line switch, and the system name is getting cut off as well. Any ideas?

Typing in safari on my Mac automatically reverses ending quotes. That's why I said to do something like that. I just moved this week and haven't even fully unpacked. Make sure you include a space after and before your param flags. As far as the system name being short, try printing it to terminal and see if it yields the same or different result.

So, adding the spaces before and after the param flags did the trick as far as it passing. However, the problem is that it seems to cut off the system if it is more than one word, eg. Sony Playstation only sends Sony. I confirmed this, because it will work with mame, or other one name systems. There still seems to be a problem with the rom parameter though, as it doesn't seem to be sending anything. Would I need to wrap the (Info.System) command in quotes to stop it from cutting it off? Wait, I did get system and rom to pass properly now with one word names. It worked with "Colecovision" and "Evolution", as system and rom. So, the only problem now is figuring out how to get it to send names with spaces without cutting them off.
« Last Edit: June 11, 2017, 12:08:35 PM by BOXXMAN »

BOXXMAN

  • Jr. Member
  • **
  • Posts: 18
    • View Profile
Re: Passing command line arguments within a layout
« Reply #7 on: June 18, 2017, 09:01:32 AM »
I'll ask again if there's anyone who can help me figure this out. All I need to know is how to pass the full string without it cutting it off at the space. Thanks in advance for any help.