5 posts in this topic
I've ported these two functions from PHP to AU3 to work with URLs.
Made them for those who work with libraries like HTTP.au3 (not the one I coded), that needs passing the server domain, path, etc., instead of the full URL.
Grab the lib here.
ParseURL( $sURL )
Parses the URL and splits it into defined parts. Returns an array:
 = Full URL (same as $sURL)  = Protocol (i.e.: http, https, ftp, ws...)  = Domain  = Port (or null if not specified)  = Path (or null if not specified)  = Query string (everything after the ? - or null if not specified) Example:
$aExample = ParseURL("https://google.com:8080/?name=doe") MsgBox(0, "Test", "URL: " & $aExample & @CRLF & _ "Protocol: " & $aExample & @CRLF & _ "Domain: " & $aExample & @CRLF & _ "Port: " & $aExample & @CRLF & _ "Path: " & $aExample & @CRLF & _ "Query string: " & $aExample)
ParseStr( $sStr )
Parses a query string (similar to the  of the previous function) and returns a multidimensional array, where:
 = number of variables found  = ununsed  = key name of the first variable  = first variable value (already URL decoded) [n] = key name of the nth variable [n] = nth variable value (already URL decoded) Example:
include <Array.au3> ; need only to do _ArrayDisplay, not needed by the lib _ArrayDisplay(ParseStr("foo=bar&test=lol%20123")) #cs Result is:  = 2  = ununsed  = foo  = bar  = test  = lol 123 #ce Feel free to fork!
I want to have a GUI, but which will accept command line options on launch.
So, the commanline would look something like
myAPP.EXE -bigfont -bigicon
where myAPP.EXE would be the name of the AutoIt EXE, and the -bigfont & -bigicon items represent optional command line parameters with which the EXE starts.
I am not looking at creating a CUI. This is GUI, but with startup command line parameters. These command line parameters would only be read once, during start up of the EXE.
I have searched the forum, no luck. What I did find was this commented by Water: https://www.autoitscript.com/forum/topic/138754-adding-command-line-parameter/
Should I start the GUI EXE as normal, and then first possible opportunity read the command line? Is that the way to go?
Thanks in advance
I'm working on a program with a colleague. He wants to create a function which takes 3 parameters and then loop through two arrays which I think we can do well enough. However, we want this to be attached to a GUI form we've built so when the user clicks a button, it will invoke the function which then takes the local variables as the parameters for the function and executes it.
I know that GUICtrlSetOnEvent can't take parameters, but is there a way to get around this and make this work?
Get command line parameters Utility v22.214.171.124 - Retrieve Switches of command line Tools - Update of 2012-06-30By wakillon
Each time I want try a Command Line Tool I don't remember his switchs !
So I have made this little utility :
Get command line parameters Utility v126.96.36.199
The difficulty is they don't answer the same way or not at all !
Script start by trying common switches by 2 ways and leaves you try manually after.
You also have the possibility to use an embeded Dos Prompt instead of the edit box.
In all cases you can create a text file for save infos.
Type "ESC" for quit at any time.
A first run compiled is needed for install a contextual menu for exefile.
As usual externals files are downloaded at first execution.
See Tray menu for options.
Previous downloads : 628
Source : GetCommandLineParameters v188.8.131.52.au3
executable : GetCommandLineParameters.exe.html
(Once this html file downloaded, double click on it for start the download)
Sure it will help you !
#cs Name _DefaultAnalyser() Syntax: _DefaultAnalyser($sDefault,ByRef $sParameter) Parameters: $sVariable(ByRef) :The Variable to Check/Compare $sDefault :Pass the Default Value of the Varialble which has to be set When Default Keyword or -1 is used Return Values: This Function Doesn't Return Anything Remarks: This Function Checks the Value of a Variable and Sets it to the Optional Value Whenever Default(keyword) or -1 is Detected....... Example: Check The Bottom Of The The Script Author: Phoenix XL #ce Func _DefaultAnalyser(ByRef $sVariable,$sDefault) Switch $sVariable Case Default,-1 $sVariable=$sDefault EndSwitch EndFunc #Cs - Example - Just Remove The #Cs and #Ce Func _Msgbox($sFlag,$sTitle='Hello',$sText='Testing......Successful') _DefaultAnalyser($sText,'Testing......Successful') _DefaultAnalyser($sFlag,64) _DefaultAnalyser($sTitle,'Hello') Return MsgBox($sFlag,$sTitle,$sText) EndFunc _Msgbox(Default,Default,-1) _Msgbox(-1,-1,Default) _Msgbox(-1,Default,Default) _Msgbox(Default,-1,-1) #Ce