Welcome to Phrogram Sign in | Join | Help
in Search


FEATURE #87: How to retrieve command line arguments in a Phrogram programme

Last post 08-11-2008, 1:30 PM by ZMan. 3 replies.
Sort Posts: Previous Next
  •  08-09-2008, 10:50 AM 7032

    FEATURE #87: How to retrieve command line arguments in a Phrogram programme

    Assuming I have packaged a program as a .EXE, I want to be able to pass it argument from the command line / shortcut like you can with other programmes. For example:

     MyPhrogram.exe arg1 arg2 arg3

     and be able to retrieve the values (and count if possible) of the arguments. Can this be done? If so, how?

     

    Thanks,

     

    Chris

     

  •  08-09-2008, 10:58 AM 7033 in reply to 7032

    Re: How to retrieve command line arguments in a Phrogram programme

    There is currently no features to do this. Phorgram is a very visual language so command line type situations are not a scenario we designed for.

    I'd love to hear more about your intended scenario as its probably a fairly easy thing to implement at some point


    Managed DirectX and XNA ? Check out http://www.thezbuffer.com
  •  08-11-2008, 1:14 PM 7040 in reply to 7033

    Re: How to retrieve command line arguments in a Phrogram programme

    I understand what Phrogram is about but this really is a basic 'must have' for any environment. Given that you support some quite advanced stuff this seems like a bit of an omission.

    I am currently teaching my son to program using Phrogram as the vehice for doing that. In order to make the learning relevant and useful we are actually writing a small application that was requested by my wife. This application requires an external data file. While we can of course hard code a default location and name for this file into the application we need the ability to override this at runtime. Rather than ask the user to enter it (ugh!) we'd like to be able to specify the pathname as a command line argument to the (packaged) .EXE.

    If you are able to add this feature it would be very helpful. After all, very many completely 'GUI' Windows programmes take command line arguments :-)

    Chris

  •  08-11-2008, 1:30 PM 7041 in reply to 7040

    Re: How to retrieve command line arguments in a Phrogram programme

    I would have to disagree with the 'must have' comment. Phrogram (and its precursor KPL) have been around for several years now and taught in several schools without this feature being requested. I can see why you need it but its just not something that most of our end users need.

    For your scenario - how do you intend to run the application? From the command line? Few of our audience have any clue about command prompts.

    Whilst I agree that most windows applications do accept command line they are for the most part reserved for either advanced usage or association with a document file e.g. allowing word to open .doc files. Its very rare for a major application to require command line arguments - most windows users don't even know how to provide them.

    The most common pattern for the secnario you describe would be something like Microsoft Outlook uses.

    1. When the application runs for the 1st time ask the user for the file location (or make an empty one somewhere)
    2. Store the location in the registry or an INI or XML type file
    3. When the application runs in the future read from the setting file/location

    [of course until Phrogram provide registry or My documents location access even this solution is not perfect. I would write a simple text file to the same directory as the EXE as a workaround]

    However I've added this to our bug/feature tracking system. Its not something that will likley be added in the short term as we are currently working on the next major release. Once the key features are done we will look at some of the smaller low hanging fruti that might be easy to add in.

    Off the top of my head I think I would make it look something like this:

    Program MyNewProgram

     Method Main()

      Console.WriteLine(ArrayLength(Application.Paramters))
      Console.WriteLine(Application.Paramers[1])

     End Method

    End Program

     


    Managed DirectX and XNA ? Check out http://www.thezbuffer.com
View as RSS news feed in XML