Jump to content

Pass the value of checked box from autoit to vbscript


Recommended Posts

i have a vbscript that called an autoit exe file and autoit exe file will return value to vbscript.

vbscriptto call the exe and create array:

Set objShell = CreateObject("WScript.Shell")
objShell.Run ( "C:\Datalog\test.exe")


Dim intCtr: intCtr=-1
Dim tempArr()
Set UID = CreateObject("System.Collections.ArrayList")

CurLot = ""


For Each filelog in FileList    
    LogFile = Split(filelog, "~")(1)
    
    Set otf = fso.OpenTextFile("C:\Datalog\" & LogFile, 1)

        intCtr=intCtr+1
        sFile = Split(LogFile, "_")
        CurStep = sFile(4)
        Redim preserve tempArr(intCtr)
        tempArr(intCtr)=CurStep
            
next

autoit:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <ButtonConstants.au3>
#include <Array.au3>

Global $Count = 10
Global $CheckBox[$Count]
global $array1[1]

$hGUI = GUICreate("Test", 500, 500)


Global $array_Pstep[10] = ["P1", "A2", "A3", "A4", "A5", "A6", "A7", "A8", "A9", "A10"]
$Spacing = 24
For $i = 0 To  UBound($array_Pstep) - 1
    $CheckBox[$i] = GUICtrlCreateCheckbox($array_Pstep[$i], 80, $Spacing + (20 * $i), 65, 17)
Next

$submit = GUICtrlCreateButton("submit",10, 300, 80, 30)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg

        case $submit
            _ArrayDisplay($array1)
        Case Else
            For $i = 0 To $Count - 1
                If $CheckBox[$i] = $Msg Then
                    MsgBox("", "Pressed", $i)
                    _ArrayAdd($array1, $array_Pstep[$i])
                    ExitLoop

                EndIf

            Next

    EndSwitch

WEnd

i need to compare the array in vbscript and array return by autoit. but i dont know how to pass the value of array in autoit to vbscript. Please help.

Edited by lattey
Link to comment
Share on other sites

  • Moderators

Just out of curiosity, why are you guaranteeing yourself a headache by mixing and matching two very similar-syntax languages, rather than simply converting the vbscript to AutoIt and skipping the middle man?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

the original script is in vbscript and i just need to add the comparing array feature with checked box. Since vbscript must used the hta, i prefer to used autoit. 

besides, the vbscript have dependency with other vbscript. 

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

×
×
  • Create New...