how can i get all command argumetns?
following command will return "1 arg para 123"
hollywood.exe blahblah.hws -1=123
but how you get blahblah.hws ?
get console arguments WITHOUT - (win)
- airsoftsoftwair
- Posts: 5834
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: get console arguments WITHOUT - (win)
I think you're looking for GetFileArgument().
Re: get console arguments WITHOUT - (win)
GetFileArgument return the FIRST argument only and ONLY if the rest of argumetns are NOT with -
i can not get for example
Example.exe blahblah.exe blablah2.exe
i can not get for example
Example.exe blahblah.exe blablah2.exe
Christos
Re: get console arguments WITHOUT - (win)
I also have a similar wish on my list, but hadn't asked yet. My idea was to extend GetCommandLine(), so that a table is returned as third return value, containing all positional arguments. To do this, the passed arguments (with leading -) and parameters would have to be masked out, and the rest passed as table. I have done similar things before to get portable code (anyone remember GCompare/GPatch?).
However because of the existing syntax it would not be possible to write the positional arguments at all places, because parameters are optional, for example for the last argument it would not be clear whether the following word should be a parameter or not. But maybe someone can think of a better solution.
However because of the existing syntax it would not be possible to write the positional arguments at all places, because parameters are optional, for example for the last argument it would not be clear whether the following word should be a parameter or not. But maybe someone can think of a better solution.
Re: get console arguments WITHOUT - (win)
this one return full execution path of program no arguments at all
Christos
Re: get console arguments WITHOUT - (win)
Well, there are two kinds of arguments, the ones passed to the Hollywood interpreter and the ones passed to the script. I don't think there's a way to get them all combined, and would that even be sensible to mix them up. I think Hollywood's philosophy is that scripts don't need to know interpreter's arguments.
When you're coding a program, it usually matters what arguments are passed for the script, and those you can get with GetCommandLine() (custom arguments starting with "-") and GetFileArgument() (a file given for a compiled script, which is given without "-").
blahblah.hws is a file argument passed for the interpreter, and thus isn't considered important for the actual script code. But if you want to get it for some reason, you can use GetProgramInfo() and use the FilePart() if you want to strip the path from it.
When you're coding a program, it usually matters what arguments are passed for the script, and those you can get with GetCommandLine() (custom arguments starting with "-") and GetFileArgument() (a file given for a compiled script, which is given without "-").
blahblah.hws is a file argument passed for the interpreter, and thus isn't considered important for the actual script code. But if you want to get it for some reason, you can use GetProgramInfo() and use the FilePart() if you want to strip the path from it.
Re: get console arguments WITHOUT - (win)
my point is if you create an "exe" win32 cmd for example
and you want arguments to this "command.exe" you have limitations
i dont NEED itright now, but found these limitations during experimental.
As Flinx said, an extension to GetFileAtrributes somehow like table = GetFileAttributes(#GET_ALL) or someway anyway
should be implemented in future
and you want arguments to this "command.exe" you have limitations
i dont NEED itright now, but found these limitations during experimental.
As Flinx said, an extension to GetFileAtrributes somehow like table = GetFileAttributes(#GET_ALL) or someway anyway
should be implemented in future
Christos
Re: get console arguments WITHOUT - (win)
Documentation of GetCommandLine() tells "Please note that arguments must be prefixed by a dash character (-)", so all "option arguments" must be prefixed by "-", which is a non-standard way on Amiga compatibles, but understandable compromise for multiplatform consistency.plouf wrote: ↑Thu Oct 13, 2022 10:22 pm my point is if you create an "exe" win32 cmd for example
and you want arguments to this "command.exe" you have limitations
As Flinx said, an extension to GetFileAtrributes somehow like table = GetFileAttributes(#GET_ALL) or someway anyway
should be implemented in future
The only exception is the "file argument" which can be given without "-", but it's only meant for giving a file name (a special case where you give a file that your program will process then) for a script/exe, it isn't meant to be used for setting an option or such.
As the rule is that option arguments must contain "-", I don't see any bigger issue here... although being to able to give multiple "file arguments" would be nice (sometimes you might want to handle many files in your program), which might be what you're asking for when I'm starting to understand the question better now
Re: get console arguments WITHOUT - (win)
I would also find it nicer if you could distinguish between the options and the objects to be handled.
One example where I would have liked to do it this way: As reported, I built music players using Raspberry. To make it easy to turn them off, the file system runs read-only. To make it easy to replace the player program and the music, a script copies the program from a pen drive to the working directory at boot time and makes it executable. And to let the user know when the drive is missing and because the messages of a shell output are too tiny on a 5" display, I made a text viewer that displays a text in full screen mode.
And there I would have preferred to treat the options and the text differently, because in the simplest form then only one argument would be needed.