Sign in to follow this  
Followers 0
computergroove

Lining up windows programs from a script

7 posts in this topic

I want to open 3 vnc windows and set them all next to each other vertically. Is there a way to do this without using the mousedrag function? There is no command line parameter for either realvnc or ultravnc that will do this. 


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites



Use this to grab the windows to an array

winlist

Loop through the array, and calculate out positions, and move with

winmove

use this for your calcs

@DesktopHeight
@DesktopWidth

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

I tried winlist to try to get the following and I got 15 entries in my array when I should have only gotten 4 so I used ProcessList to get the array that looks like:

[0] 3

[1] vncviewer.exe 896

[2] vncviewer.exe 1246

[3] vncviewer.exe 1946

[4][2]

I have been rereading what I know about multidimensional arrays for hours and I cant get it.

1. How do I set a variable to = the second part of the array in [1-3]?

2. How do I use a PID with WinMove?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

Use this to play around.  Notice I started at $i = 1, because the first entry in that array is the ubounds of the array:

Local $array[4][2]=[[3,""],[1,"a"],[2,"b"],[3,"c"]]
For $i = 1 To UBound($array)-1
    ConsoleWrite("$array[" & $i & "][0]= " & $array[$i][0] & @CRLF)
    ConsoleWrite("$array[" & $i & "][1]= " & $array[$i][1] & @CRLF)
Next

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Instead of :

For $i = 1 To UBound($array)-1

cant I just say 

For $i = 1 To $array[0]

I am missing something. I know that I cannot use msgbox to display an array. I use arraydisplay. Can I pull a piece of data out and use msgbox to display it? I have tried:

Local $aWinList = ProcessList("vncviewer.exe")
Local $i = ($aWinlist[1][2])
msgbox(0,"",$i)
Sleep(5000)

It runs but it doesn't do anything visible. Cant I just put the contents of the array into memory and assign each element to a variable? DO I or should I write the array to a file then pull the contents of the file out as I need them?

Edited by computergroove

Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

cant I just say 

For $i = 1 To $array[0]

 In this case, you can do the above...but not all arrays will include the ubound in the first subscript, so I always loop as though it's not set.

Maybe this will make more sense:

Local $array[4][2]=[[3,""],[1,"a"],[2,"b"],[3,"c"]]
For $i = 1 To UBound($array)-1
    $var1 = $array[$i][0]
    $var2 = $array[$i][1]
    ConsoleWrite("$array[" & $i & "][0]= " & $var1 & @CRLF)
    ConsoleWrite("$array[" & $i & "][1]= " & $var2 & @CRLF)

    MsgBox(1,1,"$array[" & $i & "][0]= " & $var1 & " " & "$array[" & $i & "][1]= " & $var2)

    ; you add your code to do stuff here...
Next

And no, you don't want to output to a file, because then you have the additional step of writing and reading a file...read directly out of the array, during the loop.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

I got the array into variables that I can call individually. Is the second column (the number) the Process ID? How do I use the PID number to choose a window in autoit and move it with winmove?


Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html

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
Sign in to follow this  
Followers 0