cag8f Posted June 12, 2023 Share Posted June 12, 2023 Hi all. A certain third party Windows app displays an on-screen text input field. If I click inside, the AutoIt Window Info tool correctly displays the value of this input field (see screenshots below). In my AutoIt script, what's proper way to read this value? I've attached a screenshot of the Window Info tool results. Note that in it are values for Class and ClassName. These values are not specific to this particular input field; they are the values of the entire parent control (which contains many different buttons; see screenshot below). FYI the text input field in-question is itself part of a dropdown menu, and that dropdown menu is opened only when the user clicks a particular button. Thanks in advance. Link to comment Share on other sites More sharing options...
Andreik Posted June 12, 2023 Share Posted June 12, 2023 ControlGetText('[CLASS:WindowsForms10.Window.20808.app.0.1a52015_r6_ad1]', '', '[CLASS:WindowsForms10.EDIT.app.0.1a52015_r6_ad11; INSTANCE:1]') cag8f 1 Link to comment Share on other sites More sharing options...
ioa747 Posted June 12, 2023 Share Posted June 12, 2023 (edited) in continued from: 210355-after-controlclick-how-can-i-check-the-color-of-the-clicked-coordinate expandcollapse popupShareXMenu("Send", "r") ;Rectangle ;~ ShareXMenu("Click", 869) ;Tool Options Local $iBorderSize = ShareXMenu("Get_ToolOptions", "BorderSize") ;get BorderSize Local $sBorderStyle = ShareXMenu("Get_ToolOptions", "BorderStyle") ;get BorderStyle ConsoleWrite("$iBorderSize=" & $iBorderSize & @CRLF) ConsoleWrite("$sBorderStyle=" & $sBorderStyle & @CRLF) ShareXMenu("Set_ToolOptions", "BorderSize=" & $iBorderSize + 2) ;set BorderSize ShareXMenu("Set_ToolOptions", "BorderStyle=DashDotDot") ;set BorderStyle $iBorderSize = ShareXMenu("Get_ToolOptions", "BorderSize") ;get BorderSize $sBorderStyle = ShareXMenu("Get_ToolOptions", "BorderStyle") ;get BorderStyle ConsoleWrite("$iBorderSize=" & $iBorderSize & @CRLF) ConsoleWrite("$sBorderStyle=" & $sBorderStyle & @CRLF) ;---------------------------------------------------------------------------------------- Func ShareXMenu($sCommand, $sOption) ;~ https://getsharex.com/docs/keybinds#tools ;~ Image editor only ;~ Keybind Description ;~ Send, "^{NUMPADADD}" Zoom in ;~ Send, "^{NUMPADSUB}" Zoom out ;~ Send, "^{NUMPAD0}" Reset zoom ;~ Send, "^!{NUMPAD0}" Zoom to fit ;~ Send, "{ENTER}" Close image editor and continue task with changes applied ;~ Send, "{SPACE}" Close image editor and continue task without apply changes ;~ Send, "{ESC}" Close image editor and cancel task ;~ Send, "^s" Save image ;~ Send, "^+s" Save image as… ;~ Send, "^+c" Copy image to clipboard ;~ Send, "^u" Upload image ;~ Send, "^p" Print image ;~ ;~ Tools ;~ Keybind Description ;~ Send, "m" Select and move ;~ Send, "r" Rectangle ;~ Send, "e" Ellipse ;~ Send, "f" Freehand ;~ Send, "l" Line ;~ Send, "a" Arrow ;~ Send, "o" Text (Outline) ;~ Send, "t" Text (Background) ;~ Send, "s" Speech balloon ;~ Send, "i" Step ;~ Send, "b" Blur ;~ Send, "p" Pixelate ;~ Send, "h" Highlight ;~ Send, "c" Crop image ;~ Send, "x" Cut out ;~ ;~ Click, 305 freehand arrow ;~ Click, 503 magnify ;~ Click, 527 image file ;~ Click, 585 sticker ;~ Click, 613 cursor ;~ Click, 642 smart eraser ;~ Click, 814 Border Color ;~ Click, 843 Fill Color ;~ Click, 869 Tool Options ;~ ;~ Get_ToolOptions, "BorderSize" Get BorderSize ;~ Set_ToolOptions, "BorderSize=5" Set BorderSize to 5 ;window handle Local $hWnd = WinWait("ShareX - Editor menu", "", 3) Local $aWinPos = WinGetPos($hWnd) ;ConsoleWrite("$aWinPos:" & $aWinPos[0] & ", " & $aWinPos[1] & ", " & $aWinPos[2] & ", " & $aWinPos[3] & @CRLF) ;icon size Local Const $iSZ = $aWinPos[3] / 2 ; - 16 Switch $sCommand Case "Send" ConsoleWrite("- Send:" & $sOption & @CRLF) Local $hParent = WinGetHandle("ShareX - Image editor") WinActivate($hParent) Sleep(100) Send($sOption) Case "Click" $sOption = Int($sOption) ConsoleWrite("- Click:" & $sOption & @CRLF) ControlClick($hWnd, "", "WindowsForms10.Window.8.app.0.1a52015_r6_ad11", "left", 1, $sOption, $iSZ) ;MouseMove($aWinPos[0] + $sOption, $aWinPos[1] + $iSZ) Case "Get_ToolOptions" ConsoleWrite("- Get_ToolOptions:" & $sOption & @CRLF) ;first click Tool Options ControlClick($hWnd, "", "WindowsForms10.Window.8.app.0.1a52015_r6_ad11", "left", 1, 869, $iSZ) Local $Result Switch $sOption Case "BorderSize" $Result = Int(ControlGetText("[CLASS:WindowsForms10.Window.808.app.0.1a52015_r6_ad1]", "", "WindowsForms10.EDIT.app.0.1a52015_r6_ad11")) Case "CornerRadius" $Result = Int(ControlGetText("[CLASS:WindowsForms10.Window.808.app.0.1a52015_r6_ad1]", "", "WindowsForms10.EDIT.app.0.1a52015_r6_ad12")) Case "BorderStyle" $Result = ControlGetText("[CLASS:WindowsForms10.Window.808.app.0.1a52015_r6_ad1]", "", "WindowsForms10.COMBOBOX.app.0.1a52015_r6_ad11") EndSwitch Send("{ESC}") Return $Result Case "Set_ToolOptions" ConsoleWrite("- Set_ToolOptions:" & $sOption & @CRLF) ;first click Tool Options ControlClick($hWnd, "", "WindowsForms10.Window.8.app.0.1a52015_r6_ad11", "left", 1, 869, $iSZ) Local $aSplt = StringSplit($sOption, "=") If $aSplt[0] <> 2 Then Exit ConsoleWrite("! exit" & @CRLF) Switch $aSplt[1] Case "BorderSize" ControlSetText("[CLASS:WindowsForms10.Window.808.app.0.1a52015_r6_ad1]", "", "WindowsForms10.EDIT.app.0.1a52015_r6_ad11", $aSplt[2]) Case "CornerRadius" ControlSetText("[CLASS:WindowsForms10.Window.808.app.0.1a52015_r6_ad1]", "", "WindowsForms10.EDIT.app.0.1a52015_r6_ad12", $aSplt[2]) Case "BorderStyle" ControlFocus("[CLASS:WindowsForms10.Window.808.app.0.1a52015_r6_ad1]", "", "WindowsForms10.COMBOBOX.app.0.1a52015_r6_ad11") Switch $aSplt[2] Case "Solid" Send("s") Case "Dash" Send("sd") Case "Dot" Send("sdd") Case "DashDot" Send("sddd") Case "DashDotDot" Send("sdddd") EndSwitch Send("{ESC}") EndSwitch Send("{ESC}") EndSwitch EndFunc ;==>ShareXMenu ;---------------------------------------------------------------------------------------- Edited June 12, 2023 by ioa747 UpDate cag8f 1 I know that I know nothing Link to comment Share on other sites More sharing options...
cag8f Posted June 17, 2023 Author Share Posted June 17, 2023 @ioa747@Andreik Thanks very much for your replies. I'm experiencing an issue though in which `ControlGetText` is not returning anything. I tried the code given by each of you, but with the same result. I've attached my code as well as Window Info tool results and output below, Thoughts? Local $hWnd = WinWait("ShareX - Editor menu", "", 3) ConsoleWrite("$hWnd: " & $hWnd & @CRLF) Local $aWinPos = WinGetPos($hWnd) ConsoleWrite("$aWinPos:" & $aWinPos[0] & ", " & $aWinPos[1] & ", " & $aWinPos[2] & ", " & $aWinPos[3] & @CRLF) Local $hControl = ControlGetHandle($hWnd, "", "WindowsForms10.Window.8.app.0.1a52015_r6_ad11") ConsoleWrite("$hControl=" & $hControl & @CRLF) Local $hMouseClick = MouseClick("left", 1319, 33); Click the 'Tool options' button. The previous code using ControlClick was proving to be buggy. ConsoleWrite("$hMouseClick=" & $hMouseClick & @CRLF) Sleep (2000) $Result = ControlGetText('[CLASS:WindowsForms10.Window.20808.app.0.1a52015_r6_ad1]', '', '[CLASS:WindowsForms10.EDIT.app.0.1a52015_r6_ad11; INSTANCE:1]') ;~ $Result = ControlGetText("[CLASS:WindowsForms10.Window.20808app.0.1a52015_r6_ad1]", "", "WindowsForms10.EDIT.app.0.1a52015_r6_ad11") ConsoleWrite("$Result = " & $Result & @CRLF) As an aside, do you have this code in-hand already? Or are you writing from scratch each time. What you're providing me is truly amazing--thank you very much. Link to comment Share on other sites More sharing options...
Solution ioa747 Posted June 17, 2023 Solution Share Posted June 17, 2023 @cag8f when you start shareX, by default the active tool is 'select and move' which does not have the option 'Tool Options' for this reason when I start the example I start it with r 'Rectangle' to make sure it has the option 'Tool Options' (or whatever tool you want, which has the option 'Tool Options') e.g. when i choose 'Rectangle' the screen position of 'Tool Options' is circa 1322, 37 when i choose 'Text (Background)' the screen position of 'Tool Options' is circa 1322, 37 when i choose 'Text (Outline)' the screen position of 'Tool Options' is circa 1296, 37 when i choose 'Line' the screen position of 'Tool Options' is circa 1296, 37 Local $hWnd = WinWait("ShareX - Editor menu", "", 3) ConsoleWrite("$hWnd: " & $hWnd & @CRLF) ;~ ;first click Tool Rectangle ControlClick($hWnd, "", "WindowsForms10.Window.8.app.0.1a52015_r6_ad11", "left", 1, 220, 16) ;Then click Tool Options ControlClick($hWnd, "", "WindowsForms10.Window.8.app.0.1a52015_r6_ad11", "left", 1, 869, 16) Sleep (200) ;get value from 'BorderSize' $Result = Int(ControlGetText("[CLASS:WindowsForms10.Window.808.app.0.1a52015_r6_ad1]", "", "WindowsForms10.EDIT.app.0.1a52015_r6_ad11")) ;here we have some difference 'CLASS:WindowsForms10.Window.20808.app.' VS 'CLASS:WindowsForms10.Window.808.app.' *** <-- ;~ $Result = ControlGetText('[CLASS:WindowsForms10.Window.20808.app.0.1a52015_r6_ad1]', '', '[CLASS:WindowsForms10.EDIT.app.0.1a52015_r6_ad11; INSTANCE:1]') ;Then send esc to 'ShareX - Editor menu' to close the 'Tool Options' WinActivate($hWnd) Send("{ESC}") ;print result ConsoleWrite("$Result = " & $Result & @CRLF) ℹ️ because I have ShareX version 15, and among the screenshots you sent us, the only difference I noticed is that for you it is _r6_ and for me it is _r22_ for the 'Window.20808.app' in line 16 I didn't see any data and I don't know but the pattern doesn't match so check it cag8f 1 I know that I know nothing Link to comment Share on other sites More sharing options...
cag8f Posted June 18, 2023 Author Share Posted June 18, 2023 OK thanks for that. Using your code, with a few tweaks, I was able to obtain the value of Tool Options-->Border Size. Here were the tweaks: For me, line 2 of your code clicked the 'Border color' button, not 'Tool options.' When I changed the value to `940`, then the line of code successfully clicked 'Tool options' and opened its dropdown. So Ieft the value at `940`. Later in the code the value `969` appears a second time--I also changed it to `940` there. In your definition of `$Result`, you pass a value for `CLASS` containing the substring `Window.808.app`. To get mine to work, my substring was `Window.20808.app`. See Window Info tool below. So let's call this question resolved, thanks! I'll try to press on and figure out how to change the value (using your code as a guide). Final question while we're here: How do I freeze the AutoIt Window Info tool when ShareX is open? Pressing ctrl+alt+f seems to activate a ShareX shortcut, and doesn't freeze the Window Info tool. > because I have ShareX version 15 I'm also using ShareX v15.0. 13 hours ago, ioa747 said: when you start shareX, by default the active tool is 'select and move' which does not have the option 'Tool Options' Yep I am indeed congnizant that the rectangle must be selected in order for the correct 'Tool Options' button to appear. Although I acquiesce that I may have overlooked it in some tests. Window Info Tool Link to comment Share on other sites More sharing options...
ioa747 Posted June 18, 2023 Share Posted June 18, 2023 49 minutes ago, cag8f said: Pressing ctrl+alt+f seems to activate a ShareX shortcut, right click on the ShareX icon (on the taskbar at the bottom right) and choose hotkey settings to see if there is ctrl+alt+f shortcut and change it I know that I know nothing Link to comment Share on other sites More sharing options...
cag8f Posted June 19, 2023 Author Share Posted June 19, 2023 (edited) @ioa747 Please don't insinuate that I would do something so stupid as to assign a ShareX hotkey that collides with the AutoIt Window Info tool hotkey. What actually happened is that I created a custom hotkey using an AutoIt script I wrote myself which collides with the AutoIt Window Info tool hotkey 🙃😅 Anyway, mystery solved on that. Edited June 19, 2023 by cag8f Link to comment Share on other sites More sharing options...
cag8f Posted June 24, 2023 Author Share Posted June 24, 2023 @ioa747 I'm back, and experiencing an issue with the border size code. In short, my code will change the value displayed in the border size control, and change it to my desired value. For example, my code will change the value from 1 to 5--exactly as desired. But when I then use ShareX to actually draw a shape (e.g. rectangle), the border size of that shape still remains at the previous value (see screenshots below). Any ideas how to troubleshoot that? Of Note I can confirm that the value displayed in the 'Border size' control remains at 5 during the entirety of these steps. It does not get reset back to 1 at any point. Here are screenshots. My code is below. For simplicity I've removed some lines that are extraneous for this task. My Code ShareXMenu("Click", 940);Tool Options ShareXMenu("Set_ToolOptions", "BorderSize=5") Func ShareXMenu($sCommand, $sOption) Local $hWnd = WinWait("ShareX - Editor menu", "", 3) Local $aWinPos = WinGetPos($hWnd) Local Const $iSZ = $aWinPos[3] / 2 ; - 16 Switch $sCommand Case "Click" $sOption = Int($sOption) ControlClick($hWnd, "", "WindowsForms10.Window.8.app.0.1a52015_r6_ad11", "left", 1, $sOption, $iSZ) Case "Set_ToolOptions" ControlClick($hWnd, "", "WindowsForms10.Window.EDIT.app.0.1a52015_r6_ad11", "left", 1, 940, $iSZ) Local $aSplt = StringSplit($sOption, "=") If $aSplt[0] <> 2 Then Exit ConsoleWrite("! exit" & @CRLF) ControlSetText("[CLASS:WindowsForms10.Window.20808.app.0.1a52015_r6_ad1]", "", "WindowsForms10.EDIT.app.0.1a52015_r6_ad11", $aSplt[2]) Send("{ESC}") Send("{ESC}") EndSwitch EndFunc Link to comment Share on other sites More sharing options...
ioa747 Posted June 24, 2023 Share Posted June 24, 2023 Since the rectangle is selected try the follow ShareXMenu("Click", 940) ;Tool Options ShareXMenu("Set_ToolOptions", "BorderSize=5") Func ShareXMenu($sCommand, $sOption) Local $hWnd = WinWait("ShareX - Editor menu", "", 3) Local $aWinPos = WinGetPos($hWnd) Local Const $iSZ = $aWinPos[3] / 2 ; - 16 Switch $sCommand Case "Click" $sOption = Int($sOption) ControlClick($hWnd, "", "WindowsForms10.Window.8.app.0.1a52015_r6_ad11", "left", 1, $sOption, $iSZ) Case "Set_ToolOptions" ControlClick($hWnd, "", "WindowsForms10.Window.EDIT.app.0.1a52015_r6_ad11", "left", 1, 940, $iSZ) Local $aSplt = StringSplit($sOption, "=") If $aSplt[0] <> 2 Then Exit ConsoleWrite("! exit" & @CRLF) ControlSetText("[CLASS:WindowsForms10.Window.20808.app.0.1a52015_r6_ad1]", "", "WindowsForms10.EDIT.app.0.1a52015_r6_ad11", $aSplt[2]) Sleep(50) ControlSend("[CLASS:WindowsForms10.Window.20808.app.0.1a52015_r6_ad1]", "", "WindowsForms10.EDIT.app.0.1a52015_r6_ad11", "{ENTER}") EndSwitch EndFunc ;==>ShareXMenu I know that I know nothing Link to comment Share on other sites More sharing options...
cag8f Posted June 24, 2023 Author Share Posted June 24, 2023 OK thanks very much for that. Let me have a look and give it a try later today or tomorrow. ioa747 1 Link to comment Share on other sites More sharing options...
cag8f Posted June 24, 2023 Author Share Posted June 24, 2023 (edited) @ioa747 Bingo, that did it--thanks! So the solution here was to simply sleep for a short interval. For the future, are there hard and fast rules as to when that's needed? Or maybe rules of thumb? Or is it random? Or something else? Edit: Nevermind, I see the solution required more than just a sleep. Let me be sure I understand the fix. Edit 2: OK I think I see the fix. You basically added a step in which the user presses 'Enter.' Sound right? If so, understood, and good to know for the future. Thanks. Edit 3: My issue is resolved, so thanks again. But I have one follow-up question while we're here. Your full code that you posted in this thread on June 13 works solidly when the ShareX shape is rectangle. But if the shape is arrow, at least some things (maybe all?) will break, since, as you pointed out at one point, there is one fewer button in the ShareX toolbar. How do you (or would you) fix that? Namely, I'd like my AutoIt code to change the border size regardless of whether the selected shape is a rectangle or an arrow. I guess I can have the code first check the color value of certain pixels in the toolbar (e.g. the extra button added when selecting 'rectangle')--that could then tell my code which pixel to click to open 'Tool options.' That's a bit fragile though, so if you know any other ways I'm all ears 🙂 Edited June 24, 2023 by cag8f Link to comment Share on other sites More sharing options...
ioa747 Posted June 24, 2023 Share Posted June 24, 2023 1 hour ago, cag8f said: For the future, are there hard and fast rules as to when that's needed? I haven't found the golden rule Everything is done after testing. when you give a value, and while it's there, and you don't get it, then you give it a little time and try again 1 hour ago, cag8f said: You basically added a step in which the user presses 'Enter.' since we set the Border Size to a value e.g. 10, and while it has taken the value in the text box, it does not update the square, I thought that with the enter I would force it to update it ... and succeeded 1 hour ago, cag8f said: How do you (or would you) fix that? ideally it would be to have a shortcut like the rest of the tools m=Select and move , r=Rectangle , a=Arrow , etc since the automations were done step by step it's not that annoying and since tool defines the position of 'tools options' I would need another parameter for $tool I would logically go to one of the following approaches ShareXMenu("Send", "r") ;Rectangle MouseClickDrag("left", 100, 100, 300, 300) ShareXMenu("Set_ToolOptions_Rectangle", "BorderSize=2") ;set BorderSize ShareXMenu("Set_ToolOptions_Rectangle", "BorderStyle=Solid") ;set BorderStyle ShareXMenu("Send", "a") ;Arrow MouseClickDrag("left", 100, 100, 300, 300) ShareXMenu("Set_ToolOptions_Arrow", "BorderSize=2") ;set BorderSize ShareXMenu("Set_ToolOptions_Arrow", "BorderStyle=Solid") ;set BorderStyle ;~ Or ShareXMenu("Send", "r") ;Rectangle MouseClickDrag("left", 100, 100, 300, 300) ShareXMenu("Set_ToolOptions ", "Rectangle=BorderSize=2") ;set BorderSize ShareXMenu("Set_ToolOptions", "Rectangle=BorderStyle=Solid") ;set BorderStyle ShareXMenu("Send", "a") ;Arrow MouseClickDrag("left", 100, 100, 300, 300) ShareXMenu("Set_ToolOptions", "Arrow=BorderSize=2") ;set BorderSize ShareXMenu("Set_ToolOptions", "Arrow=BorderStyle=Solid") ;set BorderStyle ;~ Or ShareXMenu("Send", "r", "Rectangle") ;Rectangle MouseClickDrag("left", 100, 100, 300, 300) ShareXMenu("Set_ToolOptions ", "BorderSize=2", "Rectangle") ;set BorderSize ShareXMenu("Set_ToolOptions", "BorderStyle=Solid", "Rectangle") ;set BorderStyle ShareXMenu("Send", "a", "Arrow") ;Arrow MouseClickDrag("left", 100, 100, 300, 300) ShareXMenu("Set_ToolOptions", "Arrow=BorderSize=2", "Arrow") ;set BorderSize ShareXMenu("Set_ToolOptions", "Arrow=BorderStyle=Solid", "Arrow") ;set BorderStyle and I would probably choose the first one I know that I know nothing Link to comment Share on other sites More sharing options...
cag8f Posted June 25, 2023 Author Share Posted June 25, 2023 Regarding my issue about the tool options button for different shapes, you're suggesting that I create one keyboard shortcut to change the border size for rectangles, and a second keyboard shortcut to change the border size for arrows. Am I understanding that correctly? Not arguing or anything--just want to make sure I'm understanding 🙂 >> haven't found the golden rule >> Everything is done after testing. >> when you give a value, and while it's there, and you don't get it, then you give it a little time and try again OK yep fair enough--will keep that in-mind. Thanks! Link to comment Share on other sites More sharing options...
ioa747 Posted June 25, 2023 Share Posted June 25, 2023 1 hour ago, cag8f said: one keyboard shortcut to change the border size for rectangles, and a second keyboard shortcut to change the border size for arrows No, I'm not talking about keyboard shortcuts, but about a parameter in the ShareXMenu($sCommand, $sOption) function so that it knows which tool is active, in order to correctly select the 'tools' option and this can be done in two ways or by giving the parameter when you call the function, e.g. ShareXMenu("Set_ToolOptions_Rectangle", "BorderSize=2") or declaring a variable that holds which tool is active, and update every time I change a tool e.g. $sMyTool = "Rectangle" Func ShareXMenu($sCommand, $sOption) ;window handle Local $hWnd = WinWait("Sharex - Editor menu", "", 3) Local $aWinPos = WinGetPos($hWnd) ;icon size Local Const $iSZ = $aWinPos[3] / 2 ; - 16 Switch $sCommand Case "Send" Case "Click" Case "Get_ToolOptions_Rectangle" Case "Set_ToolOptions_Rectangle" Case "Get_ToolOptions_Arrow" Case "Set_ToolOptions_Arrow" EndSwitch EndFunc ;==>ShareXMenu I know that I know nothing Link to comment Share on other sites More sharing options...
cag8f Posted June 25, 2023 Author Share Posted June 25, 2023 >> so that it knows which tool is active, in order to correctly select the 'tools' option >> or declaring a variable that holds which tool is active, and update every time I change a tool e.g. $sMyTool = "Rectangle" OK right that makes sense. But how do I have AutoIt automatically determine which tool is active? i.e. without me having to pass that as input. Link to comment Share on other sites More sharing options...
ioa747 Posted June 25, 2023 Share Posted June 25, 2023 at the moment you call it e.g. ShareXMenu("Send", "r") ;Rectangle I know that I know nothing Link to comment Share on other sites More sharing options...
cag8f Posted June 26, 2023 Author Share Posted June 26, 2023 (edited) OK. So with that solution, I would then have to create/use two different keyboard shortcuts to change Border Size: One shortcut which calls ShareXMenu("Send", "r"); Rectangle One shortcut which calls ShareXMenu("Send", "a"); Arrow Am I understanding that correctly? I think I am still misunderstanding something. Edited June 26, 2023 by cag8f Link to comment Share on other sites More sharing options...
ioa747 Posted June 26, 2023 Share Posted June 26, 2023 as it is, it works fine for me to make it work for you, replace _r22_ with _r6_ and Window.808.app with Window.20808.app and in line 71 give the proper position of ToolOptions for Rectangle $ilPos = 869 ; it's on me $ilPos = 940 ; it's for you and in line 106 give the proper position of ToolOptions for Arrow $ilPos = 843 ; it's on me $ilPos = ??? ; it's for you expandcollapse popup#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ShareXMenu("Send", "r") ;Rectangle MouseClickDrag("left", 100, 100, 300, 300) ShareXMenu("Set_ToolOptions", "BorderSize=5") ;set BorderSize ShareXMenu("Send", "a") ;Arrow MouseClickDrag("left", 1100, 100, 1300, 300) ShareXMenu("Set_ToolOptions", "BorderSize=10") ;set BorderSize ShareXMenu("Set_ToolOptions", "ArrowHeadDirection=Both") ;set Arrow Head Direction ;---------------------------------------------------------------------------------------- Func ShareXMenu($sCommand, $sOption) ;~ https://getsharex.com/docs/keybinds#tools ;~ Tools ;~ Keybind Description ;~ Send, "m" Select and move ;~ Send, "r" Rectangle ;~ Send, "e" Ellipse ;~ Send, "f" Freehand ;~ Send, "l" Line ;~ Send, "a" Arrow ;~ Send, "o" Text (Outline) ;~ Send, "t" Text (Background) ;~ Send, "s" Speech balloon ;~ Send, "i" Step ;~ Send, "b" Blur ;~ Send, "p" Pixelate ;~ Send, "h" Highlight ;~ Send, "c" Crop image ;~ Send, "x" Cut out ;~ ;~ Click, 190 Click on 190=Select and move ;~ Set_ToolOptions, "BorderSize=5" Set BorderSize to 5 ;~ Set_ToolOptions, "BorderStyle=DashDot" Set BorderStyle to DashDot ;~ Set_ToolOptions, "ArrowHeadDirection=Both" Set Arrow Head Direction to Both ;window handle Local $hWnd = WinWait("ShareX - Editor menu", "", 3) If Not $hWnd Then Exit ConsoleWrite("! exit ShareX Not exist" & @CRLF) Local $hWndImageEditor = WinGetHandle("ShareX - Image editor") Local $aWinPos = WinGetPos($hWnd) Local Const $iSZ = $aWinPos[3] / 2 ; - 16 Local Static $sActiveTool = "SelectAndMove" ;Select and move Local $hWndToolOptions, $ilPos, $aSplt WinActivate($hWnd) Switch $sCommand Case "Send" ;ConsoleWrite("- Send:" & $sOption & @CRLF) Switch $sOption Case "r" ;Rectangle $sActiveTool = "Rectangle" Case "a" ;Arrow $sActiveTool = "Arrow" Case Else $sActiveTool = "SelectAndMove" EndSwitch WinActivate($hWndImageEditor) Sleep(20) Send($sOption) Case "Click" $sOption = Int($sOption) ;ConsoleWrite("- Click:" & $sOption & @CRLF) ControlClick($hWnd, "", "WindowsForms10.Window.8.app.0.1a52015_r22_ad11", "left", 1, $sOption, $iSZ) ;MouseMove($aWinPos[0] + $sOption, $aWinPos[1] + $iSZ) Case "Set_ToolOptions" ;ConsoleWrite("- Set_ToolOptions:" & $sOption & @CRLF) Switch $sActiveTool Case "Rectangle" ;Rectangle $ilPos = 869 ; * <- give here the Rectangle ToolOptions position ConsoleWrite("- Rectangle $ilPos=" & $ilPos & @CRLF) ;first click Tool Options ControlClick($hWnd, "", "WindowsForms10.Window.8.app.0.1a52015_r22_ad11", "left", 1, $ilPos, $iSZ) $hWndToolOptions = WinWait("[CLASS:WindowsForms10.Window.808.app.0.1a52015_r22_ad1]", "", 3) If Not $hWndToolOptions Then Exit ConsoleWrite("! exit Not $hWndToolOptions" & @CRLF) $aSplt = StringSplit($sOption, "=") If $aSplt[0] <> 2 Then Exit ConsoleWrite("! exit" & @CRLF) Switch $aSplt[1] Case "BorderSize" ControlSetText($hWndToolOptions, "", "WindowsForms10.EDIT.app.0.1a52015_r22_ad11", $aSplt[2] & @CRLF) Sleep(50) ControlSend($hWndToolOptions, "", "WindowsForms10.EDIT.app.0.1a52015_r22_ad11", "{TAB}{ESC}") Case "CornerRadius" ControlSetText($hWndToolOptions, "", "WindowsForms10.EDIT.app.0.1a52015_r22_ad12", $aSplt[2]) Sleep(50) ControlSend($hWndToolOptions, "", "WindowsForms10.EDIT.app.0.1a52015_r22_ad12", "{ENTER}") Case "BorderStyle" ControlFocus($hWndToolOptions, "", "WindowsForms10.COMBOBOX.app.0.1a52015_r22_ad11") Switch $aSplt[2] Case "Solid" Send("s") Case "Dash" Send("sd") Case "Dot" Send("sdd") Case "DashDot" Send("sddd") Case "DashDotDot" Send("sdddd") EndSwitch Sleep(50) ControlSend($hWndToolOptions, "", "WindowsForms10.COMBOBOX.app.0.1a52015_r22_ad11", "{TAB}{ESC}") EndSwitch Case "Arrow" ;Arrow $ilPos = 843 ; * <- give here the Arrow ToolOptions position ConsoleWrite("- Arrow $ilPos=" & $ilPos & @CRLF) ;first click Tool Options ControlClick($hWnd, "", "WindowsForms10.Window.8.app.0.1a52015_r22_ad11", "left", 1, $ilPos, $iSZ) $hWndToolOptions = WinWait("[CLASS:WindowsForms10.Window.808.app.0.1a52015_r22_ad1]", "", 3) If Not $hWndToolOptions Then Exit ConsoleWrite("! exit Not $hWndToolOptions" & @CRLF) $aSplt = StringSplit($sOption, "=") If $aSplt[0] <> 2 Then Exit ConsoleWrite("! exit $aSplt[0] <> 2" & @CRLF) Switch $aSplt[1] Case "BorderSize" ControlSetText($hWndToolOptions, "", "WindowsForms10.EDIT.app.0.1a52015_r22_ad11", $aSplt[2] & @CRLF) Sleep(20) ControlSend($hWndToolOptions, "", "WindowsForms10.EDIT.app.0.1a52015_r22_ad11", "{TAB}{ESC}") Case "CornerRadius" ControlSetText($hWndToolOptions, "", "WindowsForms10.EDIT.app.0.1a52015_r22_ad12", $aSplt[2]) Sleep(20) ControlSend($hWndToolOptions, "", "WindowsForms10.EDIT.app.0.1a52015_r22_ad12", "{ENTER}") Case "BorderStyle" ControlFocus($hWndToolOptions, "", "WindowsForms10.COMBOBOX.app.0.1a52015_r22_ad11") Switch $aSplt[2] Case "Solid" Send("s") Case "Dash" Send("sd") Case "Dot" Send("sdd") Case "DashDot" Send("sddd") Case "DashDotDot" Send("sdddd") EndSwitch Case "ArrowHeadDirection" ControlFocus($hWndToolOptions, "", "WindowsForms10.COMBOBOX.app.0.1a52015_r22_ad12") Switch $aSplt[2] Case "End" Send("e") Case "Start" Send("s") Case "Both" Send("b") EndSwitch Sleep(20) ControlSend($hWndToolOptions, "", "WindowsForms10.COMBOBOX.app.0.1a52015_r22_ad12", "{TAB}{ESC}") EndSwitch Case Else Return SetError(1, 1, 0) EndSwitch EndSwitch EndFunc ;==>ShareXMenu ;---------------------------------------------------------------------------------------- I know that I know nothing Link to comment Share on other sites More sharing options...
ioa747 Posted June 27, 2023 Share Posted June 27, 2023 in this shot icons 2 and 3 do not exist for me (this is the reason that $ilPos = 869 ; it's on me $ilPos = 940 ; it's for you) what is their description? did you make any other settings? I know that I know nothing Link to comment Share on other sites More sharing options...
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