Search the Community
Showing results for tags 'Compiled Scite'.
-
I've noticed that WinTitleMatchMode seems to behave differently when a script is compiled. Here is a little program to demo it. #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=opttest.exe #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <Misc.au3> #include <WinAPI.au3> $arg = StringSplit($CmdLineRaw, " ") If StringInStr($arg[1], "ErrorStdOut") Then ConsoleWrite('Run from Scite' & @CRLF) While StringInStr($arg[1], 'adotool') = 0 _ArrayDelete($arg, 1) $arg[0] = $arg[0] - 1 ;ConsoleWrite($arg[1] & @CRLF) WEnd _ArrayDelete($arg, 1) $arg[0] = $arg[0] - 1 ;_ArrayDisplay($arg) Else ConsoleWrite('Run from Command Line' & @CRLF) EndIf $collectDouble = False $collectSingle = False $doubleString = '' $singleString = '' Dim $newArg[1] _ArrayDelete($arg,0) For $f In $arg If StringRegExp($f, '^["]') And Not $collectSingle Then ;ConsoleWrite("Collect Single TRUE" & @CRLF) $collectDouble = True EndIf If StringRegExp($f, "^[']") And Not $collectDouble Then ;ConsoleWrite("Collect double TRUE" & @CRLF) $collectSingle = True EndIf If $collectDouble Then $doubleString = $doubleString & $f If StringRegExp($f, '["]$') Then $collectDouble = False _ArrayAdd($newArg, $doubleString) ;ConsoleWrite("1 add dbl " & $doubleString & 'collectDouble ' & $collectDouble & @CRLF) $doubleString = '' Else $doubleString = $doubleString & ' ' ContinueLoop EndIf ElseIf $collectSingle Then $singleString = $singleString & $f If StringRegExp($f, "[']$") Then $collectSingle = False _ArrayAdd($newArg, $singleString) ;ConsoleWrite("2 add sgl " & $singleString & ' collectSingle ' & $collectSingle & @CRLF) $singleString = '' Else $singleString = $singleString & ' ' ContinueLoop EndIf Else If Not $f = "" Then _ArrayAdd($newArg, $f) ;ConsoleWrite("2 add term " & $f & @CRLF) EndIf EndIf Next Dim $pos[2] $pos[0] = 100 $pos[1] = 100 $p = 0 For $i = 1 To UBound($newArg) Select Case StringInStr($newArg[$i], "/e") > 0 AutoItSetOption("WinTitleMatchMode", 3) ConsoleWrite('Exact Match On' & @CRLF) Case StringInStr($newArg[$i], "/s") > 0 AutoItSetOption("WinTitleMatchMode", 2) ConsoleWrite('Substring Match On' & @CRLF) Case StringIsDigit($newArg[$i]) $pos[$p] = Int($newArg[$i]) $p = $p + 1 If $p > 1 Then ExitLoop EndIf Case Else $fc = StringLeft($newArg[$i], 1) If $fc = '"' Or $fc = "'" Then $title = StringMid($newArg[$i], 2, StringLen($newArg[$i]) - 2) Else $title = $newArg[$i] EndIf EndSelect Next ConsoleWrite('MouseMove( "' & $title & '","", ' & $pos[0] & ', ' & $pos[1] & ")" & @CRLF ) $handle= WinGetHandle($title) ConsoleWrite('Moving "' & WinGetTitle($handle) & @CRLF) WinMove($handle,"",$pos[0],$pos[1]) exit 0 Suppose you compile this as a CUI called opttest.exe and then opened a cmd.exe window then and ran these commands: notepad fred.txt opttest.exe /s fred 100 100 Then the command line window will be moved although opttest claims it is moving "fred.txt - Notepad" if you run this command next opttest.exe /e "fred.txt - Notepad" 100 120 Then opttest will claim it is moving "fred.txt - Notepad" and the notepad window will be moved. However if this same script is Run from Scite using F5 then the Notepad window gets moved in both cases. Why is this?