Shark007 Posted June 13, 2009 Posted June 13, 2009 (edited) I've had a look at the Helpfile 'Command Line Parameters', but didnt quite understand it, if it was explaining what I ask. My GUI contains several functions. Through the GUI, some are these functions are activated using radio's and some using buttons. The GUI works as intended and is not a problem. Is it possible to run a specific function of the compiled executable from the commandline without openning the GUI? something like; MyGUI.exe Help_btn8 which would run the function specified under; Func Help_btn8 () Edited June 13, 2009 by Shark007
Shark007 Posted June 13, 2009 Author Posted June 13, 2009 The GUI pops up momentarily, can this be supressed?
Valuater Posted June 13, 2009 Posted June 13, 2009 The GUI pops up momentarily, can this be supressed?Yes, if coded correctly, you can pass a command-line parameter without showing the GUI8)
Shark007 Posted June 13, 2009 Author Posted June 13, 2009 All I did was the following; If $CmdLine[0] = 1 Then Help_btn8() obviously this isnt totally correct although it does get the job done. At the moment it will take any parameter and execute the function specified. I would prefer it to take only a specified parameter, such as 'MyGUI.exe Help_btn8', so that in the future I can add more commandline functionality. Not having the GUI popup at all would be desirable.
Bowmore Posted June 13, 2009 Posted June 13, 2009 (edited) All I did was the following; If $CmdLine[0] = 1 Then Help_btn8() obviously this isnt totally correct although it does get the job done. At the moment it will take any parameter and execute the function specified. I would prefer it to take only a specified parameter, such as 'MyGUI.exe Help_btn8', so that in the future I can add more commandline functionality. Not having the GUI popup at all would be desirable. The the code below gives some examples of how to process using command line parameters if present or create display a GUI to get the values from the user if no command parameters given. Pseudo code example If $CmdLine[0] > 0 Then ; Using command line parameters, don't need GUI For $i = 1 To $CmdLine[0] Select Case $CmdLine[$i] = "Help_btn8" Help_btn8() Case StringLeft($CmdLine[$i],2) = "/F" $MyFile = StringTrimLeft($CmdLine[$i],2) My_ProcessFileFunction($MyFile) Case $CmdLine[$i] = "1" $fSaveResults = True Case Else ; do something else EndSelect ;Do something using all command line parameters or Exit Else ; No command line parameters so create and show GUI GuiCreate() .... GuiShow() EndIf Edited June 13, 2009 by Bowmore "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook
Shark007 Posted June 13, 2009 Author Posted June 13, 2009 Bowmore, I appreciate the assistance.I now have my applications' commandline functionality working properly with room for future expansion.Thank you.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now