Jump to content

Error parsing function call


Docfxit
 Share

Recommended Posts

When I run a compiled script with command line options I am getting this error:

ErrorParsingFunctionCall.jpg

I tried including the command line options in the script so I could see what "Real" line number the problem is on while running it interactively and I am geting another error:

On line 15 "Can not redeclare a constant"

Global $CmdLine[0] = '2'

So I don't know how to figure out where my first error is

This is my code:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;#RequireAdmin
#include <Array.au3>
#include <WinAPI.au3>
#include <WinAPIDiag.au3>
#include <WinAPIConstants.au3>
AutoItSetOption("TrayIconDebug", 1) ;0-off
; Set so that tray displays current line number

Global $iError = 0, $iExtended = 0, $TryThisOnce = 0, $TryThisAgin = 0
Global $tText = DllStructCreate("char Text[4096]")
Global $pText = DllStructGetPtr($tText), $sMessage = "<None>"
Global $CmdLine[0] = '2'
Global $CmdLine[1] = "V"
Global $CmdLine[2] = "00395400000.TIF"

$sTitle = "ScanFiles"
If $CmdLine[0] = 0 Then Exit MsgBox(16, $sTitle, "No parameters passed!")

While $TryThisAgin = 0
    $TryThisAgin = 1
    DriveMapGet("L:")
    ;MsgBox($MB_TOPMOST, 'TestBox', "After DriveMapGet " & "@error = " & @error)
    If @error = 1 Then
        $RemoteShare = "atu1277"
        DriveMapAdd("L:", "\\" & $RemoteShare & "\SCANS", 0, "atu1277\SCANS", "Password"); Local account on remote computer
        $iError = @error
        $iExtended = @extended
;       MsgBox($MB_TOPMOST, 'TestBox 1', "After DriveMapAdd " & "$error = " & $iError & @CRLF & "$extended = " & $iExtended & @CRLF & $RemoteShare)
        ;MsgBox(262144 + 64, "Error Mapping Drive 1",  "@iError = " & $iError & @CRLF & "@iExtended = " & $iExtended & @CRLF)
        $TryThisAgin = 0 ; Try to see if the mapped drive is working now

        _CheckError($iError, $iExtended)
        ; Try this once
        While $TryThisOnce = 0
            $TryThisOnce = 1
            If IsAdmin() Then
                ;call a function
            Else
                MsgBox(64, "Required", " You need administrator rights to map a drive.")
                Exit
            EndIf

            If $iExtended = "53" or $iError = "5" Then
                $strHost = @SystemDir & "\drivers\etc\hosts"
                $tcpIP = "192.168.2.1"
                $sWhat = "atu1277"
                $hFile = FileOpen($strHost, 1) ; The 1 parameter just appends to the end of the file
                $filewritten = FileWrite($hFile, @LF & $tcpIP & " " & $sWhat)
                If $filewritten = 1 Then
                    MsgBox($MB_TOPMOST, 'TestBox 3', "Host file was written  " & "@error = " & @error & @CRLF & $strHost)
                Else
                    If Not FileSetAttrib($strHost, "-R") Then ; The file is closed automatically here
                        MsgBox($MB_TOPMOST, 'TestBox 3', "After Host file write was read only " & "@error = " & @error & @CRLF & $strHost)
                    EndIf
                    $hFile = FileOpen($strHost, 1) ; The 1 parameter just appends to the end of the file
                    FileWrite($hFile, @LF & $tcpIP & " " & $sWhat)
                EndIf
                FileClose($hFile)
                FileSetAttrib($strHost, "+R")

            EndIf
        WEnd
    Else
        $TryThisAgin = 1 ; The drive is mapped
    EndIf
WEnd ; Try to map the drive again
$Line1 = $CMDLINE[1]
;If $CMDLINE[0] = 2 Then
;   MsgBox($MB_TOPMOST, 'CMDLINE', "Passed Paramater 0 = " & $CMDLINE[0] & @CRLF & "Passed Paramater 1 = " & $CMDLINE[1] & @CRLF & "Passed Paramater 2 = " & $CMDLINE[2])
;Else
;   If $CMDLINE[0] = 1 Then
;       MsgBox($MB_TOPMOST, 'CMDLINE', "Passed Paramater 0 = " & $CMDLINE[0] & @CRLF & "Passed Paramater 1 = " & $CMDLINE[1])
;   EndIf
;EndIf
If @OSVersion = 'Win_7' Then
    $ProgramFiles = "C:\Programs\"
Else
    $ProgramFiles = "C:\Program Files\"
EndIf
_CheckIfIrfanViewIsInstalled
; View a document...
If $CMDLINE[1] = "V" Then
    Run($ProgramFiles & "IRFANVIEW\I_VIEW32" & " " & "L:\" & $CMDLINE[2])
Else
    ; Scan a document
    If $CMDLINE[1] = "S" Then
        Run($ProgramFiles & "IRFANVIEW\I_VIEW32" & " /scan /convert=" & "L:\" & $CMDLINE[2])
    Else
        MsgBox($MB_TOPMOST, 'CMDLINE  Error', "Error" & @CRLF & "Passed Paramater 0 = " & $CMDLINE[0] & @CRLF & "Passed Paramater 1 = " & $CMDLINE[1] & @CRLF & "Passed Paramater 2 = " & $CMDLINE[2])

    EndIf
EndIf
Exit

Func _CheckIfIrfanViewIsInstalled()
    If NOT FileExists($ProgramFiles & "IrfanView\i_view32.exe") Then
        ; Assign a Local variable the empty string which will contain the files names found.
        Global $sFileName = "", $iResult = 0, $SourceFolder = ""

        _FindFile() ;Find the folder IrfanView is in, And the name of the file

        ;MsgBox(0, "File", "File to run = " & $SourceFolder & $sFileName)
        Run($SourceFolder & $sFileName)
        WinWait("IrfanView Setup", "Create IrfanView sho")
        If Not WinActive("IrfanView Setup", "Create IrfanView sho") Then WinActivate("IrfanView Setup", "Create IrfanView sho")
        WinWaitActive("IrfanView Setup", "Create IrfanView sho")
        Send($ProgramFiles & "\{SHIFTDOWN}i{SHIFTUP}rfanView{SHIFTDOWN}{TAB}{TAB}{TAB}{TAB}{SHIFTUP}{DOWN}{SHIFTDOWN}{TAB}{TAB}{SHIFTUP}{SPACE}{SHIFTDOWN}{TAB}{SHIFTUP}{SPACE}{SHIFTDOWN}{TAB}{TAB}{TAB}{TAB}{SHIFTUP}{ENTER}")
        WinWait("IrfanView Setup", "What's new in this v")
        If Not WinActive("IrfanView Setup", "What's new in this v") Then WinActivate("IrfanView Setup", "What's new in this v")
        WinWaitActive("IrfanView Setup", "What's new in this v")
        Send("{ENTER}")
        WinWait("IrfanView Setup", "Do you want to assoc")
        If Not WinActive("IrfanView Setup", "Do you want to assoc") Then WinActivate("IrfanView Setup", "Do you want to assoc")
        WinWaitActive("IrfanView Setup", "Do you want to assoc")
        Send("{ALTDOWN}n{ALTUP}")
        If WinExists("IrfanView Setup", "Include Google &Chro") Then
            WinWait("IrfanView Setup", "Include Google &Chro") Then
            If Not WinActive("IrfanView Setup", "Include Google &Chro") Then WinActivate("IrfanView Setup", "Include Google &Chro")
            WinWaitActive("IrfanView Setup", "Include Google &Chro")
            Send("{SPACE}{ALTDOWN}n{ALTUP}")
        EndIf
        WinWait("IrfanView Setup", "Destination director")
        If Not WinActive("IrfanView Setup", "Destination director") Then WinActivate("IrfanView Setup", "Destination director")
        WinWaitActive("IrfanView Setup", "Destination director")
        Send("{ALTDOWN}n{ALTUP}")
        WinWait("IrfanView Setup", "Open IrfanView &FAQs")
        If Not WinActive("IrfanView Setup", "Open IrfanView &FAQs") Then WinActivate("IrfanView Setup", "Open IrfanView &FAQs")
        WinWaitActive("IrfanView Setup", "Open IrfanView &FAQs")
        Send("{SPACE}{ALTDOWN}d{ALTUP}")
        WinWait("IrfanView Frequently Asked Questions - Mozilla Firefox", "")
        If Not WinActive("IrfanView Frequently Asked Questions - Mozilla Firefox", "") Then WinActivate("IrfanView Frequently Asked Questions - Mozilla Firefox", "")
        WinWaitActive("IrfanView Frequently Asked Questions - Mozilla Firefox", "")
        Send("{SHIFTDOWN}{CTRLDOWN}w{SHIFTUP}{CTRLUP}")
    Endif
EndFunc   ;==>_CheckIfIrfanViewIsInstalled


Func _FindFile()
    If FileExists("C:\Dnload\IrfanView*.exe") Then
        $SourceFolder = "C:\Dnload\"
    Else
        If FileExists("D:\Dnload\IrfanView*.exe") Then
            $SourceFolder = "D:\Dnload\"
        Else
            If FileExists("D:\Dnload\9xAddons\IrfanView*.exe") Then
                $SourceFolder = "D:\Dnload\9xAddons"
            Else
                If FileExists("C:\Dnload\9xAddons\IrfanView*.exe") Then
                    $SourceFolder = "C:\Dnload\9xAddons"
                Else
                    MsgBox(0, "Find", "IrfanView*.exe not found" & @CRLF & "Please download IrfanView.exe")
                EndIf
            EndIf
        EndIf
    EndIf

    ; Assign a Local variable the search handle of all files in the current directory.
    Local $hSearch = FileFindFirstFile($SourceFolder & "\IrfanView*.exe")
    ; Check if the search was successful, if not display a message and return False.
    If $hSearch = -1 Then
        MsgBox($MB_SYSTEMMODAL, "", "Error: No files/directories matched the search pattern.")
        Return False
    EndIf

    ;While 1
    $sFileName = FileFindNextFile($hSearch)
    ; If there is no more file matching the search.
    ;       If @error Then ExitLoop

    ; Display the file name.
    ;   $iResult = MsgBox(BitOR($MB_SYSTEMMODAL, $MB_OKCANCEL), "", "File: " & $sFileName)
    ;       If $iResult <> $IDOK Then ExitLoop ; If the user clicks on the cancel/close button.
    ;WEnd

    ; Close the search handle.
    FileClose($hSearch)
EndFunc   ;==>_FindFile



Func _CheckError($iError, $iExtended = '')
    MsgBox($MB_TOPMOST, 'CheckError', '$iError = ' & $iError & @CRLF & '$iExtended = ' & $iExtended)
    If $iError <> 0 Then
        Switch $iError
            Case 1
                $iExtendedErrorMsg = _WinAPI_GetErrorMessage($iExtended)
                MsgBox(0, "Error Mapping Drive 2", "$error = " & $iError & @CRLF & _
                        "@extended = " & $iExtended & @CRLF & _
                        "Error Message = " & $iExtendedErrorMsg)
            Case 2
                MsgBox(16, "ERROR", "Access to the remote share was denied." & @CRLF & $RemoteShare & @CRLF & @CRLF & "Check firewall zones on this PC" & @CRLF & "Check to make sure user profile SCANS password is not disabled" & @CRLF & "Try pinging " & $RemoteShare)
                Exit
            Case 3
                MsgBox(64, "WARNING", "The device is already assigned.")
            Case 4
                MsgBox(16, "ERROR", "Invalid device name.")
            Case 5
                MsgBox(16, "ERROR", "Invalid remote share. -" & $RemoteShare & "-")
            Case 6
                MsgBox(16, "ERROR", "Invalid password.")
        EndSwitch
        ;       MsgBox(64, "Test 3", _WinAPI_GetErrorMessage($iExtended))

    EndIf
EndFunc   ;==>_CheckError

Func _OSVersion()
    Local $OS_Version, $servicepack_version
    $OS_Version = StringStripWS(StringRegExpReplace(@OSVersion, "(WIN_)|(Microsoft )|(Windows )|(\(TM\))|( Ultimate)", ""), 8)
    $OS_Version = StringRegExpReplace(StringRegExpReplace($OS_Version, '2008', 'Win7'), 'VISTA', 'Vista')
    If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion", 'CurrentBuildNumber') > 7000 Then $OS_Version = 'Win7'
    $servicepack_version = StringReplace(@OSServicePack, "Service Pack ", "SP")
    If @error = -1 Then $servicepack_version = ""

    ConsoleWrite($OS_Version & $servicepack_version & StringRegExpReplace(@OSArch, '(X86)', '') & @CRLF)
    Return $OS_Version & $servicepack_version & StringRegExpReplace(@OSArch, '(X86)', '')
EndFunc   ;==>_OSVersion

Thanks,

Docfxit

Link to comment
Share on other sites

You can't overwrite the $cmdLine array.

Create variables, and assign them values, logically

; default values
$sDefaultCMD1 = "V"
$sDefaultCMD2 = "00395400000.TIF"

; overwrite the default with the cmd line params
For $i = 1 To UBound($CmdLine)-1
    Assign("sDefaultCMD" & $i, $CmdLine[$i])
Next

ConsoleWrite("$sDefaultCMD1=" & $sDefaultCMD1 & @CRLF)
ConsoleWrite("$sDefaultCMD2=" & $sDefaultCMD2 & @CRLF)
Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

 

You can't overwrite the $cmdLine array.

Create variables, and assign them values, logically

; default values
$sDefaultCMD1 = "V"
$sDefaultCMD2 = "00395400000.TIF"

; overwrite the default with the cmd line params
For $i = 1 To UBound($CmdLine)-1
    Assign("sDefaultCMD" & $i, $CmdLine[$i])
Next

ConsoleWrite("$sDefaultCMD1=" & $sDefaultCMD1 & @CRLF)
ConsoleWrite("$sDefaultCMD2=" & $sDefaultCMD2 & @CRLF)

I tried this code.  I can't get it to work.

I put some code in to debug it.  It looks to me that

UBound($CmdLine)-1   = 0

So the

For $I = 1 to UBound($CmdLine)-1

never runs.

I tried changing:

For $I = 1 to 2   ;Which is what it should be at the end

And received an error saying:

(23) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Assign("$sDefaultCMD" & $i, $CmdLine[$i])

Assign("$sDefaultCMD" & $i, ^ ERROR

I also tried adding:

$sDefaultCMD0 = "2"

And changing this line:

For $i = 0 To UBound($CmdLine)-1

This time it does go through the For loop but only the one time because they both equal 0

I tried changing this line:

For $i = 0 To UBound($CmdLine)+1

So this time UBound($CmdLine)+1 is equal to 2 which is correct.

And I received this error:

(23) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

Assign("$sDefaultCMD" & $i, $CmdLine[$i])

Assign("$sDefaultCMD" & $i, ^ ERROR

The first time through $I equals 0.  So the Assign won't define $CmdLine with the correct number of parms.

What else can I try?

Thank you,

Docfxit

Edited by Docfxit
Link to comment
Share on other sites

You need to pass in parameters for the loop to run...

Leave it as I provided, or you will be digging into an array that doesn't include the proper ubounds.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

If I pass in parameters, I have no need for this code.  The array $CmdLine will be loaded.

The whole idea of this code was so I didn't have to pass parameters every time I run it interactively.

I don't understand the usefulness of this code.

Thank you,

Docfxit

Link to comment
Share on other sites

There is no usefulness for this code, if you want default parameters when you don't pass any parameters on the command line, you need to put them into another array and not the $CmdLine array. Check to see if UBound($CmdLine) is greater than 0, and if not, set your own parameters.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

BrewManNH, I don't see why you say there is no use in the snippet I provided.  It's one way to do exactly what he called out for.  If you pass in no params through cmd line, then the default is used...if you pass in via cmd line, then they overwrite the variables.

Use the variables in your script, and not the array.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Sorry, I missed that you had posted a script, I was referring to his first post. Skimming too fast

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I don't understand jdelaney

In post #4 you said "You need to pass in parameters for the loop to run..."

In post #9 you said "Use the variables in your script, and not the array."

In post #3 I said I can't get the script to work.

How can I pass in parameters for the loop to run and use variables in my script?

I'm confused.

Docfxit

Link to comment
Share on other sites

The only place where you should use $CmdLine is in the loop.

ALL other instances should be replaced with the proper:

$sDefaultCMD1
$sDefaultCMD2
 

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

After this code is run nothing is in the array $CmdLine:

$sDefaultCMD1 = "V"
    $sDefaultCMD2 = "00395400000.TIF"

    ; overwrite the default with the cmd line params
    For $i = 1 To UBound($CmdLine)-1
        Assign("$sDefaultCMD" & $i, $CmdLine[$i])
    Next

    _ArrayDisplay($CmdLine)

Are you saying every time I refer to:

$CmdLine[0] instead I need to refer to $sDefaultCMD0  Occurs 7 times

$CmdLine[1] instead I need to refer to $sDefaultCMD1  Occurs 6 times

$CmdLine[2] instead I need to refer to $sDefaultCMD2  Occurs 4 times

If that is true:

1. It makes it difficult to switch from interactive running of the code to compiled. I have to switch 27 occurrences of $CmdLine every time I use the compiled object to read from the CmdLine again.

2. There is absolutely no use for the code loop.  It just uses the variables.

Is that really what you are suggesting?

Thanks,

Docfxit

Link to comment
Share on other sites

Improper use of Assign.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

that array is constant.  You have already seen that you cannot define it within your scripts, so why do you keep trying to do so?

The example I provided you, which you incorrectly included a '$' in the assign, does NOT update the array...it updates VARIABLES which you then USE in your script.  Stop attempting to use the $cmdline array.  If you are so dead set on using an array, build your own.  I don't see what the difficulty is, here.

Maybe this will help you visualize what is being done...if not, i give up :)

#include <Misc.au3>

; default values
$sDefaultCMD1 = "V"
$sDefaultCMD2 = "00395400000.TIF"

; overwrite the default with the cmd line params
For $i = 1 To UBound($CmdLine)-1
    Assign("sDefaultCMD" & $i, $CmdLine[$i])
Next

MsgBox(1,1,"$sDefaultCMD1=" & $sDefaultCMD1 & @CRLF & "$sDefaultCMD2=" & $sDefaultCMD2 & @CRLF)

If _Singleton("test") Then
    $i = Run (@AutoItExe & " /AutoIt3ExecuteScript " & @ScriptFullPath & ' "this is my new 1st param" "this is my new 2nd param"')
    While ProcessExists($i)
    WEnd
EndIf

1st output will be the DEFAULT values, because NO command line params are passed in...2nd output will NOT be the DEFAULT values, because they were overwritten by the $cmdline array.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Thank you very much

jdelaney

for trying to clarify it for me.

Unfortunately I am not understanding why this isn't running the way you intended it to.

I don't want to frustrate you any more.  I am just not understanding what you intended to get across to me.

Thank you for all your time and patience.

Maybe someone else can explain what I am supposed to do to get this running.

I'm thinking since it has @ScriptFullPath which includes the path and the name of the script on the run line that this script is supposed to be placed into the beginning of the script I am trying to run with.

If I'm wrong and this is supposed to be run as a separate script it seems to me the name of my script that I am testing should be used instead of @ScriptFullPath.

I figured out this can't be placed inside the beginning of my script because when it runs my script is currently running and _Singleton makes sure only one script with that name is running so it ignores the run line.  That means I need to make this a separate script and replace @ScriptFullPath with the full path of my script.

$i = Run(@AutoItExe & " /AutoIt3ExecuteScript " & VboxsvrDnloadScanfiles.au3 & ' 

"this is my new 1st param" "this is my new 2nd param"

')

On the run line it seems to me the cmdline parms that are passed need to be changed like this:

$i = Run(@AutoItExe & " /AutoIt3ExecuteScript " & VboxsvrDnloadScanfiles.au3 & ' $sDefaultCMD1 $sDefaultCMD2')
  

This is what my script looks like.  Of course if either of my interpretations above are not correct that changes the whole picture.

#include <Misc.au3>
; default values
$sDefaultCMD1 = "V"
$sDefaultCMD2 = "00395400000.TIF"
If _Singleton("ScanFiles") Then
    $ScriptToRun = "...\Scanfiles.au3"
    $i = Run(@AutoItExe & " /AutoIt3ExecuteScript " & $ScriptToRun & " "  &  $sDefaultCMD1 & " " & $sDefaultCMD2)
    While ProcessExists($i)
    WEnd
EndIf

Thank you,

Docfxit

Edited by Docfxit
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...