Jump to content
The simFlight Network Forums

FSUIPC 6 Run Command issue


Recommended Posts

-I've used the Programs section of the FSUIPC ini file to run some programs and it works well.  I am now trying to run another program but keep ending up with an error 237.  the entries in the Program section are.  I'm on FSUIPC 6.

Run2=READY,CLOSE,C:\Users\NAME\AppData\Local\FS-Keypad\FS-Keypad.exe C:\Users\NAME\AppData\Local\FS-Keypad\Keypads\303df744-c367-4681-a409-4ac2f187b39e.json

Run3=READY,CLOSE,C:\Users\NAME\AppData\Local\FS-Keypad\FS-Keypad.exe C:\Users\NAME\AppData\Local\FS-Keypad\Keypads\d221813d-fb88-4233-a6c6-c7491de17616.json

and the fsuipc.log has this in it.

    31437 FSUIPC couldn't run: "C:\Users\NAME\AppData\Local\FS-Keypad\FS-Keypad.exe C:\Users\NAME\AppData\Local\FS-Keypad\Keypads\303df744-c367-4681-a409-4ac2f187b39e.json" [Error=267]
    31437 FSUIPC couldn't run: "C:\Users\NAME\AppData\Local\FS-Keypad\FS-Keypad.exe C:\NAME\Brett\AppData\Local\FS-Keypad\Keypads\d221813d-fb88-4233-a6c6-c7491de17616.json" [Error=267]

If I run the command (minus the Runx=READY,CLOSE,) in a command window it works perfectly and brings up the window.  I've tried to locate the error codes in the FSUIPC documentation but didn't find them.

I must be doing something wrong but just can't find it. Based on the documentation and other posts dealing with the Programs section this should work.

Link to comment
Share on other sites

Hi,

 

Have you already tried to run it with quotes arround the command?

Run2=READY,CLOSE,"C:\Users\NAME\AppData\Local\FS-Keypad\FS-Keypad.exe C:\Users\NAME\AppData\Local\FS-Keypad\Keypads\303df744-c367-4681-a409-4ac2f187b39e.json"

 

Error 267 = directory name invalid (I assume)

Rgds
Reinhard

 

Link to comment
Share on other sites

Posted (edited)

Ahh. Quotes on the entire string as in aua668 reply.  I had quotes around each section - the exe path and the parameter - and just around the parameter but not around the whole thing. 

To clarify it for me.  the manual (advanced) shows quotes around a path and around the parameter - each has it's own set of quotes but from what I see here you have to quote the exe and it's path along with any parameters - all in one set of quotes?

Thanks. I'll try it shortly.

So those are Windows return codes then, not FSUIPC.  No wonder they weren't in the FSUIPC manual <G>!

 

Edited by DakotaPilot
Link to comment
Share on other sites

8 minutes ago, DakotaPilot said:

To clarify it for me.  the manual (advanced) shows quotes around a path and around the parameter - each has it's own set of quotes but from what I see here you have to quote the exe and it's path along with any parameters - all in one set of quotes?

But you have no parameters - at least not in what you posted,
Quotes are only needed if the path contains spaces or if command line parameters are needed, as specified in the Advanced User manual, although it never does any harm to include them anyway. As (I presume) you replaced your actual name with the string NAME, we can't tell what the actual path is, but if it has spaces, it needs to be in quotes.

As a test, you can also try running your run command from a terminal window, to see if it actually works outside of FSUIPC.

Link to comment
Share on other sites

I was assuming the second portion containing the JSON file was a parameter to the first part with the exe hence my confusion.

There were no spaces in the path but I include them out of habit working with various systems that sometimes get snarky when handling spaces.

 

 

Link to comment
Share on other sites

Just now, DakotaPilot said:

I was assuming the second portion containing the JSON file was a parameter to the first part with the exe hence my confusion.

Ah, sorry - missed that! Then you should do as the manual suggests, quotes around the program start path and quotes around the parameter. You have no quotes, e.g.
 

13 hours ago, DakotaPilot said:

Run2=READY,CLOSE,"C:\Users\NAME\AppData\Local\FS-Keypad\FS-Keypad.exe" "C:\Users\NAME\AppData\Local\FS-Keypad\Keypads\303df744-c367-4681-a409-4ac2f187b39e.json"

If that doesn't work, you can try quotes around the whole line, but try that, as documented, first...

 

Link to comment
Share on other sites

Okay.  It appears that the exe doesn't look at the path but has to be in the same directory as the file.  The desktop shortcut has not only the full path for the parameter but it seems to ignore the path part of the parameter and only look for the filename. Since the desktop shortcut has a working directory defined it moves to it, then looks for the file. At least that's what I think is happening. 

Anyway, I'll create a script to move to that directory and then execute those commands.

Thanks for the help.

 

Link to comment
Share on other sites

24 minutes ago, DakotaPilot said:

It appears that the exe doesn't look at the path but has to be in the same directory as the file.  The desktop shortcut has not only the full path for the parameter but it seems to ignore the path part of the parameter and only look for the filename.

Hmm/ Sounds a bit strange... Especially as the command works when you run it in a command window, which would suggest that the program is picking up the correct path.
I think it may depend on which shell is being used to run/interpret the command. Did you try both with double quotes around the program location and the argument separately? And also around the whole command line command?
 

And even if the command line argument is incorrect, doesn't the program start anyway and give some sort of error that the file can't be found? Or is the program closing and returning error code 267?

Link to comment
Share on other sites

I tried quoting it all.  No luck there.  I've had quotes on both the program and argument separately, and with none on the program but on the argument.  Same result.  The 267 error shows up in the FSUIPC log file. The program log files do not show anything but if it never started then that makes sense.  The program never starts at all, no window that comes up and disappears, nothing.

 

 

Link to comment
Share on other sites

I found the issue.  I wrote a Powershell script to start the exe and run one of the JSON files.  Despite the fact that the full path to the JSON file is include it is ignored by the program.  If I have the Powershell script cd to the apps home directory and then run the program with it's argument all is well.  If I comment out the CD it whines.

I'll let the author know as he may be making the assumption it always runs from a shortcut he creates which has the working directory so in effect it's cd'ing to the proper place and runs.

 

Link to comment
Share on other sites

I did some more testing and contacted the author.  The program is supposed to run and if the json file has a full path it uses it.  I tested it in cmd and with a Powershell script where I did not change to the application's home directory and the program ran and started the proper window.  However if I use the above command in FSUIPC I get the 267, invalid directory error.  I also tried this command

Run2=READY,CLOSE,Powershell "-command C:\Users\NAME\AppData\Local\FS-Keypad\FS-Keypad.exe C:\Users\NAME\AppData\Local\FS-Keypad\Keypads\303df744-c367-4681-a409-4ac2f187b39e.json"

I'm not sure what is going on but a workaround is to finish something I was going to do a while back until I found the FSUIPC Run section.  I'll create a script and have it run what I need.

I assume that to run a Powershell command I can use the syntax

Run2=powershell "-command Mycommandhere"

From the command line this would be

powershell  -command Mycommandhere

where Mycommand here is a Powershell command file.

Link to comment
Share on other sites

Hi,

 

That's how I run my programs without any problems:

[Programs]
RunIf1=AM=2,READY,CLOSE,"C:\Users\Reinhard\AppData\Local\vPilot\vPilot.exe -host"
RunIf2=AM=2,READY,DELAY,"C:\AviaServer\AviaServer.exe"

I enclose my command including parameters completely by quotes.

Rgds
Reinhard

 

Link to comment
Share on other sites

Yup.  and I do that with another program but for some reason when I do as above (and any of the combinations discussed) the FSUIPC log shows a error about the directory and file yet the application will run from any directory when it's done from a command window or Powershell script.

Strange.

 

Link to comment
Share on other sites

On 7/18/2021 at 4:23 AM, DakotaPilot said:

-I've used the Programs section of the FSUIPC ini file to run some programs and it works well.  I am now trying to run another program but keep ending up with an error 237.  the entries in the Program section are.  I'm on FSUIPC 6.

Run2=READY,CLOSE,C:\Users\NAME\AppData\Local\FS-Keypad\FS-Keypad.exe C:\Users\NAME\AppData\Local\FS-Keypad\Keypads\303df744-c367-4681-a409-4ac2f187b39e.json

Run3=READY,CLOSE,C:\Users\NAME\AppData\Local\FS-Keypad\FS-Keypad.exe C:\Users\NAME\AppData\Local\FS-Keypad\Keypads\d221813d-fb88-4233-a6c6-c7491de17616.json

and the fsuipc.log has this in it.

    31437 FSUIPC couldn't run: "C:\Users\NAME\AppData\Local\FS-Keypad\FS-Keypad.exe C:\Users\NAME\AppData\Local\FS-Keypad\Keypads\303df744-c367-4681-a409-4ac2f187b39e.json" [Error=267]
    31437 FSUIPC couldn't run: "C:\Users\NAME\AppData\Local\FS-Keypad\FS-Keypad.exe C:\NAME\Brett\AppData\Local\FS-Keypad\Keypads\d221813d-fb88-4233-a6c6-c7491de17616.json" [Error=267]

Is your logon name to Windows really "NAME"? That seems really unlikely. Your log-on name should be there instead. The error means bad folder name so something there is wrong.

You could try replacing the C:\Users\NAME\AppData part by %AppData%

Pete

 

Link to comment
Share on other sites

Nope.  I replaced my name with NAME.  In the ini file it's correct.  I copied the string from the application's shortcut that it created.  It's weird.  The same line works fine in a command window or from a Powershell script no matter what directory the script or command window is in.

 

 

Link to comment
Share on other sites

I did some more testing and I can run the program if I do this.

Run2=READY,CLOSE,C:\Users\Brett\AppData\Local\FS-Keypad\FS-Keypad.exe

As soon as I add an argument it fails saying it can't find the directory but it works from the command line window or a Powershell script.  At this point I'll start them manually or do something else.

I did try running the above but with <PathtoPowershell>powershell.exe which works but as soon as I add a paramater such as

"-command <pathtoprog>\script.ps1"

I get the 267 error.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy 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.