[PLUGIN]Command Line

Completed plugins, behaviors and effects.

Post » Sun Jan 24, 2010 5:45 am

[size=150:1a9t4dm9]Command Line Plugin - v0.92[/size:1a9t4dm9]
[size=125:1a9t4dm9]Download Now(no example) - 101KB[/size:1a9t4dm9]

Description:
This plugin allows you to access and interpret all command line arguments passed to your program upon loading. This is useful for passing instructions or file paths to your program before startup.

[size=150:1a9t4dm9]Conditions/Actions/Expressions/Edittime Parameters:[/size:1a9t4dm9]

[size=125:1a9t4dm9]Conditions:[/size:1a9t4dm9]
For each argument - Loops through each argument passed to your program. To be used in conjunction with the conditions specified under the "For each" category.

[size=125:1a9t4dm9]Actions:[/size:1a9t4dm9]
Execute file - Allows you to execute an external program and supply it a set of command line arguments. Arguments are separated using Microsoft Windows standards.

[size=125:1a9t4dm9]Expressions:[/size:1a9t4dm9]
Argument count - Returns the amount of arguments passed to your program.

Get argument - Returns the entire argument at the index given in parenthesis(1-indexed).

Get argument name - Returns the name of the argument at the index given in parenthesis(1-indexed). In the argument "value=5", "value" is the name.

Get argument value - Returns the value of the argument at the index given in parenthesis(1-indexed). In the argument "value=5", "5" is the value.

Get program path - Returns the path to the currently running program, file name and all. Windows usually passes this as the first argument, but it was relegated to an expression to avoid confusion.

Current argument - Returns the entire currently iterated argument from the "For each argument" condition.

Current argument index - Returns the index of the currently iterated argument from the "For each argument" condition.

Current argument name - Returns the name of the currently iterated argument from the "For each argument" condition. In the argument "value=5", "value" is the name.

Current argument value - Returns the value of the currently iterated argument from the "For each argument" condition. In the argument "value=5", "5" is the value.

[size=125:1a9t4dm9]Edittime Parameters:[/size:1a9t4dm9]
Start arguments - A list of arguments that can be passed to your program internally at the start of the application. This allows the easy testing of command line features without exporting the program as an EXE. Arguments are separated using Microsoft Windows standards.
Use start arguments - Determines whether the arguments specified in the "Start arguments" box will be passed to the program at the start of the application. It is recommended that this remain unchecked when your program is exported as an EXE.

Be sure to leave any feedback/bug reports/questions in the comments below.

Enjoy. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Mon Jul 26, 2010 11:33 pm

Thanks for your work on this! This is essential for making screensavers until the actual screensaver option is fixed, if that is even what it does :D

This can be used in many applications. Thanks for being a contribution to the community!
B
3
S
1
G
2
Posts: 57
Reputation: 964

Post » Tue Jun 21, 2011 8:37 pm

Trying to pass a file path to my program. Having trouble figuring out what is going wrong on something so simple. Even using the Start Arguments I am having trouble retrieving values. Arg 1 does not seem to give me anything, but arg 2 and onward work fine? Any help from anyone else that uses this?

I wish this came with an example :/
That would probably help me solve my problem!

EDIT:
I believe I found the bug. It seems that I can't read from argument 1 no matter what. I can set several arguments in the test field and I can read all but argument 1. If I only have one argument, the program reports that there is, in fact, one argument, but I can't read it with the plugin. That's a pain. I figured I would leave one argument in the testing field and export the program as a workaround, but of course, all arguments set in the testing field are added AFTER the actual argument I want to push (a drag and drop file onto the exe to get the path). so setting argument "-test" in the test field becomes argument 2 when you actually run the program with a command line argument. Makes this plugin virtually unusable in its current state.

Using Construct Classic r1.2
B
3
S
1
G
2
Posts: 57
Reputation: 964

Post » Wed Jun 22, 2011 12:52 am

In typical command line programming the first argument is always that of the program name you are executing..I don't know if that is what you are referring to here. So Arg1 is the program name and Arg 2 should be your first argument.

Or maybe its a bug... :D
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Wed Jun 22, 2011 1:29 am

Wow... this makes me feel really stupid. I didn't link to the latest version of the plugin when creating this thread, and it just so happend to include this:

[quote:138jgkl0][FIX] - Inputting an index of "1" in the "Get argument", "Get argument name", and "Get argument value" expressions would return "NULL".[/quote:138jgkl0]
I changed the link to the newest version, so go ahead and download that and your problem should be fixed.

Sorry about that... :P
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Wed Jun 22, 2011 1:51 am

Oh happy day! Thank you sir, I really needed this :D
All I had to do to get a new version was ask? You got a Construct Classic 1.3 laying around anywhere? Zing!

EDIT:
The plugin is ridiculously simple to use, now that it works :D
Never the less, every good plugin needs an example. Voila!
Drag any file onto the COMPILED caps icon and it will show you the path. If you just run a preview from Construct, you will get "NULL" because there were no arguments passed to the program.

http://dl.dropbox.com/u/5530592/Path%20Finder.cap

Easy as pie! This should keep me occupied for a while...
B
3
S
1
G
2
Posts: 57
Reputation: 964

Post » Mon Aug 08, 2011 6:05 pm

I don't understand you example! greyspot
B
7
S
2
G
1
Posts: 193
Reputation: 1,745

Post » Mon Aug 08, 2011 6:49 pm

[QUOTE=greyspot] Oh happy day! Thank you sir, I really needed this :D
All I had to do to get a new version was ask? You got a Construct Classic 1.3 laying around anywhere? Zing!

EDIT:
The plugin is ridiculously simple to use, now that it works :D
Never the less, every good plugin needs an example. Voila!
Drag any file onto the COMPILED caps icon and it will show you the path. If you just run a preview from Construct, you will get "NULL" because there were no arguments passed to the program.

<a rel="nofollow" href="http://dl.dropbox.com/u/5530592/Path%20Finder.cap">http://dl.dropbox.com/u/5530592/Path%20Finder.cap</a>

Easy as pie! This should keep me occupied for a while...[/QUOTE]

THAT was nice!
B
18
S
4
G
1
Posts: 413
Reputation: 2,512

Post » Sat Aug 20, 2011 5:24 am

you would need to run your program through CMD to get any use from this right? i'm just intrigued as to when exactly you would use this! any clarification would be great.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Sun Sep 11, 2011 5:08 am

[QUOTE=QuaziGNRLnose] you would need to run your program through CMD to get any use from this right? i'm just intrigued as to when exactly you would use this! any clarification would be great.[/QUOTE]

The most common use I see for this is being able to set file type associations with a program you make in Construct. Your program will open with the path to the file you clicked in it's arguments regardless, but without this plugin, you couldn't really make any use of it. Your program would execute without any idea of the file you tried to open.

You could also set a few extra option when running from, yes, a command prompt or from editing the path of a shortcut.
B
3
S
1
G
2
Posts: 57
Reputation: 964

Next

Return to Completed addons

Who is online

Users browsing this forum: No registered users and 0 guests