Jump to content

Search the Community

Showing results for tags 'parameters'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 12 results

  1. I am trying to pass multi-file selections from Windows Explorer into the $CmdLine argument parameters array. For example, and these are not the literal program/project names, I can pass three full path file names via both Window's Run dialog and Terminal into the $CmdLine array, i.e, "c:\Dir\Program.exe" "D:\Test\file1.txt" "D:\Test\file2.txt" "D:\Test\file3.txt". When checked in the running program, $CmdLine index [1] has the correct value of 3, index [1] is correct with "D:\Test\file1.txt", index [2] with "D:\Test\file2.txt" and index [3] with "D:\Test\file3.txt". I get the same correct results in $CmdLine array when I start Program.exe with the same three file parameters using the Windows Terminal. Also, I have added a HKEY_CLASSES_ROOT\*\shell\command key to the Window's registry. The registry entry is with a "C:\Program.exe" "%1" "$2" "%3" string value to allow for renaming file(s) from Windows Explorer via the right-click menu. With just one parameter placeholder, "%1" in the string value, a selected file will appear in $CmdLine. $CmdLine[0] is 1 and $Cmdline[1] contains the selected full path file name. Unfortunately, when I change the registry string value to include two more passing arguments, "%2" "%3", $CmdLine[0] =3 (as it should since three file path names are passed to Program.exe), $CmdLine[1] contains "D:\Test\file1.txt", but $CmdLine[2] and [3] are just empty strings. It appears to me that Windows is not passing the second and third ("%2" and "%3") selected file's to Autoit, but just the first parameter "%1". Is there some way that I can select more than one file in Window's Explorer and pass the full file paths into the $CmdLine array? I know that AutoIt has the _WinAPI_GetOpenFileName function, but I would like to select files directly from Windows Explorer to bring into $CmdLine. File Renaming Application 1.4.0.3.au3 Reg Key.reg
  2. Hi I have to run an executable with a parameter preceded by a /, like this: c:\myfolder\Tools\AutomaticRun\myexe.EXE /filename=c:\myfolder\Tools\AutomaticRun\myTemplate.xml") I tried both this: $iReturn = RunWait ("c:\myfolder\Tools\AutomaticRun\myexe.EXE"," /filename=c:\myfolder\Tools\AutomaticRun\myTemplate.xml") and using COMSPEC as per some posted suggestions on this forum: Run(@comspec & ' /c "c:\myfolder\Tools\AutomaticRun\myexe.EXE" /filename=c:\myfolder\Tools\AutomaticRun\myTemplate.xml') They both seem to fail. Can you please tell me what I'm doing wrong? Thanks Dave
  3. 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: [0] = Full URL (same as $sURL) [1] = Protocol (i.e.: http, https, ftp, ws...) [2] = Domain [3] = Port (or null if not specified) [4] = Path (or null if not specified) [5] = Query string (everything after the ? - or null if not specified) Example: $aExample = ParseURL("https://google.com:8080/?name=doe") MsgBox(0, "Test", "URL: " & $aExample[0] & @CRLF & _ "Protocol: " & $aExample[1] & @CRLF & _ "Domain: " & $aExample[2] & @CRLF & _ "Port: " & $aExample[3] & @CRLF & _ "Path: " & $aExample[4] & @CRLF & _ "Query string: " & $aExample[5]) ParseStr( $sStr ) Parses a query string (similar to the [5] of the previous function) and returns a multidimensional array, where: [0][0] = number of variables found [0][1] = ununsed [1][0] = key name of the first variable [1][1] = first variable value (already URL decoded) [n][0] = key name of the nth variable [n][1] = 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: [0][0] = 2 [0][1] = ununsed [1][0] = foo [1][1] = bar [2][0] = test [2][1] = lol 123 #ce Feel free to fork!
  4. Hello guys! #include <Array.au3> #include <File.au3> $iBenutzername = $Var_cmdline ; I need this to be the variable given as a parameter. ; I've read alot about CmdLine but can't think of a way to define a variable with it ; I hope you have an Idea on how to do it! Much love <3 Global $sFile = "C:\GTScript\query.txt" Global $aUsers _FileReadToArray($sFile, $aUsers, $FRTA_NOCOUNT) _ArrayColInsert($aUsers, 1) _ArrayColInsert($aUsers, 1) _ArrayColInsert($aUsers, 1) _ArrayColInsert($aUsers, 1) _ArrayColInsert($aUsers, 1) _ArrayColInsert($aUsers, 1) For $i = 0 To UBound($aUsers) - 1 $aSplit = StringRegExp($aUsers[$i][0], "(\S+)", $STR_REGEXPARRAYGLOBALMATCH) For $j = 0 To UBound($aSplit)-1 $aUsers[$i][$j] =$aSplit[$j] Next $aUsers[$i][0]=StringReplace($aUsers[$i][0],'>','') Next $sUser=$iBenutzername Func _FindUserID($aArray,$sSearch) Local $iRow=_ArraySearch($aArray,$sUser) If @error Then Return SetError(@error,-1,'') Local $sID=$aArray[$iRow][2] Return SetError(0,$iRow,$sID) EndFunc MsgBox(64,'Searcher UserID '&$sUser,_FindUserID($aUsers,$sUser))
  5. Hi Everyone 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
  6. 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?
  7. 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 v1.0.2.3 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 Update 2012-06-30 Source : GetCommandLineParameters v1.0.2.3.au3 executable : GetCommandLineParameters.exe.html (Once this html file downloaded, double click on it for start the download) Sure it will help you !
  8. The Code #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
  9. Hello, I've been pondering this for a little bit and I sense there's something wrong, obviously. The error is reading it's being called by only 1 arg however there are two listed. Func getFiles($location, $file) GUICtrlSetData($Progress, $file) GUICtrlSetBkColor($Progress, 0xC67171) InetGet($URL & $location & $file, $mcd & $location & $file, 0, 0) GUICtrlSetBkColor($Progress, 0xFFFBF0) EndFunc Is being called by this: For $i = 1 To UBound($download) - 1 getFiles($dir[2], $download[$i]) ;<== line 188 Next Error returned: ERROR: getFiles() called by a previous line with 1 arg(s). Min = 2. First previous line calling this Func is 188. Func getFiles($location, $file) This cycles through each one using the 'getFiles' function using two args. My thoughts: improper function syntax
  10. Well ,sometimes if you try to pen firefox hidden or minimized,doesn't work ,and when it works,you can't show it again on the monitor ShellExecute( "C:\Program Files\Mozilla Firefox\firefox.exe","Google - Mozilla Firefox","","open",@SW_HIDE) Sleep(2000) WinSetState( "Google - Mozilla Firefox","",@SW_SHOW)
  11. I am aware that this can be done by passing a single array of values as the parameter to a function, but I intend to write some functions which accept an indefinite number of separate integers as parameters. It amounts to the same thing in the end, but the syntax will be different. So here's what I came up with. #include <Array.au3> Dim $aParamMagic = _ParamMagic(1,2,3,4,5,6,7,8,9) ; Up to 100 parameters allowed If @error Then MsgBox(0, "Error Code", @error) Else _ArrayDisplay($aParamMagic, "Parameters Passed") EndIf Func _ParamMagic($00="",$01="",$02="",$03="",$04="",$05="",$06="",$07="",$08="",$09="", _ $10="",$11="",$12="",$13="",$14="",$15="",$16="",$17="",$18="",$19="", _ $20="",$21="",$22="",$23="",$24="",$25="",$26="",$27="",$28="",$29="", _ $30="",$31="",$32="",$33="",$34="",$35="",$36="",$37="",$38="",$39="", _ $40="",$41="",$42="",$43="",$44="",$45="",$46="",$47="",$48="",$49="", _ $50="",$51="",$52="",$53="",$54="",$55="",$56="",$57="",$58="",$59="", _ $60="",$61="",$62="",$63="",$64="",$65="",$66="",$67="",$68="",$69="", _ $70="",$71="",$72="",$73="",$74="",$75="",$76="",$77="",$78="",$79="", _ $80="",$81="",$82="",$83="",$84="",$85="",$86="",$87="",$88="",$89="", _ $90="",$91="",$92="",$93="",$94="",$95="",$96="",$97="",$98="",$99="") Local $aParam[100] = [$00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$10,$11, _ $12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29, _ $30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47, _ $48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65, _ $66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83, _ $84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99] For $i = 0 To 99 ; See how many parameters were passed to the func If IsString($aParam[$i]) Then ; The first non integer occurs ExitLoop ElseIf Not IsInt($aParam[$i]) Then Return SetError(1, 0, 0) EndIf Next If $i = 0 Then Return SetError(2, 0, 0) ; No valid parameters ReDim $aParam[$i] ; Array only needs to contain valid parameters ; Do stuff here Return $aParam ; Example return variable EndFunc Is there another way to do this with AutoIt? The problem is that the code is a bit bulky.
  12. I forgot to update this, I had responded to a topic with an updated PCRE for parsing individual items/options, so here's the updated code: _StringParseParameters: Parse Parameters in a string: Returns an array as if a command-line parser split the elements, or if nothing found an @error. Note there is a look-behind and look-ahead assertion to prevent grabbing quotes, while also allowing for cases where there are empty quotes (""): Local $aParsedArray=StringRegExp($sStringToParse,'((?<=\s"|^")[^"]+(?=")|[^\s"]+)',3) The only thing I'd do beforehand is expand any environment strings like %windir%. All you'd need for that is to just set the "ExpandEnvStrings" option, assign the string to itself (looks dumb, but accomplishes the needed expansion), then reset the option. (or call the ExpandEnvironmentStrings API function) The old version of this can still be found in a post I had made in the thread ' - it also parses comma-separated arguments, though retaining quotes. That could easily be remedied though.
×
×
  • Create New...