Jump to content
Sign in to follow this  
scorch

problem with resolution adjusting

Recommended Posts

scorch

i am having a hard time wrapping my head around this code im building.

what the script is doing is reading and input box and going to an ini file to read the value (computer name)

then it will call the mstsc.exe (remote desktop Connection) and enter in the value retrived from the ini file.

once the log in window comes up (this is the issue) i want to send the username and password and press enter.

the issue is that this is being done accros several different computers all with different screen resolutions. so i cant get the mouseclick to work on all of them im guessing because of the differences in resolutions? i hit the search button on here a million time and in one thread with an issue somewhat like mine someone recommended using GetSystemMetrics() but i have not one clue of how to use that.

can somebody help me?

below is the piece of the script im working on any help would be appreciate it.

Case $msg = $Button_TSTGO
        $TSTName = GUICtrlRead($TSTInput)
        $TSTList = IniRead("\\finch\ceregen_it\JEGONZ\Public\DB access\TestRDC.ini", "TestVM", $TSTName, 1)
        If $TSTList = 0 Then
            ShellExecute("mstsc.exe")
            WinWaitActive("Remote Desktop Connection", "", 10)
            sleep(500)
            Send("^a")
            Send('{DEL 5}')
            Sleep(1000)
            send($TSTList)
            Sleep(500)
            Send('{SPACE 2}')
            sleep(500)
            Send('{ENTER}')
            WinWaitActive($TSTList, "", 10)
            Sleep(1000)
            Send('{ENTER}')
            
            WinWaitActive($TSTName, "", 10)
            Sleep(1000)
            WinSetState($TSTName , "", @SW_MAXIMIZE)
            Sleep(1000)
            WinMove($TSTName, "", 0, 0, 800, 600)
            Sleep(1000)
            $size = WinGetPos($TSTName)
;~          MsgBox(0, "Active window stats (x,y,width,height):", $size[0] & " " & $size[1] & " " & $size[2] & " " & $size[3])
            Opt("MouseCoordMode", 0)
            MouseClick("Left", 900, 410, 2, 1)
            Opt("MouseCoordMode", 1)
            Sleep(500)      
            Send("")
            Sleep(500)
            Send('{DEL}')
            Sleep(1000)

            Send($username)
            Sleep(1000)
            Send('{TAB}')
            Send($password)
            Sleep(1000)
;~          Send('{ENTER}')
            Else
                MsgBox(0,"Unable to Connect ","The specified remote computer could not be reached",-1,$GUI)

            EndIf
Edited by scorch

Share this post


Link to post
Share on other sites
trancexx

You can get screen resolution like you said:

#Include <WinAPI.au3>

Global Const $SM_CXSCREEN = 0
Global Const $SM_CYSCREEN = 1

$iWidth = _WinAPI_GetSystemMetrics($SM_CXSCREEN);  width of the screen
$iHeight = _WinAPI_GetSystemMetrics($SM_CYSCREEN);  height of the screen

ConsoleWrite($iWidth & " x " & $iHeight & @CRLF)

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
scorch

You can get screen resolution like you said:

#Include <WinAPI.au3>

Global Const $SM_CXSCREEN = 0
Global Const $SM_CYSCREEN = 1

$iWidth = _WinAPI_GetSystemMetrics($SM_CXSCREEN);  width of the screen
$iHeight = _WinAPI_GetSystemMetrics($SM_CYSCREEN);  height of the screen

ConsoleWrite($iWidth & " x " & $iHeight & @CRLF)
yea but how do i implement that into the script.... or so to say how would the above script change the mousecoordinates in relation to screen size etc..

i guess i might just not be getting how this is suppose to interact together.

Share this post


Link to post
Share on other sites
scorch

any thoughts anybody? ^_^

Share this post


Link to post
Share on other sites
trancexx

Well, I've developed an alergy to Send() automation.

Send('{ENTER}') is evil. Evil I tell you!


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
scorch

Well, I've developed an alergy to Send() automation.

Send('{ENTER}') is evil. Evil I tell you!

now how is this post suppose to help me.................. LOL

im not sure if im not giving enough info or script to why people are not posting there thoughts on this issue or is it just to complicated.....

Share this post


Link to post
Share on other sites
trancexx

now how is this post suppose to help me.................. LOL

I bumped your thread. You didn't get that?

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
scorch

I bumped your thread. You didn't get that?

yea i got it thats why is put LOL at the end of my comment.

thanks bro ^_^

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  

×