RSX Posted 6 hours ago Share Posted 6 hours ago Hi, started using AutoIt yesterday to change font settings of existing session with PuTTY and was able to figure out some basics: #include <GuiMenu.au3> #include <WinAPIProc.au3> HotKeySet("#!p", CustomizePutty) ;Win+Alt+p While 1 Sleep(10) WEnd Func CustomizePutty() $hWnd = WinGetHandle("[ACTIVE]", "") $iPID = WinGetProcess($hWnd) $exe = _WinAPI_GetProcessName($iPID) If $exe = "putty.exe" Then WinSetState($hWnd, "", @SW_MAXIMIZE) $hMenu = _GUICtrlMenu_GetSystemMenu($hWnd) msgbox(0, "t", $hMenu) EndIf EndFunc I've read almost hundred of examples or posts but I'm unable to find out how to proceed. I've no glue how to code the next steps: open systemmenu select Change settings... select Window/Appearance etc. Could anybody please light some shed e.g. pointing to suitable commands or even known examples? TIA Roland Link to comment Share on other sites More sharing options...
ioa747 Posted 6 hours ago Share Posted 6 hours ago test if this works so we can move on HotKeySet("#!p", "CustomizePutty") ;Win+Alt+p While 1 Sleep(50) WEnd Func CustomizePutty() If WinExists("PuTTY") Then Local $hPuttyWnd = WinGetHandle("PuTTY") WinActivate($hPuttyWnd) Else ConsoleWrite("PuTTY is not running" & @CRLF) EndIf EndFunc I know that I know nothing Link to comment Share on other sites More sharing options...
RSX Posted 5 hours ago Author Share Posted 5 hours ago Thanks for your attention. Unfortunately, it always writes "PuTTY is not running" not matter if PuTTY is started or not and active or hidden. Link to comment Share on other sites More sharing options...
ioa747 Posted 5 hours ago Share Posted 5 hours ago what information does Au3Info.exe give you about the PuTTY window I know that I know nothing Link to comment Share on other sites More sharing options...
RSX Posted 4 hours ago Author Share Posted 4 hours ago Hmm, I was signed out so my answer vanished. I'd assume you want to know the Title and this changes every time and session. Class instead is always PuTTY. But this approach sounds to me not best option as WinActivate uses always the last found instance if I have multiple sessions open at the same time. Hence, I'd prefer to act on the currently active window and only if it's PuTTY. Link to comment Share on other sites More sharing options...
ioa747 Posted 4 hours ago Share Posted 4 hours ago (edited) you mean the PuTTY Configuration window Edited 4 hours ago by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
RSX Posted 4 hours ago Author Share Posted 4 hours ago yes Link to comment Share on other sites More sharing options...
ioa747 Posted 4 hours ago Share Posted 4 hours ago (edited) is there any shortcut so that the configuration window comes in front? or this will only happen when the configuration window is active? Edited 4 hours ago by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
RSX Posted 4 hours ago Author Share Posted 4 hours ago PuTTY can be configured to open the systemmenu with Alt+Space, but is is disabled and I cannot enable (since it always gets overwritten by main application). The same happens to font settings and that's why I try to solve this with AutoIt. Link to comment Share on other sites More sharing options...
ioa747 Posted 4 hours ago Share Posted 4 hours ago Alt+Space it's something different, and it works on almost all windows. The issue is when you press the shortcut alt windows p for the window to come forward it must be there, and from what it seems, if you are running others season, this is not available, it is not even hidden I know that I know nothing Link to comment Share on other sites More sharing options...
RSX Posted 4 hours ago Author Share Posted 4 hours ago There is no existing window. Usually I use the mouse to click on the systemmenu (which normally also works with Alt+Space), then I chose "Change settings..." from that menu and this opens a new window where all the settings can be changed. Link to comment Share on other sites More sharing options...
ioa747 Posted 3 hours ago Share Posted 3 hours ago in configuration window go to window|Behaviour and check System menu appears on ALT alone I know that I know nothing Link to comment Share on other sites More sharing options...
RSX Posted 3 hours ago Author Share Posted 3 hours ago I know, but this will be overwritten. Link to comment Share on other sites More sharing options...
ioa747 Posted 3 hours ago Share Posted 3 hours ago (edited) is it installation or is it portable HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\Sessions\ Edited 3 hours ago by ioa747 I know that I know nothing Link to comment Share on other sites More sharing options...
ioa747 Posted 1 hour ago Share Posted 1 hour ago since we didn't get an edge to begin with, I proceeded to the solution with the mouse for example how you can interact with the controls expandcollapse popup; https://www.autoitscript.com/forum/topic/212486-how-to-change-setting-for-putty/?do=findComment&comment=1538741 #include <GuiTreeView.au3> HotKeySet("#!p", "CustomizePutty") ;Win+Alt+p While 1 Sleep(50) WEnd Func CustomizePutty() If WinActive("[CLASS:PuTTY]") Then Local $hWnd = WinGetHandle("[ACTIVE]") Local $aWPos = WinGetPos($hWnd) ; position and size of PuTTY window. Local $aMPos = MouseGetPos() ; backup mouse position ; Perform a mouse click operation MouseClick("right", $aWPos[0] + 50, $aWPos[1] + 10, 1, 1) ; and send g to call chan&ge setting in contex menu ControlSend("[CLASS:#32768]", "", "", "g") MouseMove($aMPos[0], $aMPos[1] ,1) ; restore mouse position ; Get handle of Reconfiguration window Local $hPWnd = WinWaitActive("PuTTY Reconfiguration", "", 5) ConsoleWrite("$hPWnd=" & $hPWnd & @CRLF) ; Get handle of SysTreeView32 menu Local $hTVctrl = ControlGetHandle($hPWnd, "", "SysTreeView321") ConsoleWrite("$hTVctrl=" & $hTVctrl & @CRLF) ; Sets focus to SysTreeView32 menu ControlFocus($hPWnd, "", $hTVctrl) ; Returns the the current selection $cur = ControlTreeView($hPWnd, "", $hTVctrl, "GetSelected") ConsoleWrite("current selection=" & $cur & @CRLF) ;select the "Window|Behaviour" item ControlTreeView($hPWnd, "", $hTVctrl, "Select", "Window|Behaviour") $cur = ControlTreeView($hPWnd, "", $hTVctrl, "GetSelected") ConsoleWrite("current selection=" & $cur & @CRLF) ; for this control you will need it ; https://www.autoitscript.com/forum/files/file/478-control-viewer-mod/ If $cur = "Window|Behaviour" Then ControlSetText($hPWnd, "", "Edit1", "My new connecton") ControlSend($hPWnd, "", "Button8", "{SPACE}") Sleep(5000) ; give some time to see what ... ; click &Apply ControlClick ($hPWnd, "", "Button1") EndIf Else ConsoleWrite("is not PuTTY" & @CRLF) EndIf EndFunc ;==>CustomizePutty informative: although I don't know how you use it I was more comfortable with WinSCP 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