Jump to content

Search the Community

Showing results for tags 'winsetstate'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 7 results

  1. Hi all, I'm having some trouble restoring a program which uses a normal AutoIT-GUI and is used as a ToolKit for our customers to open different (external) tools, check their network connections or ping different destinations. Almost all customers are running this script on Win7 x64. What do I want to do? When the program is already running and the user tries to start it for a second time, it should exit the second instance after activating/restoring the first instance. What did I do to integrate this? I used a little piece of script found on the forums to prevent opening a second instance and modified it as follows: $g_szVersion = "VSOL ToolKit" If WinExists($g_szVersion) Then Local $gState = WinGetState($g_szVersion) MsgBox(0,"","gState = " & $gState) ;For debugging purposes WinSetState($g_szVersion,"",@SW_SHOW) MsgBox(0,"","gState = " & $gState) ;For debugging purposes WinSetState($g_szVersion,"",@SW_RESTORE) MsgBox(0,"","gState = " & $gState) ;For debugging purposes WinActivate($g_szVersion) Exit EndIf AutoItWinSetTitle($g_szVersion) I have tried it with only the @SW_SHOW, only the @SW_RESTORE, both of them in a different order, same difference, it doesn't work. What does happen then? It detects the current state (when it's minimized) as '5', which means enabled and hidden. After setting the state to show, the state changes to 7. Restoring doesn't change the state. But what is really odd, is that the window doesn't appear but AutoIt seems to create a néw window with the same title as the existing one. It doesn't matter if the window was originally minimized by clicking the minimize button in the GUI or by a line of code in my script. For example, when users open a software package from within my script, a similar function to this one will be called: Func VSOL_FFTOOLS_SHOW_DOWNLOADS() GUISetState(@SW_MINIMIZE,$VSOL_BACKEND) ShellExecute(@UserProfileDir & "\Downloads") EndFunc The only thing that does work, is when the window is running in a non-minimized state (somewhere behind the current window), it gets activated and receives the focus when trying to start the second instance. If anyone could help me out with this one, I'd be forever thankful :-) Thanks in advance! Kind regards, Jan Geurts
  2. Hi I'm trying to: 1) Open a hidden browser session 2) Do some stuff in the background 3) Make the hidden window visible This is my code: Opt("WinTitleMatchMode", 2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase $oIE = _IECreate("https://www.google.co.uk/",0,0) $oSearchBox = _IEGetObjById($oIE, "lst-ib") $oSearchBox.innertext = "AutoIT" $oForm = _IEFormGetObjByName($oIE,"f") _IEFormSubmit($oForm) WinSetState("Google","",@SW_SHOW) It dosen't work The last line does make the window visible but it is an empty greyed out box that disappears as soon as I click on it. I have a sort of workaround that hides the browser window as soon as I have created it which works fine: $oIE = _IECreate("https://www.google.co.uk/") WinSetState("Google","",@SW_HIDE) . . . WinSetState("Google","",@SW_SHOW) But this looks a bit pants as the newly created window flashes on then off of the screen. Am I using the wrong method to make the browser window visible? Thanks
  3. hi brothers, I'm trying to take screenshot from webpage and if found code that could take screenshot even when window is minimized but sometimes i get image like Image Attached I'm trying for 4 hours ago to know where is the problem ... Notice: for some reason I'm need to run site minimized The Code: ;coded by UEZ 2012 #include <Array.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <IE.au3> Opt("WinTitleMatchMode", 2) Local $oIE = _IECreate("https://mybanner.qu.edu.qa/PROD/twbkwbis.P_WWWLogin") opt('winwaitdelay', 0) ;to make it run a little bit faster WinWait("User Login") $handle = WinMove("User Login - Internet Explorer","",0,0,877, 516) WinSetState("User Login","",@SW_SHOWMINIMIZED) _IELoadWait($oIE) Sleep(2000) WinSetState("User Login","",@SW_SHOWDEFAULT) $aWinlist = GetAllWindow() $handle = WinMove("Student Employment Time Attendance","",0,0,877, 516) $MyWindow=WinGetHandle("[Class:IEFrame]") ConsoleWrite($MyWindow) For $i = 0 To UBound($aWinlist) - 1 $hWnd = $aWinlist[$i][1] If Not WinActive($hWnd) Then ExitLoop Next If $i = UBound($aWinlist) Then Exit MsgBox(0, "Info", "No inactive window found", 10) _GDIPlus_Startup() $hBitmap = Capture_Window($MyWindow, 877, 516) _GDIPlus_ImageSaveToFile($hBitmap, @ScriptDir & "Test.jpg") _GDIPlus_BitmapDispose($hBitmap) ShellExecute(@ScriptDir & "Test.jpg") _GDIPlus_Shutdown() Exit Func Capture_Window($hWnd, $w, $h) Local $hDC_Capture = _WinAPI_GetWindowDC($hWnd) Local $hMemDC = _WinAPI_CreateCompatibleDC($hDC_Capture) Local $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC_Capture, $w, $h) Local $hObject = _WinAPI_SelectObject($hMemDC, $hHBitmap) DllCall("user32.dll", "int", "PrintWindow", "hwnd", $hWnd, "handle", $hMemDC, "int", 0) _WinAPI_DeleteDC($hMemDC) ; Local $hObject = _WinAPI_SelectObject($hMemDC, $hObject) _WinAPI_ReleaseDC($hWnd, $hDC_Capture) Local $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($hHBitmap) _WinAPI_DeleteObject($hHBitmap) Return $hBmp EndFunc ;==>Capture_Window Func GetAllWindow() ;code by Authenticity - modified by UEZ Local $aWin = WinList(), $aWindows[1][4] Local $iStyle, $iEx_Style, $iCounter = 0 Local $i, $hWnd_state, $aWinPos For $i = 1 To $aWin[0][0] $iEx_Style = BitAND(_WinAPI_GetWindowLong($aWin[$i][1], $GWL_EXSTYLE), $WS_EX_TOOLWINDOW) $iStyle = BitAND(WinGetState($aWin[$i][1]), 2) If $iEx_Style <> -1 And Not $iEx_Style And $iStyle Then $aWinPos = WinGetPos($aWin[$i][1]) If $aWinPos[2] > 1 And $aWinPos[3] > 1 Then $aWindows[$iCounter][0] = $aWin[$i][0] $aWindows[$iCounter][1] = $aWin[$i][1] $aWindows[$iCounter][2] = $aWinPos[2] $aWindows[$iCounter][3] = $aWinPos[3] $iCounter += 1 EndIf ReDim $aWindows[$iCounter + 1][4] EndIf Next ReDim $aWindows[$iCounter][4] Return $aWindows EndFunc ;==>GetAllWindow
  4. Good morning I would like to know if I can use the Excel UDF to manipulating a .csv file without having Office installed on the PC I'm going to work... I read somewhere that it could be done, but I'm here to ask and be sure of what I remember... I'd like to post another question... How can I retrieve the handle of a windows from a PID of an .exe? I have my script that does a ShellExecute ( which returns the PID of the .exe ), and then, switching a parameter read from a .ini file, adapt the Window on the screen ( Maximize, Minimize, On Top )... I tried, but without having success with this: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_x64=prova.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> #include <WinAPIEx.au3> #include <Array.au3> Local $sFileConfigurazione = @ScriptDir & "\configurazione_exe.ini" If(FileExists($sFileConfigurazione)) Then Local $aSezioniIni = IniReadSection($sFileConfigurazione, "CONFIGURAZIONE_EXE") If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'apertura del file: " & @CRLF & $sFileConfigurazione & @CRLF & "Errore: " & @error) Else ; Lancio dell'applicativo indicato nel file di configurazione Local $iPID = ShellExecute($aSezioniIni[1][1]) Local $hWnd If($iPID <> 0) Then Local $aWinList = WinList() For $i = 1 To $aWinList[0][0] If(WinGetProcess($aWinList[$i][1] = $iPID)) Then $hWnd = $aWinList[$i][1] EndIf Next Switch($aSezioniIni[2][1]) Case $aSezioniIni[2][1] = "MIN" WinSetState($hWnd, "", @SW_MINIMIZE) Case $aSezioniIni[2][1] = "MAX" WinSetState($hWnd, "", @SW_MAXIMIZE) Case $aSezioniIni[2][1] = "TOP" WinSetOnTop($hWnd, "", $WINDOWS_ONTOP) EndSwitch EndIf EndIf EndIf It just set on top the .exe I'm launching... Thanks
  5. #include <IE.au3> _IECreate("www.google.com") Sleep(5000) WinSetState("Google - Internet Explorer","",@SW_MAXIMIZE)The browser window opens and it goes to google.com but it will not maximize. I have also tried: #include <IE.au3> Local $Browser = _IECreate("www.google.com") Sleep(5000) WinSetState($Browser,"",@SW_MAXIMIZE)Also doesn't work. I'm running windows 8.1 x64 and internet explorer 11.0.9600.16384. Help!
  6. Hi guys, I have a program that when minimised to task-bar an using WinGetState returns 37. Maximised, enabled and exists? Using WinSetState ("[CLASS:TfrmDesktop]", "", @SW_MAXIMIZE) returns 39. Maximised, enabled and exists and visible? But will not maximise the window. However 39 is what it normally is when maximised and using the program Just using @SW_RESTORE = 7 but does not open window (obviously) and using @SW_RESTORE then @SW_MAXIMIZE = 39 but then cant minimize. and using @SW_RESTORE then @SW_MAXIMIZE then @SW_ENABLE = 39 but then cant minimize. Tried this and nothing WinMove("[CLASS:TfrmDesktop]",0,0,@Desktopwidth, @DesktopHeight) Really strange as not sure what else to try. Thanks guys
  7. I've written a little experimental program, using 2 shortcuts, to manage a relay. The shortcuts are: C:\USB-relæ\USBRelay\USBRelay.exe -c:8 -r:1#1 ( = 'ON') C:\USB-relæ\USBRelay\USBRelay.exe -c:8 -r:1#0 ( = 'OFF') The script (the compiled .exe) is doing what it is supposed to do, using the Run ("C:\USB-relæ\USBRelay\USBRelay.exe -c:8 -r:1#1")to turn the relay on - but I keep getting a window, which I cannot "get a grip on", almost all over my monitor, which I find absolutely annoying..! What can I do, in order to force this window to "disappear"..? Any help will be greatly appreciated!
×
×
  • Create New...