Xentradi

[SOLVED] ControlSend sending semi-colon instead of colon

7 posts in this topic

#1 ·  Posted (edited)

I did a search for this and found an old post that was never solved because the OP did not want to post his code. However I am having the exact same problem. I had originally thought it to be and issue with the SendKeyDelay being too short at 5ms and the software just being slow so I've been increasing it, I now have it set to 40 and have the same issue, not as frequently but still happens. I also tried increasing the SendKeyDownDelay to 10 still doesn't solve the issue.

Here's the code:

; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x/NT
; Author:         Xen
;
; Script Function:
;   Generate Easystone (.est) and CAD (.dxf) files using appropriate names and templates from provided Excel sheets.
;   Read tablet requirements from a preset list.xlsx file.
;
#RequireAdmin
#include <File.au3>
#include <Excel.au3>
#include <Array.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>


; Set script options
Opt("WinTitleMatchMode", 2)
Opt("SendKeyDelay",40)
Opt("SendKeyDownDelay",10)

; Function Mode
Global $xDebug = 0 ; 0:off | 1:on
Global $xCheckNotes = 0 ; 0:off | 1:on NO LONGER USED
_Log("Application start | Debug: " & $xDebug)

; Define Global Variables
    Global $nNumLines
    Global $sFileName
    Global $file
    Global $sLineText
    Global $sLineText[14]
    Global $inputCID
    Global $nameID1
    Global $nTabletNumber
    Global $nRunNumber
    Global $qtyNames
    Global $mapRange
    Global $sFolderPath

    ; Super important Control IDs
    Global $inputCID = 13901                                        ; ControlID for first text field in Components window
    Global $InsertButtonCID = "[CLASS:Button; INSTANCE:158]"        ; ControlID of Insert button
    Global $CloseButtonCID = 12451                                  ; ControlID of Close button

    ; Favorites CIDs for template groups
    Global $TopCourseCtrlID = 12410
    Global $MiddleCourseCtrlID = 12411
    Global $GroundCourseCtrlID = 12412
    Global $HeaderCtrlID = 12413

    ; Top course template CIDs
    Global $TemplateA = 10001
    Global $TemplateB = 10002
    Global $TemplateC = 10003
    Global $TemplateD = 10004

    ; Middle course template CIDs
    Global $TemplateE = 10001
    Global $TemplateF = 10002
    Global $TemplateG = 10003
    Global $TemplateH = 10004

    ; Ground course template CIDs
    Global $TemplateI = 10001
    Global $TemplateJ = 10002
    Global $TemplateK = 10003
    Global $TemplateL = 10004

    ; Header template CIDs
    Global $TemplateM = 10004
    Global $TemplateN = 10003
    Global $TemplateO = 10002
    Global $TemplateP = 10001
    Global $TemplateQ = 10004
    Global $TemplateR = 10003


HotKeySet("{Pause}", _Start)


; Get excel sheet to use for names
$workBook = RegRead("HKEY_CURRENT_USER\Software\AutoNames", "NameSheet")
If Not @error Then
    $vUpdateNames = MsgBox(4, "AutoNames", "Previous Name list detected, would you like to change?")
    If $vUpdateNames == 6 Then
        Local $sMessage = "Select your NAME spreadsheet."
        $workBook = FileOpenDialog($sMessage, @ScriptDir & "\", "Excel Spreadsheet (*.xlsx;*.xls)|All (*.*)", $FD_FILEMUSTEXIST)
        If @error Then
            ; Display the error message.
            MsgBox($MB_SYSTEMMODAL, "", "No file was selected.")
            Exit
        EndIf
    EndIf
Else
    Local $sMessage = "Select your NAME spreadsheet."
    $workBook = FileOpenDialog($sMessage, @ScriptDir & "\", "Excel Spreadsheet (*.xlsx;*.xls)|All (*.*)", $FD_FILEMUSTEXIST)
    If @error Then
        ; Display the error message.
        MsgBox($MB_SYSTEMMODAL, "", "No file was selected.")
        Exit
    EndIf
EndIf
RegWrite("HKEY_CURRENT_USER\Software\AutoNames", "NameSheet", "REG_SZ", $workBook)
_Log("Name list: " & $workBook)

; Get excel sheet to use for map data
$workBook2 = RegRead("HKEY_CURRENT_USER\Software\AutoNames", "MapList")
If Not @error Then
    $vUpdateMap = MsgBox(4, "AutoNames", "Previous Map detected, would you like to change?")
    If $vUpdateMap == 6 Then
        Local $sMessage2 = "Select your MAP spreadsheet."
        $workBook2 = FileOpenDialog($sMessage2, @ScriptDir & "\", "Excel Spreadsheet (*.xlsx;*.xls)|All (*.*)", $FD_FILEMUSTEXIST)
        If @error Then
            ; Display the error message.
            MsgBox($MB_SYSTEMMODAL, "", "No file was selected.")
            Exit
        EndIf
    EndIf
Else
    Local $sMessage2 = "Select your MAP spreadsheet."
    $workBook2 = FileOpenDialog($sMessage2, @ScriptDir & "\", "Excel Spreadsheet (*.xlsx;*.xls)|All (*.*)", $FD_FILEMUSTEXIST)
    If @error Then
        ; Display the error message.
        MsgBox($MB_SYSTEMMODAL, "", "No file was selected.")
        Exit
    EndIf
EndIf
RegWrite("HKEY_CURRENT_USER\Software\AutoNames", "MapList", "REG_SZ", $workBook2)
_Log("Map: " & $workBook2)

_SetSaveDir()


Func _Start()

    _Log("Start function triggered")

    $inTabletNumber = InputBox("Auto Names", "What is the number of the first tablet?")
    If @error = 1 Then
        _Log("First tablet not specified")
        Return
    EndIf

    $a = 0

    While $a < 42

        ConsoleWrite("Starting: " & $a & @CRLF)
        nPutNames($inTabletNumber)
        $inTabletNumber = $inTabletNumber + 1
        $a = $a + 1

    WEnd

EndFunc   ;==>_Start





Func nPutNames($vTabletNum)

    $nTabletNumber = $vTabletNum


    ; Block user input to prevent screw ups
    BlockInput(1)


    If $nTabletNumber > 406 Then
        $nRunNumber = Ceiling(($nTabletNumber - 334 - 15) / 8)
    Else
        $nRunNumber = Ceiling(($nTabletNumber - 334) / 8)
    EndIf
    If $xDebug = 1 Then
        MsgBox(0, "Run Number", $nRunNumber)
    EndIf



    $uTabletNumber = $nTabletNumber + 1 ; We have a header in the spreadsheet +1 to compensate


;~  Start Read Map Table
    $mapRange = "A" & $uTabletNumber & ":H" & $uTabletNumber ; Create search string to read in the spreadsheet. Format: A#:H#       ID, COURT, TABLET ID, STONE TYPE, TEMPLATE, THICKNESS, FIRST NAME, LAST NAME
    ; Read MAP
    Local $oExcel2 = _Excel_Open()
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    Local $oWorkbook2 = _Excel_BookOpen($oExcel2, $workBook2)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Error opening workbook '" & $workBook2 & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_Close($oExcel2)
        Exit
    EndIf

    ; Read the formulas of a cell range on default sheet of the MAP workbook
    Local $aResult2 = _Excel_RangeRead($oWorkbook2, Default, $mapRange)
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

    _Excel_BookClose($oWorkbook2)

    If $xDebug = 1 Then
        MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Data successfully read." & @CRLF & "Please click 'OK' to display the formulas of cells " & $mapRange & " of sheet 2.")
        _ArrayDisplay($aResult2, "Excel UDF: _Excel_RangeRead - Cells " & $mapRange & " of sheet 2")
    EndIf

    ; Process Map Data
    $xTabletID = StringStripWS($aResult2[0][2], 1 + 2 + 4)
    $xStoneType = StringStripWS($aResult2[0][3], 1 + 2 + 4)
    $xTemplate = StringStripWS($aResult2[0][4], 1 + 2 + 4)
    $xThickness = StringStripWS($aResult2[0][5], 1 + 2 + 4)
    $xFirstName = StringStripWS($aResult2[0][6], 1 + 2 + 4)
    $xLastName = StringStripWS($aResult2[0][7], 1 + 2 + 4)
    $nameID1 = $xFirstName + 1 ; Rows in the list are +1 of the true number
    $nameID2 = $xLastName + 1 ; Rows in the list are +1 of the true number
;~  End Read Map Table


;~  Start Read Name Table
    $nameRange = "A" & $nameID1 & ":I" & $nameID2 ; Create search string to read in the spreadsheet. Format: A#:I#
    $completeRange = "U" & $nameID1 & ":U" & $nameID2
    $tabletRange = "V" & $nameID1 & ":V" & $nameID2

    Local $oExcel = _Excel_Open()
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    Local $oWorkbook = _Excel_BookOpen($oExcel, $workBook)
    If @error Then
        MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Error opening workbook '" & $workBook & @CRLF & "@error = " & @error & ", @extended = " & @extended)
        _Excel_Close($oExcel)
        Exit
    EndIf


    ; Read the formulas of a cell range on default sheet of the NAME workbook
    Local $aResult = _Excel_RangeRead($oWorkbook, Default, $nameRange)
    If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Error reading from workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)

    If $xDebug = 1 Then
        MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead", "Data successfully read." & @CRLF & "Please click 'OK' to display the formulas of cells " & $nameRange & " of sheet 2.")
        _ArrayDisplay($aResult, "Excel UDF: _Excel_RangeRead - Cells " & $nameRange & " of sheet 2")
    EndIf

    If $xDebug = 0 Then
        _Excel_RangeWrite($oWorkbook, Default, $nRunNumber, $completeRange)
        _Excel_BookSave($oWorkbook)
        _Excel_RangeWrite($oWorkbook, Default, $nTabletNumber, $tabletRange)
        _Excel_BookClose($oWorkbook)
    EndIf
;~  End Read Name Table


    ; Open ES select template
    _SelectComponent($xStoneType, $xTemplate)



    $nNumLines = UBound($aResult)
    ; Declare variables for the loops
    Local $cID = $inputCID
    Local $sLineText1[$nNumLines + 1]
    Local $sLineText2[$nNumLines + 1]
    Local $xLINE1[$nNumLines + 1]
    Local $xLINE2[$nNumLines + 1]
    Local $xLine1Die
    Local $xLine2Die
    Local $xDie

    ; Clean and prepare the text


    ; Write run number to the log file before data.

    _Log("====== Tablet Number: " & $nTabletNumber & " ======")


    If $xDebug = 1 Then
        MsgBox(0, "", "$nNumLines: " & $nNumLines)
    EndIf


    Local $x = 0 ; Loop counter
    While $x < $nNumLines

        $xLAST = StringStripWS($aResult[$x][0], 1 + 2 + 4)
        $xLAST = StringReplace($xLAST, " ", "  ")
        $xLAST = StringReplace($xLAST, "+", " ")

        $xFIRST = StringStripWS($aResult[$x][1], 1 + 2 + 4)
        $xFIRST = StringReplace($xFIRST, " ", "  ")
        $xFIRST = StringReplace($xFIRST, "+", " ")

        ;$xUNUSED = StringStripWS($aResult[$x][2], 1 + 2 + 4) ; UNUSED MIDDLE (COL C)

        $xMIDDLE = StringStripWS($aResult[$x][3], 1 + 2 + 4)
        $xMIDDLE = StringReplace($xMIDDLE, " ", "  ")
        $xMIDDLE = StringReplace($xMIDDLE, "+", " ")

        $xSUFFIX = StringStripWS($aResult[$x][4], 8)
        $xSUFFIX = StringReplace($xSUFFIX, " ", "  ")
        $xSUFFIX = StringReplace($xSUFFIX, "+", " ")

        $xRANK = StringStripWS($aResult[$x][5], 1 + 2 + 4)
        $xRANK = StringReplace($xRANK, " ", "  ")
        $xRANK = StringReplace($xRANK, "+", " ")

        $xUNIT = StringStripWS($aResult[$x][6], 1 + 2 + 4)
        $xUNIT = StringReplace($xUNIT, " ", "  ")
        $xUNIT = StringReplace($xUNIT, "+", " ")

        $xREGION = StringStripWS($aResult[$x][7], 1 + 2 + 4)
        $xREGION = StringReplace($xREGION, " ", "  ")
        $xREGION = StringReplace($xREGION, "+", " ")

        $xMOH = StringStripWS($aResult[$x][8], 1 + 2 + 4)
        $xMOH = StringReplace($xMOH, " ", "  ")

        ; Assemble LINE1
        $xLINE1[$x] = $xLAST

        If $xFIRST <> "" Then
            $xLINE1[$x] = $xLINE1[$x] & "   " & $xFIRST
        EndIf

        If $xMIDDLE <> "" Then
            $xLINE1[$x] = $xLINE1[$x] & "   " & $xMIDDLE
        EndIf

        If $xSUFFIX <> "" Then
            $xLINE1[$x] = $xLINE1[$x] & "   " & $xSUFFIX
        EndIf

        ; Assemble LINE2
        $xLINE2[$x] = $xRANK

        If $xUNIT <> "" Then
            $xLINE2[$x] = $xLINE2[$x] & "," & $xUNIT
        EndIf

        If $xREGION <> "" Then
            $xLINE2[$x] = $xLINE2[$x] & "," & $xREGION
        EndIf

        If $xMOH = "X" Then
            MsgBox(0, "Medal of Honor Alert", $xLINE1[$x] & " needs MoH star.")
            _HonorLog($xTabletID, $xLINE1[$x])
        EndIf


        ; Write outputs to log file
        _Log($x & ".")
        _Log($xLINE1[$x])
        _Log($xLINE2[$x])

        If $xMOH = "X" Then
            _Log("Medal of Honor")
        EndIf
        _Log("------------------------------------------------------")




        If $xDebug = 0 Then
            ; Send outputs to EasyStone
            ;WinWaitActive("Components")
            ControlSetText("Components", "", $cID, $xLINE1[$x]) ; Set LINE 1 text
            $cID = $cID + 1 ; Incriment ControlID for LINE2
            ControlSetText("Components", "", $cID, $xLINE2[$x]) ; Set LINE 2 text
            $cID = $cID + 1 ; Incriment ControlID moving to next row
        EndIf


        $x = $x + 1
    WEnd

    ;_Log("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++")

    Sleep(150)
    ControlClick("Ddx EasySTONE", "", $InsertButtonCID)
    Sleep(100)
    ControlClick("Ddx EasySTONE", "", $CloseButtonCID, "main", 2)
    ConsoleWrite("Inserted!" & @CRLF)
    Sleep(100)
    _Save($xTabletID)
    Sleep(100)
    _RemoveBlueLines($xTabletID)
    Sleep(100)
    _Export($xTabletID)

    ; Re-enable user input
    BlockInput(0)
EndFunc   ;==>nPutNames


Func _SelectComponent($vCompo, $vTemplate)

    ; Determine which course the component belongs to
    ;MsgBox(0,"",$vCompo)

    Local $StringT = StringRegExp($vCompo, 'T', 0)
    Local $StringM = StringRegExp($vCompo, 'M', 0)
    Local $StringG = StringRegExp($vCompo, 'G', 0)

    If $StringT = 1 Then
        ;MsgBox(0, "Course", "Top")
        Local $CompoTypeID = $TopCourseCtrlID
        Local $StringT = StringRegExp($vCompo, 'T', 0)
        If $vTemplate = "A" Then
            ;MsgBox(0, "Template", "A")
            Local $TemplateTypeID = $TemplateA
            Local $TemplateControlText = "T1-T5 T9"
        ElseIf $vTemplate = "B" Then
            ;MsgBox(0, "Template", "B")
            Local $TemplateTypeID = $TemplateB
            Local $TemplateControlText = "T6"
        ElseIf $vTemplate = "C" Then
            ;MsgBox(0, "Template", "C")
            Local $TemplateTypeID = $TemplateC
            Local $TemplateControlText = "T7 Left"
        ElseIf $vTemplate = "D" Then
            ;MsgBox(0, "Template", "D")
            Local $TemplateTypeID = $TemplateD
            Local $TemplateControlText = "T7 Right"
        ElseIf $vTemplate = "M" Then
            ;MsgBox(0, "Template", "M")
            Local $CompoTypeID = $HeaderCtrlID
            Local $TemplateTypeID = $TemplateM
            Local $TemplateControlText = "11 NAME"
        ElseIf $vTemplate = "N" Then
            ;MsgBox(0, "Template", "N")
            Local $CompoTypeID = $HeaderCtrlID
            Local $TemplateTypeID = $TemplateN
            Local $TemplateControlText = "11 NAME WIDE"
        ElseIf $vTemplate = "O" Then
            ;MsgBox(0, "Template", "O")
            Local $CompoTypeID = $HeaderCtrlID
            Local $TemplateTypeID = $TemplateO
            Local $TemplateControlText = "11 NAME"
        ElseIf $vTemplate = "P" Then
            ;MsgBox(0, "Template", "P")
            Local $CompoTypeID = $HeaderCtrlID
            Local $TemplateTypeID = $TemplateP
            Local $TemplateControlText = "11 NAME WIDE"
        ElseIf $vTemplate = "Q" Then
            ;MsgBox(0, "Template", "Q")
            Local $CompoTypeID = $HeaderCtrlID
            Local $TemplateTypeID = $TemplateQ
            Local $TemplateControlText = "9 NAME"
        ElseIf $vTemplate = "R" Then
            ;MsgBox(0, "Template", "R")
            Local $CompoTypeID = $HeaderCtrlID
            Local $TemplateTypeID = $TemplateR
            Local $TemplateControlText = "9 NAME WIDE"
        EndIf
    ElseIf $StringM = 1 Then
        ;MsgBox(0, "Course", "Middle")
        Local $CompoTypeID = $MiddleCourseCtrlID
        If $vTemplate = "E" Then
            ;MsgBox(0, "Template", "E")
            Local $TemplateTypeID = $TemplateE
            Local $TemplateControlText = "M1-M5 M9"
        ElseIf $vTemplate = "F" Then
            ;MsgBox(0, "Template", "F")
            Local $TemplateTypeID = $TemplateF
            Local $TemplateControlText = "M6"
        ElseIf $vTemplate = "G" Then
            ;MsgBox(0, "Template", "G")
            Local $TemplateTypeID = $TemplateG
            Local $TemplateControlText = "M7 Left"
        ElseIf $vTemplate = "H" Then
            ;MsgBox(0, "Template", "H")
            Local $TemplateTypeID = $TemplateH
            Local $TemplateControlText = "M7 Right"
        EndIf
    ElseIf $StringG = 1 Then
        ;MsgBox(0, "Course", "Ground")
        Local $CompoTypeID = $GroundCourseCtrlID
        If $vTemplate = "I" Then
            ;MsgBox(0, "Template", "I")
            Local $TemplateTypeID = $TemplateI
            Local $TemplateControlText = "G1-G5 G9"
        ElseIf $vTemplate = "J" Then
            ;MsgBox(0, "Template", "J")
            Local $TemplateTypeID = $TemplateJ
            Local $TemplateControlText = "G6"
        ElseIf $vTemplate = "K" Then
            ;MsgBox(0, "Template", "K")
            Local $TemplateTypeID = $TemplateK
            Local $TemplateControlText = "G7 Left"
        ElseIf $vTemplate = "L" Then
            ;MsgBox(0, "Template", "L")
            Local $TemplateTypeID = $TemplateL
            Local $TemplateControlText = "G7 Right"
        EndIf
    EndIf


    $ESopen = WinExists("Ddx EasySTONE")
    If $ESopen = 0 Then
        Run("C:\Program Files\DdxProgStone\EasyStone\EasyStone64.exe", "", @SW_MAXIMIZE)
        WinWait("Ddx EasySTONE")
        Sleep(100)
        MsgBox(0, "Auto Names 2", "Move EasyStone Window to left screen and maximize before clicking OK")
    ElseIf $ESopen = 1 Then
        WinSetState("Ddx EasySTONE", "", @SW_MAXIMIZE)
        WinWait("Ddx EasySTONE")
    EndIf


    ControlClick(("Ddx EasySTONE"), "", $CompoTypeID)
    Sleep(100)
    ControlClick("Ddx EasySTONE", $TemplateControlText, $TemplateTypeID)
    Sleep(50)
    ControlClick("Ddx EasySTONE", $TemplateControlText, $TemplateTypeID)
    Sleep(100)


EndFunc   ;==>_SelectComponent

Func _Save($vTabletID)
    Sleep(100)

    $sSavePath = $sFolderPath & "\" & $vTabletID & ".est"

    WinActivate("Ddx EasySTONE")
    WinWaitActive("Ddx EasySTONE")
    Send("^s")
    WinActivate("Save")
    WinWaitActive("Save")
    ControlSend("Save", "", "[CLASS:Edit; INSTANCE:1]", $sSavePath)
    Sleep(200)
    Send("{ENTER}")
    $SaveExists = WinExists("Save")
    While $SaveExists = 1
        Sleep(50)
        $SaveExists = WinExists("Save")
    WEnd
    WinActivate("Ddx EasySTONE")
EndFunc   ;==>_Save

Func _RemoveBlueLines($vTabletID)
    WinActivate("Ddx EasySTONE")
    WinWaitActive("Ddx EasySTONE")
    Sleep(50)
    ControlClick("Ddx EasySTONE", "", "[CLASS:EasyStoneView; INSTANCE:1]", "secondary", 1, 0, 0)
    WinWaitActive("Ddx EasySTONE")
    Sleep(50)
    ; Find and click the Select Color option
    $aCoord = PixelSearch(-2556, 503, -2400, 900, 0x9E4787, 30)
    If Not @error Then
        ;TrayTip("Test2",$aCoord[0] & "," & $aCoord[1],5)
        MouseClick("left", $aCoord[0], $aCoord[1])
    Else
        MsgBox(0, "", "Did not choose Select color")
    EndIf

    $aCoord = PixelSearch(-1681, 594, -1104, 1390, 0x0000FF, 10)
    If Not @error Then
        ;TrayTip("Test2",$aCoord[0] & "," & $aCoord[1],5)
        MouseClick("left", $aCoord[0] + 5, $aCoord[1])
        Send("{DELETE}")
        Send("{CTRLDOWN}")
        MouseClick("left", $aCoord[0] - 1, $aCoord[1])
        Send("{CTRLUP}")
        Send("{DELETE}")
    EndIf
    Sleep(50)

    ; Explosions!
    WinActivate("Ddx EasySTONE")
    WinWaitActive("Ddx EasySTONE")
    Sleep(50)
    ControlClick("Ddx EasySTONE", "", "[CLASS:EasyStoneView; INSTANCE:1]", "secondary", 1, 0, 0)
    Sleep(150)
    ; Find and click Select type option
    ;$aCoord2 = PixelSearch(-2556, 725, -2450, 750, 0x9C8189, 20)
    $aCoord2 = PixelSearch(-2556, 503, -2400, 900, 0x9E4787, 30)
    If Not @error Then
        ;TrayTip("Test2",$aCoord2[0] & "," & $aCoord2[1],5)
        MouseClick("left", $aCoord2[0], $aCoord2[1] + 15)
        Sleep(20)
        MouseClick("left", $aCoord[0] + 1, $aCoord[1] + 10)
        Sleep(20)
        ControlClick("Ddx EasySTONE", "", "[CLASS:Button; INSTANCE:58]")
        Sleep(50)
        ControlClick("Ddx EasySTONE", "", "[CLASS:Button; INSTANCE:14]")
    Else
        MsgBox(0, "", "Did not choose Select type")
    EndIf
    ;ConsoleWrite("End _RemoveBlueLines")

EndFunc   ;==>_RemoveBlueLines


Func _Export($vTabletID)

    Sleep(100)

    If FileExists($sFolderPath & "\ShopDrawing") Then
        $sExportPath = $sFolderPath & "\ShopDrawing\" & $vTabletID & ".dxf"
    Else
        DirCreate($sFolderPath & "\ShopDrawing")
        $sExportPath = $sFolderPath & "\ShopDrawing\" & $vTabletID & ".dxf"
    EndIf

    WinActivate("Ddx EasySTONE")
    WinWaitActive("Ddx EasySTONE")
    Send("!f")
    $i = 0
    While $i < 9
        Send("{DOWN}")
        $i = $i + 1
    WEnd
    Send("{ENTER}")
    WinActivate("Export")
    WinWaitActive("Export")
    ControlSetText("Export", "", "[CLASS:Edit; INSTANCE:1]", $sExportPath)
    Send("{ENTER}")
    $SaveExists = WinExists("Export")
    While $SaveExists = 1
        Sleep(50)
        $SaveExists = WinExists("Export")
    WEnd
    WinActivate("Ddx EasySTONE")
    Send("^n")
    Opt("WinTitleMatchMode", 1)
    WinWaitActive("EasySTONE")
    ControlClick("EasySTONE", "", "[CLASS:Button; INSTANCE:2]")
    Sleep(100)
    WinWait("Untitled - Ddx EasySTONE")
    Sleep(100)
    Opt("WinTitleMatchMode", 2)
EndFunc   ;==>_Export


Func _Log($vLogText)

    ; If some person deleted the log file recreate it.
    If Not FileExists(@ScriptDir & "\Log.log") Then
        _FileCreate(@ScriptDir & "\Log.log")
    EndIf

    _FileWriteLog(@ScriptDir & "\Log.log", $vLogText)

EndFunc   ;==>_Log



Func _HonorLog($vTabletID, $vLine1)

    If Not FileExists(@ScriptDir & "\HonorLog.log") Then
        _FileCreate(@ScriptDir & "\HonorLog.log")
    EndIf

    _FileWriteLog(@ScriptDir & "\HonorLog.log", $vTabletID & "{TAB}{TAB}" & $vLine1)

EndFunc   ;==>_HonorLog

Func _SetSaveDir()
    Global $sFolderPath = FileSelectFolder("Select directory to save est files",@ScriptDir)
EndFunc


; Wait for trigger input
While 1
    Sleep(50)
WEnd

My syntax and code style is pretty mediocre I'm sure but it works.. except for this strange semi-colon issue.

Any help is greatly appreciated.

Edited by Xentradi
Issue solved. Setting ControlSend flag to 1 resolved issue.

Share this post


Link to post
Share on other sites



There is only one ControlSend in your script. Does $sSavePath contain a semicolon?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
31 minutes ago, water said:

There is only one ControlSend in your script. Does $sSavePath contain a semicolon?

Yes only one. $sSavePath is set as follows:

$sSavePath = $sFolderPath & "\" & $vTabletID & ".est"

where $sFolderPath is set in this manor:

$sFolderPath = FileSelectFolder("Select directory to save est files",@ScriptDir)

 

It actually saves a few files correctly then randomly it just types a semicolon instead of the colon. 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Did you try to set the flag parameter in ControlSend to 1?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I have not, didn't think it would work with semi-colons or keys that need modifiers to type. I'll give it a try now.

 

 

edit: weird punctuation. 

Edited by Xentradi

Share this post


Link to post
Share on other sites

Changing the flag worked great!

Share this post


Link to post
Share on other sites

:) 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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