Jump to content

Recommended Posts

Posted

Have you tried with WinMove() and @DesktopHeight, @DesktopWidth?

When you tried you can post your code and we will help you if you still got any problem.

Posted

just a example not working code

Run("Notepad.exe")
WinMove("Title", "", 0, 0, 100, 500)
Sleep(100)
Run("Notepad.exe")
WinMove("Title", "", 100, 100, 100, 500)
Sleep(100)
Run("Notepad.exe")
WinMove("Title", "", 200, 200, 100, 500)
Sleep(100)
Run("Notepad.exe")
WinMove("Title", "", 300, 300, 100, 500)

you can also use winwait() for wating for window to be activated and then move, resize it.

Website: www.cerescode.comForum: www.forum.cerescode.comIRC: irc.freenode.net , Channel: #Ceres--------------------Autoit Wrappers, Great additions to your script (Must See) (By: Valuater)Read It Befor Asking Question Click Here...--------------------Join Monoceres's Forums http://www.monoceres.se--------------------There are three kinds of people: Those who make things happen, those who watch things happen, and those who ask, ‘What happened?’” –Casey Stengel
Posted

As some people maybe have read. I started today... So the only thing I have is this. I searched the help file for @DesktopHeight, @DesktopWidth but didn't know what it meant... Can someone please help me?

;Window 4
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")

;Window 3
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")

;Window 2
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")

;Window 1
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Posted (edited)

just a example not working code

Run("Notepad.exe")
WinMove("Title", "", 0, 0, 100, 500)
Sleep(100)
Run("Notepad.exe")
WinMove("Title", "", 100, 100, 100, 500)
Sleep(100)
Run("Notepad.exe")
WinMove("Title", "", 200, 200, 100, 500)
Sleep(100)
Run("Notepad.exe")
WinMove("Title", "", 300, 300, 100, 500)

you can also use winwait() for wating for window to be activated and then move, resize it.

I Like thisone. But I'm sure I need to change the title into the name of the file, do I need something else?

EDIT: Ok, I already changed it in this:

Run("Notepad.exe")
WinMove("Untitled - Notepad", "", 0, 0, 100, 500)
Sleep(100)
Run("Notepad.exe")
WinMove("Untitled - Notepad", "", 100, 100, 100, 500)
Sleep(100)
Run("Notepad.exe")
WinMove("Untitled - Notepad", "", 200, 200, 100, 500)
Sleep(100)
Run("Notepad.exe")
WinMove("Untitled - Notepad", "", 300, 300, 100, 500)

What do I need to do more?

Edited by Rawox
Posted

How does this go for you?

Const $WINDOWS = 4
Dim $HWNDS[$WINDOWS]
$x = @DesktopWidth/$WINDOWS
For $i=0 To $WINDOWS-1
    $PID = Run("notepad")
    $HWNDS[$i] =  _GETHwndFromPID ($PID)

    WinMove("Untitled - Notepad","",$i*$x,0,$x)
    ControlSetText ($HWNDS[$i], "", "[CLASS:Edit; INSTANCE:1]", "Window "&$i+1)
Next

Sleep (2000)

For $i=0 To $WINDOWS-1
    ControlSetText ($HWNDS[$i], "", "[CLASS:Edit; INSTANCE:1]", "Window "&$i+1 & @CRLF & "New Text")
Next

Sleep (2000)
WinKill ($HWNDS[0])
$HWNDS[0] = 0
Sleep (1000)
WinKill ($HWNDS[1])
$HWNDS[1] = 0
Sleep (1000)
WinKill ($HWNDS[2])
$HWNDS[2] = 0
Sleep (1000)

WinSetState($HWNDS[3], "", @SW_MAXIMIZE)

Func _GetHwndFromPID ($PID)
    $hWnd = 0
    $stPID = DllStructCreate("int")
    Do
        $winlist2 = WinList()
        For $i = 1 To $winlist2[0][0]
            If $winlist2[$i][0] <> "" Then
                DllCall("user32.dll", "int", "GetWindowThreadProcessId", "hwnd", $winlist2[$i][1], "ptr", DllStructGetPtr($stPID))
                If DllStructGetData($stPID, 1) = $PID Then
                    $hWnd = $winlist2[$i][1]
                    ExitLoop
                EndIf
            EndIf
        Next
        Sleep(100)
    Until $hWnd <> 0
    Return $hWnd
EndFunc

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
  • Recently Browsing   0 members

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