Leagnus Posted May 23, 2007 Share Posted May 23, 2007 (edited) In PowerPro I use the script to minimize EverestUltimate220 diagnostic program so it shows sensors' data of my PC in the tray EverestUltimate220 is much easy to use then MotherBoard Monitor I believe "D:\PfilesNS\infoTools\EverestUltimate220\everest.exe" wait.for (60000, visiblewindow("EVEREST Ultimate*")) if (visiblewindow("EVEREST Ultimate*")) Window Min! "c=TForm1" if (visiblewindow("EVEREST Ultimate*")) Window Hide! "c=TApplication" If i run it not by the script - trayminned or hidden - it occupies about 16 MB of RAM instead of about 1 or 2 MB Everything's fine but for PP'users... I've tried to write the script in Au3 lang, and unsuccessfully! WinSetState and @SW_MINIMIZE do not minimize windows as PowerPro does and my everest.exe proccess occupies about 16 MB of RAM dispite of all my afforts So WinSetState and @SW_MINIMIZE works not as 'minimize' button - is there a way to send a keystroke to 1-st of 3 or "minimize" button of all windows in right top of them? Edited May 23, 2007 by Leony Link to comment Share on other sites More sharing options...
Gif Posted May 23, 2007 Share Posted May 23, 2007 ALT+Space+n Link to comment Share on other sites More sharing options...
Zedna Posted May 23, 2007 Share Posted May 23, 2007 (edited) Try to use _SendMessage() with WM_SYSCOMMAND and SC_MINIMIZESee MSDN for detailsEDIT:#include <Misc.au3> Global Const $WM_SYSCOMMAND = 0x0112 Global Const $SC_MINIMIZE = 0xF020 $hWnd = WinGetHandle("Your window title") _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_MINIMIZE, 0) Edited May 23, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Leagnus Posted May 23, 2007 Author Share Posted May 23, 2007 Thanks! Both methods works fine! #include <Misc.au3> Run("everest.exe") Global Const $WM_SYSCOMMAND = 0x0112 Global Const $SC_MINIMIZE = 0xF020 Opt("WinTitleMatchMode", 4) WinWaitActive("classname=TForm1") ;$hWnd = WinGetHandle("classname=TApplication") $hWnd = WinGetHandle("classname=TForm1") _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_MINIMIZE, 0) WinSetState("classname=TApplication","", @SW_HIDE) Link to comment Share on other sites More sharing options...
Leagnus Posted May 24, 2007 Author Share Posted May 24, 2007 (edited) Sorry for being novicebut now "classname=TApplication" window stays in taskbar and WinSetState("classname=TApplication","", @SW_HIDE) doesn't hide it It was always mystery for my how to calculate WM_messagesThe MSDN says I should combine $WM_SYSCOMMAND and $SC_MINIMIZE but where You wise man Zedna took the 0x0112 and 0xF020 numbers?Sorry for being novice... Edited May 24, 2007 by Leony Link to comment Share on other sites More sharing options...
Zedna Posted May 24, 2007 Share Posted May 24, 2007 Sorry for being novicebut now "classname=TApplication" window stays in taskbar and WinSetState("classname=TApplication","", @SW_HIDE) doesn't hide it It was always mystery for my how to calculate WM_messagesThe MSDN says I should combine $WM_SYSCOMMAND and $SC_MINIMIZE but where You wise man Zedna took the 0x0112 and 0xF020 numbers?Sorry for being novice...Google for "define SC_MINIMIZE" is quick.There are also helper apps with these constants. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Leagnus Posted May 24, 2007 Author Share Posted May 24, 2007 I've found WINDOWS.H file has the numbers. it seems MSDN notifications don't have parameters to hide a window... Link to comment Share on other sites More sharing options...
Leagnus Posted May 25, 2007 Author Share Posted May 25, 2007 CODE; it runs and hides EVEREST Ultimate window to tray so that EVEREST uses ; 7 MBytes of RAM max (2-4 usually) ; should be run from root of everest.exe directory ; sheckandar' modified script ; thanks to Zedna for exact _SendMessage code to minimize window because ; native AutoIt @SW_MINIMIZE acts not as "minimize" button for Everest and ; Everest occupies about 16 MB therefore ; to hide Everest again use its new "minimize to tray" button #include <GUIConstants.au3> Opt("WinTitleMatchMode", 4) Opt("TrayMenuMode", 1) ; if EVEREST is already running - shows it: If WinExists("EVEREST Ultimate ") Then WinSetState("EVEREST Ultimate ", "", @SW_Show) Global $itemnum, $enum, $msg, $num, $proc, $gett, $gettif, $itemnum2, $recountt, $recount2, $bit, $state, $title, $exitc, $proclist, $upcount, $procupcount, $itemnum Dim $trayitem1[100] Dim $procitem[100] Dim $trayrec[100] Dim $proclist[100][2] $execpath = @AutoItExe $string1 = StringInStr($execpath, "\", 0, -1) $string2 = StringTrimLeft($execpath, $string1) $proclist = ProcessList($string2) Do $upcount = $upcount + 1 If $proclist[$upcount][0] = $string2 Then $procupcount = $procupcount + 1 EndIf Until $upcount = $proclist[0][0] If $procupcount > 1 Then Exit $trayitem2 = TrayCreateItem("Exit") TrayCreateItem("") TraySetState() #include <Misc.au3> Opt("WinTitleMatchMode", 4) Run("everest.exe") Global Const $WM_SYSCOMMAND = 0x0112 Global Const $SC_MINIMIZE = 0xF020 WinWaitActive("classname=TForm1") $hWnd = WinGetHandle("classname=TForm1") _SendMessage($hWnd, $WM_SYSCOMMAND, $SC_MINIMIZE, 0) WinActivate ("EVEREST Ultimate Edition") hide() Func hide() ; <-- To hide active window $title = "" $proc = WinGetHandle("classname=TApplication", "") If $itemnum > 0 Then Do $state = WinGetState("classname=TApplication", "") If Not BitAND($state, 2) Then Return EndIf $num = $num + 1 If $procitem[$num] = $proc Then $gettif = TrayItemGetText($trayitem1[$num]) TrayItemDelete($trayitem1[$num]) $procitem[$num] = 0 EndIf Until $num = $itemnum EndIf $num = 0 $title = WinGetTitle("classname=TApplication", "") If @error Or $title = 1 Or $title = "" Then Return EndIf $itemnum = $itemnum + 1 WinSetState($proc, "", @SW_HIDE) $trayitem1[$itemnum] = TrayCreateItem($title) $procitem[$itemnum] = $proc $bit = $bit + 1 EndFunc ; <-- Complete Link to comment Share on other sites More sharing options...
Zedna Posted May 25, 2007 Share Posted May 25, 2007 (edited) It was always mystery for my how to calculate WM_messagesThe MSDN says I should combine $WM_SYSCOMMAND and $SC_MINIMIZE but where You wise man Zedna took the 0x0112 and 0xF020 numbers?Sorry for being novice...Look at API Constants from gafrost Edited May 26, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 23, 2012 Moderators Share Posted February 23, 2012 chause4,You already have a thread running on this problem - just stick to one at a time please. It is likely that the code does not work because this thread is nearly 5 years old and the language has moved on considerably - so please do not necro any more old threads. Those files you mention are include files - you add those lines at the top of your script so you can use the functions within the files they reference. And at least one of them is deprecated - which is why using old code is not a very good idea Finally, when you post code, please use code tags - put [autoit] before and [/autoit] after your posted code. Thanks in advance. 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