| Author |
Creating a Simple Scripting Language. |
Tyler3791
Member
Posts: 14
Location: NC
Joined: 20.10.09 Rank: Apprentice |
|
|
I can do all the parsing and other related crap, but I was wondering how I would I make it interpret a file(like how a .bat is processed without having to be typed every time). I guess my real question is what does Windows send to a program when a file set to be opened by that program is double clicked. Would the path to the file that was double clicked be in argv? |
|
| Author |
RE: Creating a Simple Scripting Language. |
Compromise
Member
Posts: 224
Location:
Joined: 11.11.09 Rank: Moderate Warn Level: 30
|
|
environment variables.
Right-click "my computer", it's somewhere in there.
CrazySpai |
|
| Author |
RE: Creating a Simple Scripting Language. |
Tyler3791
Member
Posts: 14
Location: NC
Joined: 20.10.09 Rank: Apprentice |
|
|
I know what environment variables are, just type "set" into cmd and you see *most* of them. But what would be sent to my program and how would I access the information sent to it? I guess another example that may clarify, is how when you click a .txt, it is automatically opened/displayed by notepad. |
|
| Author |
RE: Creating a Simple Scripting Language. |
Compromise
Member
Posts: 224
Location:
Joined: 11.11.09 Rank: Moderate Warn Level: 30
|
|
You provide a path to the binary that handles opening the file, and you associate a file extension with a file.
It's a bit different on non-windows systems, though you can just expect people to put the file-to-be-opened as an argument of the program.
CrazySpai |
|
| Author |
RE: Creating a Simple Scripting Language. |
reaper4334
Member

Posts: 314
Location: Uk
Joined: 24.11.06 Rank: God |
|
Hm, not sure what exactly you're trying to ask.. but I think spy and mosh have pretty much covered it..
Tyler3791 wrote:
Would the path to the file that was double clicked be in argv?
In most cases, yes.
|
|
| Author |
RE: Creating a Simple Scripting Language. |
Tyler3791
Member
Posts: 14
Location: NC
Joined: 20.10.09 Rank: Apprentice |
|
|
Compromise wrote:
You provide a path to the binary that handles opening the file, and you associate a file extension with a file.
I'm asking from the point of view of the binary, how does the binary get the path to the file it's supposed to open? |
|
| Author |
RE: Creating a Simple Scripting Language. |
Tyler3791
Member
Posts: 14
Location: NC
Joined: 20.10.09 Rank: Apprentice |
|
I(with help) figured it out, thanks. The path to the file is in argv[1].
[edit]I got rid of the insulting "anyway," happy?[/edit]
Edited by Tyler3791 on 23-12-09 06:34 |
|
| Author |
RE: Creating a Simple Scripting Language. |
Tyler3791
Member
Posts: 14
Location: NC
Joined: 20.10.09 Rank: Apprentice |
|
Yep, and all by myself too.
[edit]In case it wasn't clear, that's sarcasm for thanks for your help.[/edit]
Edited by Tyler3791 on 23-12-09 03:12 |
|
| Author |
RE: Creating a Simple Scripting Language. |
Compromise
Member
Posts: 224
Location:
Joined: 11.11.09 Rank: Moderate Warn Level: 30
|
|
Thanks anyway.
Anyway...
Aaaanyyyyywaaaayyyyy...
Sheesh.
CrazySpai |
|