Page 1 of 1

Env var for input file

Posted: Tue Mar 01, 2011 5:01 am
by tarmsaft
This feels like a silly question but...
Can someone help me with what EnvironmentVariableName() I should look for when doing a open-a-file-with-this-program.
Basically right click and choose open with. I want to use that file in my program. I did actually try listing all environment variables by using the code below but none of the variables was the path to the file nor the file itself.

viewtopic.php?f=12&t=37563&hilit=Enviro ... riableName

Re: Env var for input file

Posted: Tue Mar 01, 2011 8:09 am
by tarmsaft
ProgramParameter() did not return anything useful either. Only for console apps?

Re: Env var for input file

Posted: Tue Mar 01, 2011 11:47 am
by MachineCode
I don't understand what you're asking for. Do you want to know which app opens which file type?

Re: Env var for input file

Posted: Tue Mar 01, 2011 2:45 pm
by freak
I think you are looking for this (OSX specific):
http://www.purebasic.fr/english/viewtop ... 19&t=34231

Re: Env var for input file

Posted: Tue Mar 01, 2011 3:36 pm
by Trond
Try this, it should show you all the parameters passed to your program. When you do an "open with" and select your program, one of them should be the filename.

Code: Select all

Repeat
  P.s = ProgramParameter()
  Debug P
Until P = ""

Re: Env var for input file

Posted: Tue Apr 12, 2011 5:51 am
by tarmsaft
freak wrote:I think you are looking for this (OSX specific):
http://www.purebasic.fr/english/viewtop ... 19&t=34231
Thank you freak :)

Re: Env var for input file

Posted: Tue Apr 12, 2011 5:52 am
by tarmsaft
Trond wrote:Try this, it should show you all the parameters passed to your program. When you do an "open with" and select your program, one of them should be the filename.

Code: Select all

Repeat
  P.s = ProgramParameter()
  Debug P
Until P = ""
No, it does not. Only on win (and linux?).

Re: Env var for input file

Posted: Tue Apr 12, 2011 4:04 pm
by Trond
tarmsaft wrote:
Trond wrote:Try this, it should show you all the parameters passed to your program. When you do an "open with" and select your program, one of them should be the filename.

Code: Select all

Repeat
  P.s = ProgramParameter()
  Debug P
Until P = ""
No, it does not. Only on win (and linux?).
You didn't state your OS, so I assumed it was windows or linux.