HexCore Posted November 23, 2011 Share Posted November 23, 2011 You all have been such a great help so far, hopefully you can help me out with this. I have 2 windows that get resized when I turn off the monitors ( HDMI, so it rescales the windows when I turn off the monitor, it's a windows thing I haven't been able to get around ) I have work-arounds for all my windows except for 1 of my setups... I have 2 java applets which I use each one 1/2 screen.. those are the windows I can get to auto-rescale, I was hoping to be able to grab the window size / position and set it? I have a scrip that set's focused windows in a constant loop, While 1=1 sleep(24000) WinActivate("System Center Operations Manager","Lync") sleep(24000) WinActivate("System Center Operations Manager","Hyper") sleep(24000) WinActivate("System Center Operations Manager","Exchange") sleep(24000) WinActivate("Cisco Unified Computing System Manager Vxxx") WinActivate("Cisco Unified Computing System Manager Vxxx") sleep(24000) WinActivate("Tampa, Florida") send ("{F5}") sleep(24000) WinActivate("Forefront Dashboard") sleep(24000) WinActivate("Denver, Colorado") send ("{F5}") sleep(24000) WinActivate("Security Summary") sleep(24000) WinActivate("PasswordDashboard") sleep(24000) WinActivate("AgingIncidentsDashboard") sleep(24000) WinActivate("AvayaCallsDashboard") sleep(24000) WinActivate("IncidentSatisfactionDashboard") sleep(24000) WinActivate("IncidentsChartDashboard") WEnd These are the two windows that I need to have size / position checked WinActivate("Cisco Unified Computing System Manager Vxxx") WinActivate("Cisco Unified Computing System Manager Vxxx") when I turn off my monitors it re-scales the windows, upon turning on the monitors I have lost my windows size / position... what would be your best recommendation on having these set correctly at all times. Thanks in advance for all you comments. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 23, 2011 Moderators Share Posted November 23, 2011 (edited) HexCore,If you use WinGetPos on those it will return their size and position. You could just run a quick check every so often (perhaps via Adlib) and reset any value which had changed using WinMove. M23Edit: Wrong button too soon! Edited November 23, 2011 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Tonnie Posted November 23, 2011 Share Posted November 23, 2011 The function WinMove can change both the position and the size of a window.Function reference: http://www.autoitscript.com/autoit3/docs/functions/WinMove.htm Link to comment Share on other sites More sharing options...
HexCore Posted November 23, 2011 Author Share Posted November 23, 2011 I'm sorry but this is where my lack of skill shows it's true colors, I don't follow how to use those commands with the constant loop, I"m afraid I"m going to create some frankenstien code that will make you face palm... I am still very new to using AutoIT so the lightbulb hasn't gone off on most of it yet... lol. I'm assuming I would have to call it? maybe pointing to a tutorial that would assist me in figuring this out? I really don't want the answer handed to me, I would like to figure it out on my own.. but having the loop is throwing me off... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 23, 2011 Moderators Share Posted November 23, 2011 HexCore, There are lots of ways to do this, but this is the simplest to understand. Run this in SciTE and try moving or resizing the SciTE GUI: expandcollapse popup; Use ESC to quit HotKeySet("{ESC}", "On_Exit") ; Get the initial size and position $aInitPos = WinGetPos("[CLASS:SciTEWindow]") ; Run the check every 5 secs AdlibRegister("_Check_Pos", 5000) ; And keep the script alive While 1 Sleep(10) WEnd ; This is what is run every 5 secs Func _Check_Pos() ; Clear a flag $fChanged = False ; Get the current position $aCurrPos = WinGetPos("[CLASS:SciTEWindow]") For $i = 0 To 3 ; if the value is not what it was initially If $aCurrPos[$i] <> $aInitPos[$i] Then ; set the flag $fChanged = True EndIf Next ; if the flag is set If $fChanged Then ; Reset ehe windoe to the initial pos and size WinMove("[CLASS:SciTEWindow]", "", $aInitPos[0], $aInitPos[1], $aInitPos[2], $aInitPos[3]) ConsoleWrite(@SEC & " - Reset window" & @CRLF) Else ConsoleWrite(@SEC & " - Window had not changed" & @CRLF) EndIf EndFunc Func On_Exit() Exit EndFunc All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
guinness Posted November 23, 2011 Share Posted November 23, 2011 (edited) Melba23 beat me to the punch...I had this: AdlibRegister("_WinCheck", 5000) ; Check the window every 5 seconds. While 1 ; Create a loop to stop the script from closing. Sleep(100) WEnd Exit Func _WinCheck() Local $aArray $aArray = WinGetPos("<title>") ; Change this to the correct window title. If $aArray[2] > 100 Or $aArray[3] > 100 Then ; Check the width & height is not greater than ... WinMove("<Title>", $aArray[0], $aArray[1], 50, 50) ; If it is then move the window to the same location but change the size to the default size. EndIf EndFunc ;==>_WinCheck Edited November 23, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
HexCore Posted November 23, 2011 Author Share Posted November 23, 2011 Awesome, thanks for the responses I will start to toy with the new code. Link to comment Share on other sites More sharing options...
HexCore Posted November 23, 2011 Author Share Posted November 23, 2011 (edited) @ Melba23ok I see how this is working, amazing!! what I don't understand is how to get the 2 pieces of code togetherI currently have thewhile 1=1;code = all my winactivates that I want a constant loop with sleeps on them so each display screen is on monitor for a set amount of time.wendnow other have suggest I use the "do" where I'm using my while loop for my winactivates...this is where most of my confusion comes into play. Edited November 23, 2011 by HexCore Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 23, 2011 Moderators Share Posted November 23, 2011 HexCore,Why not put all the WinActivate lines into the Adlib function and let it do everything? That way you get all your GUIs activated and/or replaced every time you run the function. At the moment you are reactivating each GUI every 7 mins or so - set the Adllib timer for 5min (300000 secs) and Robert is your mother's brother. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
HexCore Posted November 23, 2011 Author Share Posted November 23, 2011 playing with the code now, things are starting to come together now. Link to comment Share on other sites More sharing options...
HexCore Posted November 23, 2011 Author Share Posted November 23, 2011 (edited) ok, so I have it working correctly, figured out a few things.. one thing that I'm jammed up on is this $aInitPos= WinGetPos("[Title:Cisco Unified Computing System Manager - VRxxx1]") I have 2 windows, I was unable to find the class even with the Au3record (showed it as program manager) the are both labled: Cisco Unified Computing System Manager - VRxxxx1 Cisco Unified Computing System Manager - VRxxxx2 is there a way to wild card them together? I changed it from class to title not sure if that was correct as I couldn't determine the actual class for what I was trying to pull. Edited November 23, 2011 by HexCore Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 23, 2011 Moderators Share Posted November 23, 2011 HexCore,"Title" is the default ID parameter, so there is no need for the complicated syntax - just the name will do (Help file <Using AutoIt - Window Titles and Text (Advanced)) refers). You could use REGEXPTITLE to get both GUIs - does the "xxx" signify a random 3-digit/character code? Cisco GUIs have proven a difficult problem in the past - are you sure you get no useable info from the Window Info Tool? If we could just get the handle.....what does a WinList array tell you? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
HexCore Posted November 23, 2011 Author Share Posted November 23, 2011 (edited) The Cisco Unified Computing System Manager - VRxxxx1 the VRxxxxx1 / VRxxxxx2 are server names, these are Cisco UCS manager interfaces. (java) I use the xxxxx as my company woudln't appreciate me blasting server names out on the web but those are the only portion of the window title that are unique. Edited November 23, 2011 by HexCore Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 23, 2011 Moderators Share Posted November 23, 2011 HexCore,Are they always the same? There is little point in using an SRE if the names are invariable - just use the real names. Did you try WinList to see if they appear in the array? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
HexCore Posted November 23, 2011 Author Share Posted November 23, 2011 not sure if I'm doing this correctly, looked at the WinList help and used this code: $var = WinList() For $i = 1 to $var[0][0] ; Only display visble windows that have a title If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1]) EndIf Next Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Which gave me handle / title, but that was already information I knew other than handle. Link to comment Share on other sites More sharing options...
HexCore Posted November 23, 2011 Author Share Posted November 23, 2011 ok... sorry I was using the Au3 record, not the window info tool. Title: Cisco Unifified Computing System Manager - Vxxxxxx01 Class: SunAwtFrame both windows have the same Classname, and I'm trying to display them both 1/2 screen each. Link to comment Share on other sites More sharing options...
HexCore Posted November 23, 2011 Author Share Posted November 23, 2011 (edited) ok so I used the class name for the WinGetPos which works fine with one of the windows, can I get it to work with both? or do I need to invoke 2 seperate functions, 1 for each windows size / pos? I am not seeing anything unique in the window tool or anything else other than the title. Edited November 23, 2011 by HexCore Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 23, 2011 Moderators Share Posted November 23, 2011 HexCore,You should be able to address both GUIs using:WinActivate("[Title:Cisco Unifified Computing System Manager - Vxxxxxx01 ; Class:SunAwtFrame]") WinActivate("[Title:Cisco Unifified Computing System Manager - Vyyyyyy01 ; Class:SunAwtFrame]")where you substitute the real names for the xxx/yyy sections. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
HexCore Posted November 23, 2011 Author Share Posted November 23, 2011 Yes the above work perfect for the WinActivate yes the real names go where you see xxx/yyyy just using xxx/yyyy as not to give out my servernames what I'm having trouble with is wrapping that into to the WinGetPos , I run 2 of those screens each at 1/2 size, they rescale when I turn off my monitors (hdmi) so when I turn on the monitors the windows don't auto resize which is what I'm tying to get this script to do for me. so I'm trying to get this portion of the code to include each window: ; Use ESC to quit HotKeySet("{ESC}", "On_Exit") ; Get the initial size and position $aInitPos = WinGetPos("[CLASS:SunAwtFram]") but I'm not sure how to capture it for each window? I have it working correctly for 1, but not both.... that's where my handup is. the Classes are the same, but the window titles are unique. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 23, 2011 Moderators Share Posted November 23, 2011 HexCore, It is not that difficult - just use a different array for each window: expandcollapse popup$aInitPos_xxx = WinGetPos("[Title:Cisco Unifified Computing System Manager - Vxxxxxx01 ; Class:SunAwtFrame]") $aInitPos_yyy = WinGetPos("[Title:Cisco Unifified Computing System Manager - Vyyyyyy01 ; Class:SunAwtFrame]") ; and then you do this in the function ; Clear 2 flags $fChanged_xxx = False $fChanged_yyy = False ; Get the current position of each window $aCurrPos_xxx = WinGetPos("[Title:Cisco Unifified Computing System Manager - Vxxxxxx01 ; Class:SunAwtFrame]") $aCurrPos_yyy = WinGetPos("[Title:Cisco Unifified Computing System Manager - Vyyyyyy01 ; Class:SunAwtFrame]") ; And now check each window For $i = 0 To 3 ; if the value of xxx is not what it was initially If $aCurrPos_xxx[$i] <> $aInitPos_xxx[$i] Then ; set the flag $fChanged_xxx = True EndIf ; if the value of yyy is not what it was initially If $aCurrPos_yyy[$i] <> $aInitPos_yyy[$i] Then ; set the flag $fChanged_yyy = True EndIf Next ; iI a flag is set If $fChanged_xxx Then ; Reset the xxx window to the initial pos and size WinMove("[Title:Cisco Unifified Computing System Manager - Vxxxxxx01 ; Class:SunAwtFrame]"), "", $aInitPos_xxx[0], $aInitPos_xxx[1], $aInitPos_xxx[2], $aInitPos_xxx[3]) ConsoleWrite(@SEC & " - Reset xxx window" & @CRLF) Else ConsoleWrite(@SEC & " - yyy window had not changed" & @CRLF) EndIf If $fChanged_xxx Then ; Reset the yyy window to the initial pos and size WinMove("[Title:Cisco Unifified Computing System Manager - Vyyyyyy01 ; Class:SunAwtFrame]"), "", $aInitPos_yyy[0], $aInitPos_yyy[1], $aInitPos_yyy[2], $aInitPos_yyy[3]) ConsoleWrite(@SEC & " - Reset yyy window" & @CRLF) Else ConsoleWrite(@SEC & " - yyy window had not changed" & @CRLF) EndIf Just try and think logically instead of trying to get clever and use the same code for both windows at the same time. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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