Jump to content

Recommended Posts

Posted

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?

 

Posted

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 2024-07-28 - Version 1.6.3.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 (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

 

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
Posted

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)

Posted

:)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

Posted

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?

  • Moderators
Posted

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

Posted

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

Posted

This is what it shows for visible text:

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

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

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
×
×
  • Create New...