Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Creating a Simple Scripting Language.


ghost's Avatar
0 0

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?


ghost's Avatar
0 0

environment variables.

Right-click "my computer", it's somewhere in there.


ghost's Avatar
0 0

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.


ghost's Avatar
0 0

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.


reaper4334's Avatar
Member
0 0

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.


ghost's Avatar
0 0

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?


ghost's Avatar
0 0

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]


ghost's Avatar
0 0

Yep, and all by myself too.:p [edit]In case it wasn't clear, that's sarcasm for thanks for your help.[/edit]


ghost's Avatar
0 0

Thanks anyway.

Anyway…

Aaaanyyyyywaaaayyyyy…

Sheesh.