# ConsoleApplication argument parsing for GUI Application?

**URL:** <https://forum.juce.com/t/consoleapplication-argument-parsing-for-gui-application/37260>\
**Category:** General JUCE discussion\
**Created:** [January 21, 2020, 4:48pm UTC](https://forum.juce.com/t/consoleapplication-argument-parsing-for-gui-application/37260 "2020-01-21T16:48:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [January 21, 2020, 4:48pm UTC](https://forum.juce.com/t/consoleapplication-argument-parsing-for-gui-application/37260/1 "2020-01-21T16:48:39Z")

</div>

Is there a way to get all the new command argument parsing stuff of the ConsoleApplication to a normal GUI Application ? I know i could use JUCEApplication::getCommandLineParameterArray() but the console application have a lot of goodies that i would like to profit (like type checks and the like).

Any way to workaround that ? Is it possible to instantiate a ConsoleApplication and collect the arguments and then launch a normal JUCE Gui Application ?

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [January 21, 2020, 5:16pm UTC](https://forum.juce.com/t/consoleapplication-argument-parsing-for-gui-application/37260/2 "2020-01-21T17:16:54Z")

</div>

Nice, I wasn’t aware of that class! I wrote [something similar](https://github.com/filmstro/filmstro_optionsParser) just a year before that was added, that I can get rid of now.

Seems to me, it is not related with the JUCEApplication, so it should be easy to mix.

I would remove the `START_JUCE_APPLICATION` macro from the boilerplate and write my own main().  
It could then, when no command to execute was found, start the GUI app as normal.

---

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [January 21, 2020, 7:25pm UTC](https://forum.juce.com/t/consoleapplication-argument-parsing-for-gui-application/37260/3 "2020-01-21T19:25:02Z")

</div>

yeah, it’s not related, but i was expecting it could be prettier from an API standpoint (juce is awesome, right?) to receive console arguments directly inside the normal JUCE Application initialisation function, to not need to write a compatible main (WinMain anyone?) ourselves.

---

<div class="post-metadata">

**Author:** ![daniel](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/daniel/32/790_2.png) [@daniel](https://forum.juce.com/u/daniel)\
**Post date:** [January 21, 2020, 9:58pm UTC](https://forum.juce.com/t/consoleapplication-argument-parsing-for-gui-application/37260/4 "2020-01-21T21:58:38Z")

</div>

Yes, +1 for not writing from scratch.  
Maybe creating a way to supply a ConsoleApplication to the macro? Would be a good feature request IMHO.

---

<div class="post-metadata">

**Author:** ![kunitoki](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/kunitoki/32/15_2.png) [@kunitoki](https://forum.juce.com/u/kunitoki)\
**Post date:** [January 26, 2020, 7:01pm UTC](https://forum.juce.com/t/consoleapplication-argument-parsing-for-gui-application/37260/5 "2020-01-26T19:01:03Z")

</div>

for what i needed ArgumentList worked ok, but there the API could be improved imho (suppliying ArgumentList to Application::initialise, or something on the line)
