Cybship

Moving a window that does not show a title

12 posts in this topic

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?

 

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

That didn't work, did I do it right?

WinMove("Afx:00D90000:b:00010005:00000006:00070424", "", -585, 392, 960, 750)

Edited by Cybship
Correction

Share this post


Link to post
Share on other sites

Never mind, I didn't use class properly, got it to work now.  Thank you for the help!!

WinMove("[Class:Afx:00D90000:b:00010005:00000006:00070424]", "", -585, 392, 960, 750)

Share this post


Link to post
Share on other sites

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I didn't think of the class value changing when the software is closed, which means I have to look up and enter the new value in the script each time the software opens.  Is there a workaround for that?

Share this post


Link to post
Share on other sites

@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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

There is a consistent top menu bar that has four items (system, screen, view, help) with drop down menus items, and a number of clickable icons below that in a second bar, screenshot attached.

XXCameraScreenShote.png

Share this post


Link to post
Share on other sites

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


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

This is what it shows for visible text:

osd
ir
关闭
开关打开
shangxia反转
左右反转
左右巡航
上下巡航
RIGHTDOWN
DOWN
LEFEDOWN
RIGHT
STOP
LEFT
RIGHTUP
UP
LEFTUP
菜单栏
Toolbar

Share this post


Link to post
Share on other sites

Is there a way to use the visible text with WinMove?

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

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

Share this post


Link to post
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