Jump to content

Moving a window that does not show a title


Cybship
 Share

Recommended Posts

Hi, I am using an IP Camera software called "XXCAMERA" and it does not have a title.  I would like to use the 'WinMove' command to position the window in a certain spot on the screen, but apparently the lack of a title is preventing the script to execute the command.  It appears to want to run, but the window does not move.  Have tried the following two scripts:

WinMove("XXCAMERA", "", -585, 392, 960, 750)   >>  Here I am using the name of the program that shows in the task manager, I see the icons in the taskbar flashing so the script apparently tried to run, but the window did not move

WinMove("", "", -585, 392, 960, 750)   >>  Here I am leaving the title blank, this one winds up moving the windows explorer window instead

Any ideas how I can move a window that does not show a name in the title bar, or in the AutoIt Info window when I move the Finder Tool over the window?

 

Link to comment
Share on other sites

Use the AutoIt Window Info Tool to get the class and then pass this class to WinMove.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

@Cybship is there anything that stays the same on the window (visible text?). There are a couple of options, but you have to have at least some consistent feature to search for.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

Use the AutoIt Window Info tool as suggested before. Post what it shows you under the Visible Text tab....

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

If you can can launch the software you could get the handle to the window through its PID (Or you could get the PID manually and input it)

https://www.autoitscript.com/wiki/FAQ#How_can_I_get_a_window_handle_when_all_I_have_is_a_PID.3F

This should work, just make sure you don't activate some other window while you're waiting for the software to initialize. You could replace the while loop with just a long enough pause until your camera software starts and then move it.

$hActiveWindow = WinGetHandle("[Active]")

;Run process
$iPID = Run("D:\Program Files (x86)\Putty\putty.exe")

; Sleep until the software initializes
While (WinGetHandle("[Active]") = $hActiveWindow)
    Sleep(100)
WEnd

;Get HWND.
$hWnd = _GetHwndFromPID($iPID)

;Move software
WinMove($hWnd, "", -585, 392, 960, 750)


;Function for getting HWND from PID
Func _GetHwndFromPID($PID)
    $hWnd = 0
    $winlist = WinList()
    Do
        For $i = 1 To $winlist[0][0]
            If $winlist[$i][0] <> "" Then
                $iPID2 = WinGetProcess($winlist[$i][1])
                If $iPID2 = $PID Then
                    $hWnd = $winlist[$i][1]
                    ExitLoop
                EndIf
            EndIf
        Next
    Until $hWnd <> 0
    Return $hWnd
EndFunc;==>_GetHwndFromPID

 

Edited by InunoTaishou
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...