Env var for input file

Just starting out? Need help? Post your questions and find answers here.
User avatar
tarmsaft
User
User
Posts: 37
Joined: Sat Jun 30, 2007 12:03 pm
Location: San Francisco

Env var for input file

Post 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
MacBook Pro (model 7,1) - 2.4GHz Intel Core 2 Duo 4GB - OS X 10.7 Lion.
PB 4.60 RC1
User avatar
tarmsaft
User
User
Posts: 37
Joined: Sat Jun 30, 2007 12:03 pm
Location: San Francisco

Re: Env var for input file

Post by tarmsaft »

ProgramParameter() did not return anything useful either. Only for console apps?
MacBook Pro (model 7,1) - 2.4GHz Intel Core 2 Duo 4GB - OS X 10.7 Lion.
PB 4.60 RC1
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: Env var for input file

Post by MachineCode »

I don't understand what you're asking for. Do you want to know which app opens which file type?
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Env var for input file

Post by freak »

I think you are looking for this (OSX specific):
http://www.purebasic.fr/english/viewtop ... 19&t=34231
quidquid Latine dictum sit altum videtur
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Env var for input file

Post 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 = ""
User avatar
tarmsaft
User
User
Posts: 37
Joined: Sat Jun 30, 2007 12:03 pm
Location: San Francisco

Re: Env var for input file

Post 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 :)
MacBook Pro (model 7,1) - 2.4GHz Intel Core 2 Duo 4GB - OS X 10.7 Lion.
PB 4.60 RC1
User avatar
tarmsaft
User
User
Posts: 37
Joined: Sat Jun 30, 2007 12:03 pm
Location: San Francisco

Re: Env var for input file

Post 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?).
MacBook Pro (model 7,1) - 2.4GHz Intel Core 2 Duo 4GB - OS X 10.7 Lion.
PB 4.60 RC1
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Env var for input file

Post 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.
Post Reply