Jump to content

Search the Community

Showing results for tags 'Parameter'.

  • 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 8 results

  1. Hello, I compiled a script I made that takes a command line parameter (the version of a .msi installer) when launched. The script was compiled with the /console option. The script (.au3) works fine but the executable returns the following error: Error: array variable has incorrect number of subscripts or subscript dimension range exceeded
  2. Hi. Local $sPDFtk = FileGetShortName(@ScriptDir & "\pdftk.exe") Local $sInputPDF = FileGetShortName(@ScriptDir & "\Prodis_Test.pdf") Local $sSig_1 = FileGetShortName(@ScriptDir & "\Sig_1.pdf") Local $sTempPDF = FileGetShortName(@ScriptDir & "\Prodis_Test_TEMP.pdf") $iSuccess = ShellExecuteWait($sPDFtk, $sInputPDF & " stamp " & $sSig_1 & " output " & $sTempPDF, "", "", @SW_HIDE) @ScriptDir is "H:\_Conrad lokal\Downloads\AutoIt3\_COX". As you can see there is a space in the path. I know that ShellExecuteWait is working with FileGetShortName at the filename. It seems to me that I can't pass the parameters that way. But without FileGetShortName it's not working too. Ideas? Regards, Conrad
  3. I wrote this very simple functions to parse command line arguments. It can get: Simple key/value Example. The following code: #include "cmdline.au3" MsgBox(0, _CmdLine_Get('color')) Will return "white" if you run the script in one of these ways (quotes are optional but mandatory if you're going to use spaces): script.exe -color "white" script.exe --color white script.exe /color white Existence Example. The following code: #include "cmdline.au3" If _CmdLine_KeyExists('givemecoffee') Then ConsoleWrite('You want coffee.') Else ConsoleWrite('You do not want coffee.') EndIf Will return "You want coffee." if you run one of these: script.exe -givemecoffee script.exe --givemecoffee script.exe /givemecoffee And the following code: #include "cmdline.au3" If _CmdLine_ValueExists('givemecoffee') Then ConsoleWrite('You want coffee.') Else ConsoleWrite('You do not want coffee.') EndIf Will return "You want coffee." if you run one of these: script.exe givemecoffee script.exe "givemecoffee" Flags Example. This script: #include "cmdline.au3" ConsoleWrite("You want: ") If _CmdLine_FlagEnabled('C') Then ConsoleWrite("coffee ") EndIf If _CmdLine_FlagEnabled('B') Then ConsoleWrite("beer ") EndIf ConsoleWrite(" and you do not want: ") If _CmdLine_FlagDisabled('V') Then ConsoleWrite("vodka ") EndIf If _CmdLine_FlagDisabled('W') Then ConsoleWrite("wine ") EndIf ConsoleWrite(" but you did not tell me if you want: ") If Not _CmdLine_FlagExists('S') Then ConsoleWrite("soda ") EndIf If Not _CmdLine_FlagExists('J') Then ConsoleWrite("juice ") EndIf Will return "You want: coffee beer and you do not want: vodka wine but you did not tell me if you want: soda juice" if you run: script.exe +CB -VW Getting argument by its index You can also read the $CmdLine (1-based index) through this function. The advantage is that if the index does not exist (the user did not specify the argument), it won't break your script. It will just return the value you specify in the second function parameter. #include "cmdline.au3" $first_argument = _CmdLine_GetValByIndex(1, False) If Not $first_argument Then ConsoleWrite("You did not specify any argument.") Else ConsoleWrite("First argument is: " & $first_argument) EndIf Just a note: The second value of _CmdLine_GetValByIndex function can be an integer value, a string, a boolean value, an array or anything you want it to return if the index does not exist in $CmdLine array. This parameter is also available in _CmdLine_Get() function, also as a second function parameter. In this case, it will return this value if the key was not found. Example: #include "cmdline.au3" $user_wants = _CmdLine_Get("iwant", "nothing") ConsoleWrite("You want " & $user_wants) So, if you run: script.exe /iwant water It will return "You want water". But if you run just: script.exe It will return "You want nothing". Please note that, as these two are the only functions in this library meant to return strings, the second parameter is not available for the other functions. By default, if you do not specify any fallback value, it returns null if the wanted value could not be found. Also, please note that this UDF can NOT parse arguments in the format (key=value). Example: script.exe key=value IT WILL NOT WORK Here is the code: #include-once #comments-start CmdLine small UDF coder: Jefrey (jefrey[at]jefrey.ml) #comments-end Func _CmdLine_Get($sKey, $mDefault = Null) For $i = 1 To $CmdLine[0] If $CmdLine[$i] = "/" & $sKey OR $CmdLine[$i] = "-" & $sKey OR $CmdLine[$i] = "--" & $sKey Then If $CmdLine[0] >= $i+1 Then Return $CmdLine[$i+1] EndIf EndIf Next Return $mDefault EndFunc Func _CmdLine_KeyExists($sKey) For $i = 1 To $CmdLine[0] If $CmdLine[$i] = "/" & $sKey OR $CmdLine[$i] = "-" & $sKey OR $CmdLine[$i] = "--" & $sKey Then Return True EndIf Next Return False EndFunc Func _CmdLine_ValueExists($sValue) For $i = 1 To $CmdLine[0] If $CmdLine[$i] = $sValue Then Return True EndIf Next Return False EndFunc Func _CmdLine_FlagEnabled($sKey) For $i = 1 To $CmdLine[0] If StringRegExp($CmdLine[$i], "\+([a-zA-Z]*)" & $sKey & "([a-zA-Z]*)") Then Return True EndIf Next Return False EndFunc Func _CmdLine_FlagDisabled($sKey) For $i = 1 To $CmdLine[0] If StringRegExp($CmdLine[$i], "\-([a-zA-Z]*)" & $sKey & "([a-zA-Z]*)") Then Return True EndIf Next Return False EndFunc Func _CmdLine_FlagExists($sKey) For $i = 1 To $CmdLine[0] If StringRegExp($CmdLine[$i], "(\+|\-)([a-zA-Z]*)" & $sKey & "([a-zA-Z]*)") Then Return True EndIf Next Return False EndFunc Func _CmdLine_GetValByIndex($iIndex, $mDefault = Null) If $CmdLine[0] >= $iIndex Then Return $CmdLine[$iIndex] Else Return $mDefault EndIf EndFunc
  4. how do I break the loop if my program is stuck in it without exiting the whole program? i just want it to start from the beginning of the code here is my program While 1 $picture = "target.png" $result = _ImageSearch($picture,1,$x1,$y1,0,0) If $result = 1 Then Send("{4}") MouseClick("left",$x1,$y1,1,1) Sleep(2000) Do $picture2 = "status.png" $result2 = _ImageSearch($picture2,1,$x1,$y1,0,0) Send("{2}") Send("{1}") Until $result2 = 1 as you see if my program doesnt detect or see picture2 then the loop wont stop.
  5. Hi, I have a small problem with typing parametr in command line My working code is: Run(@comspec & ' /c "C:\Users\G514204\Desktop\Capture2Text\Capture2Text.exe " ' & $x11 & " " & $y11 & " " & $x21 & " " & $y21 & " " & ' output.txt', "",@SW_MINIMIZE ) But I need instead output.txt to set different path like :"C:\Users\G514204\Desktop\Results\output.txt". Double quotes are necessary, $x11, $y11... are coordinates. In shorcut on desktop in field Target is written: C:\Users\G514204\Desktop\Capture2Text\Capture2Text.exe 369 510 715 558 "C:\Users\G514204\Desktop\AutoIt Results\output.txt" Can anyone give me some advice? I will be very grateful.
  6. Hi guys, I don't understand how to add to a autoit .exe a command line interface The help this time don't help me like expeted. Example simple code: Func Test() MsgBox(0,0,"test") EndFunc If i run it nothing happens, it's normal. But how to add a command line parameter like: C:UsersUsername>test.exe /name "True" Completed Successfully And see the MsgBox with the variable text? Please provide some example Thanks for support
  7. Hii, I am using selenium rc with java and trying to upload file for test using autoit. I am able to do the same, but I have to write a new script for each file to be uploaded for different scenarios. Is there any way to pass file name as a parameter to the script, so that I can use only one script file. I tried this but it gives Error: Array variable has incorrect number of subscript Here is my script upload.au3: #include<IE.au3> If $CmdLine[0] < 2 Then WinWait("Choose File to Upload") $hChoose = WinGetHandle("Choose File to Upload") ControlSetText($hChoose, "", "[CLASS:Edit; INSTANCE:1]",$CmdLine[1]) sleep(2000) ControlClick($hChoose, "", "[CLASS:Button; INSTANCE:1]") EndIf And I am calling from java as below: _selenium.click("id=movie-path"); String[] cmd = {path_to_file }; Process proc1 = Runtime.getRuntime().exec( "uploadfile3.exe",cmd); Help needed...
  8. Hello - I am passing several parameters to a DLL successfully, except for one parameter apparently. When I look at the results of what was passed via DllCall there is an extra, leading "1" on one of the parameters. How do I fix this? The $ShutDownWindowTimeout variable is set to "800". When I display the parameters used in DllCall via a messagebox the parameter shows "1800" was passed instead. No matter what number I use it has a 1 leading it. Strange... #include <WinAPI.au3> $ShutDownWindowTimeout=800 $UserActionMessage = "SHUTDOWN" $pTitle = DllStructCreate("char Title[32]") $pMessage = DllStructCreate("char Message[128]") $pResponse = DllStructCreate("DWORD Response") $KernelCall = DllOpen(@SystemDir & "\Kernel32.dll") $SessionId = DllCall($KernelCall, "DWORD", "WTSGetActiveConsoleSessionId") DllClose($KernelCall) DllStructSetData($pTitle, "Title", "Scheduled Power Action") DllStructSetData($pMessage, "Message", "Your computer is scheduled to " & $UserActionMessage & ". Click CANCEL to keep working.") $wtsapiCall = DllOpen(@SystemDir & "\Wtsapi32.dll") $SendMessageResult = DllCall($wtsapiCall,"BOOL","WTSSendMessageA","HANDLE","WTS_CURRENT_SERVER_HANDLE","DWORD",$SessionId[0],"str",DllStructGetData($pTitle, "Title"),"DWORD",DllStructGetSize($pTitle),"str",DllStructGetData($pMessage, "Message"),"DWORD",DllStructGetSize($pMessage),"DWORD","1L","DWORD",$ShutDownWindowTimeout,"DWORD",DllStructGetPtr($pResponse),"BOOL","1") MsgBox(0, "WinAPILastError", _WinAPI_GetLastError() & "," & _WinAPI_GetLastErrorMessage()) MsgBox(0, "DllCall Response,@error", $SendMessageResult[0] & "," & $SendMessageResult[1] & "," & $SendMessageResult[2] & "," & $SendMessageResult[3] & "," & $SendMessageResult[4] & "," & $SendMessageResult[5] & "," & $SendMessageResult[6] & "," & $SendMessageResult[7]& $SendMessageResult[8] & "," & $SendMessageResult[9] & "," & $SendMessageResult[10]) MsgBox(0, "DllCall pointer response", DllStructGetData($pResponse, "Response")) DllClose($wtsapiCall)
×
×
  • Create New...