XGamerGuide Posted August 14, 2021 Posted August 14, 2021 If I compile with more options then no EXE is created and the window closes again immediately. If I let Tidy walk over it, he'll stop in one place. My Code: expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form = GUICreate("auWin", 525, 350) WinSetOnTop($Form, "", 1) $Label1 = GUICtrlCreateLabel("title/class (optional):", 8, 10, 100, 17) $Input1 = GUICtrlCreateInput("", 104, 8, 241, 21) $Label2 = GUICtrlCreateLabel("handle (optinal):", 8, 34, 78, 17) $Input2 = GUICtrlCreateInput("", 90, 32, 255, 21) $Radio1 = GUICtrlCreateRadio("Match the title from the start", 352, 8, 153, 17) GUICtrlSetState(-1, 1) $Radio2 = GUICtrlCreateRadio("Match any substring in the title", 352, 32, 169, 17) $Radio3 = GUICtrlCreateRadio("Exact title match", 352, 56, 105, 17) $Radio4 = GUICtrlCreateRadio("Advanced mode", 352, 80, 105, 17) $Combo1 = GUICtrlCreateCombo("display", 8, 64, 97, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "flash|close|kill|hide|show|minimize|maximize|restore|disable|enable|onTop|notOnTop|transparency|title|move|getPos|getText") $Button1 = GUICtrlCreateButton("START", 8, 96, 97, 41) $Button2 = GUICtrlCreateButton("Window Titles and Text (Advanced)", 112, 64, 233, 33) $Progress1 = GUICtrlCreateProgress(112, 104, 401, 33) $Edit1 = GUICtrlCreateEdit("", 8, 144, 505, 193, BitOR($GUI_SS_DEFAULT_EDIT,$ES_READONLY)) GUICtrlSetData(-1, "") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Radio1) = 1 Then AutoItSetOption("WinTitleMatchMode", 1) If GUICtrlRead($Radio2) = 1 Then AutoItSetOption("WinTitleMatchMode", 2) If GUICtrlRead($Radio3) = 1 Then AutoItSetOption("WinTitleMatchMode", 3) If GUICtrlRead($Radio4) = 1 Then AutoItSetOption("WinTitleMatchMode", 4) $title = GUICtrlRead($Input1) $fromInput2 = GUICtrlRead($Input2) $handle = Ptr($fromInput2) If $fromInput2 <> "" And $handle = "" Then $handle = "not a handle" If $title = "" And $handle = "" Then $winList = WinList() ElseIf $title = "" Then If WinExists($handle) Then local $GlobalwinList = [[1,""],[WinGetTitle($handle),$handle]] Else local $GlobalwinList = [[0,""]] EndIf $winList = $GlobalwinList ElseIf $handle = "" Then $winList = WinList($title) Else WinSetOnTop($Form, "", 0) MsgBox(16, "ERROR", "Please enter title, handle or nothing") WinSetOnTop($Form, "", 1) ContinueLoop EndIf $combo = GUICtrlRead($Combo1) If $combo = "transparency" Then WinSetOnTop($Form, "", 0) $trans = InputBox("transparency", "Set the transparency to a value between 0 and 255", "255") if $trans = "" Then ContinueLoop WinSetOnTop($Form, "", 1) EndIf If $combo = "title" Then WinSetOnTop($Form, "", 0) $newTitle = InputBox("title", "Set the title") if $newTitle = "" Then ContinueLoop WinSetOnTop($Form, "", 1) EndIf If $combo = "move" Then WinSetOnTop($Form, "", 0) $x = InputBox("X", "X coordinate to move to", "0") if $x = "" Then ContinueLoop $y = InputBox("Y", "Y coordinate to move to", "0") if $y = "" Then ContinueLoop If MsgBox(4, "size?", "Would you like to specify a size?") = 6 Then $width = InputBox("width", "Width", "500") if $width = "" Then ContinueLoop $height = InputBox("height", "Height", "500") if $height = "" Then ContinueLoop $resize = True Else $resize = False EndIf WinSetOnTop($Form, "", 1) EndIf GUICtrlSetData($Edit1, "") GUICtrlSetData($Progress1, 0) $i = 0 While $i < $winList[0][0] $i += 1 $name = $winList[$i][0] $h = $winList[$i][1] If $winList[$i][0] <> "auWin" Then Switch $combo Case "display": $txt = "" Case "flash": $txt = WinFlash($h) Case "close": $txt = WinClose($h) Case "kill": $txt = WinKill($h) Case "hide": $txt = WinSetState($h, "", @SW_HIDE) Case "show": $txt = WinSetState($h, "", @SW_SHOW) Case "minimize": $txt = WinSetState($h, "", @SW_MINIMIZE) Case "maximize": $txt = WinSetState($h, "", @SW_MAXIMIZE) Case "restore": $txt = WinSetState($h, "", @SW_RESTORE) Case "disable": $txt = WinSetState($h, "", @SW_DISABLE) Case "enable": $txt = WinSetState($h, "", @SW_ENABLE) Case "onTop": $txt = WinSetOnTop($h, "", 1) Case "notOnTop": $txt = WinSetOnTop($h, "", 0) Case "transparency": $txt = WinSetTrans($h, "", $trans) Case "title": $txt = WinSetTitle($h, "", $newTitle) Case "move": If $resize Then $txt = WinMove($h, "", $x, $y, $width, $height) Else $txt = WinMove($h, "", $x, $y) EndIf Case "getPos" $pos = WinGetPos($h) $txt = "X: " & $pos[0] & " Y: " & $pos[1] & " Width: " & $pos[2] & " Height: " & $pos[3] Case "getText": $txt = @CRLF & WinGetText($h) EndSwitch GUICtrlSetData($Edit1, "[" & $h & "] (" & $name & ") " & $txt & @CRLF & GUICtrlRead($Edit1)) EndIf GUICtrlSetData($Progress1, $i / $winList[0][0] * 100) WEnd GUICtrlSetData($Progress1, 100) Case $Button2 ShellExecute("https://www.autoitscript.com/autoit3/docs/intro/windowsadvanced.htm") EndSwitch WEnd By the way, I program in Viersual Stadio Code. I have the full version of SciTE and can therefore run my program with F5. When this happens, my program is first compared with this one EXE (C:\Program Files (x86)\AutoIt3\Au3Check.exe) , which checks whether my program does not work. I get a syntax error with Case. I think it might have something to do with it.
Developers Jos Posted August 14, 2021 Developers Posted August 14, 2021 (edited) 3 hours ago, XGamerGuide said: I get a syntax error with Case. I think it might have something to do with it. NO this is the problem, that is why we have au3check! Au3check is telling you there is a syntax error in line Case "display": So what did the helpfile say about the syntax when you looked? Jos Edited August 14, 2021 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
XGamerGuide Posted August 15, 2021 Author Posted August 15, 2021 oh I only see now that there is an :
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now