Sign in to follow this  
Followers 0
Najtssob

How to enter text into specific textfield

19 posts in this topic

#1 ·  Posted (edited)

Hi,

I need to automate some login procedure (nothing important, so there is really no scurity issues).

How can I enter username and password into apropriate field ?

I tried to modify calculator.au3 example, but the script always complete just one field.

Best regards, Najtssob.

Edited by Najtssob

Share this post


Link to post
Share on other sites



Post the modifyed script

Send("Username")

Send("{TAB}");<= to change to some other field

Send("Password")

Some other way is using ControlSend(), with using autoit window info tool to get control ID


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Thank you very much.

How can I check if username field is empty and if isn't how can I cleare it ?

Because now is the problem that the app remebers the previous username and when my script enter new username it appends it at the end.

Best regards, Najtssob.

Share this post


Link to post
Share on other sites

Apart from ControlSend, you can also try to use ControlSetText to try to change existing text or ControlGetText to check if you can read text in that field.

Look in the help file in Index for all Control* commands to see the full list of the commands that you can try to use or test.


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Thank you again.

I have few more questions, If you can help me.

1. How to hide form/window until the user is logged in and desktop is ready. If I use this command at start

Run("C:\Program Files\VMware\VMware View\Client\bin\wswc.exe", @SW_HIDE)
and
WinSetState("VMware View Client", "", @SW_SHOWDEFAULT)
at the end, then the application doesn't work. I see it's process in task manager, but nothing showes up on the screen.

2. How can I replace this "Sleep(3000)" commands with something more reliable? Problem is that after each "phase" a window/form is closed and after few second a new window/form is shown with same title but different content.

How it looks if you connect manualy:

First you enter server name an press enter, after that form dissapers and few seconds later new form opens where you enter username and password. Then again you press enter and form dissapears and again in few seconds new form opens with some additional setings. You press enter for the third time and the fourth and final window with your desktop opens. I would like that first three forms would be invisible and only fourth form/window should be shown.

All this four forms have title "VMware View Client" and in task manager is al the time process wswc.exe.

Here is my code so far.

; Run the VMware View
Run("C:\Program Files\VMware\VMware View\Client\bin\wswc.exe")

;PHASE ONE
WinWaitActive("VMware View Client")
; Enter server name
ControlSetText("VMware View Client", "", "[CLASSNN:Edit1]", "view.demo.local")
Send("{ENTER}")

;PHASE TWO
; Enter username and pass
Sleep(3000)
WinWaitActive("VMware View Client")
ControlSetText("VMware View Client", "", "[CLASSNN:Edit1]", "demo")
ControlSetText("VMware View Client", "", "[CLASSNN:Edit2]", "demo123")
Send("{ENTER}")

;PHASE THREE
Sleep(3000)
Send("{ENTER}")

;PHASE FOUR
; here a maximazide window with user desktop should be opened.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

1)

The third parametar on Run() command is show_flag, not the second as it stands in your post

Run("notepad.exe","",@SW_HIDE)
ToolTip("Run command,sleep 2 seconds")
Sleep(2000)
WinSetState("Untit","",@SW_SHOW)
ToolTip("SHOW command,sleep 5 seconds before exit")
Sleep(5000)

2)

You have commands like

WinWait

WinWaitClose

In some cases you can use WinGetHandle to compare windows

eg.

Run("notepad.exe","",@SW_SHOW)
Run("notepad.exe","",@SW_SHOW)
Sleep(10)
ToolTip("Running 2 notepad wins, close the last open win (active win) to exit")
WinWait("Untit")
WinWaitClose(WinGetHandle("[ACTIVE]"))

So script have handle of active win and its waiting for you to close it, it will not react if you activate some other win with identical name, only the one wih with specific handle will trigger WinWaitClose command and exit the script.

Some other way is to get the handle of curent win and loop until win dont exsist

$hwnd = WinGetHandle("Untit")
While WinExists($hwnd) 
    Sleep(10)
WEnd

There are lots of other functions that can b used for something this, but i dont think that you shud use something other thatn this three funcs to get what you need in this situation.

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

Hi It's me again :unsure:

I managed to overcome the second problem but the first remains.

I changed first line into

Run("C:\Program Files\VMware\VMware View\Client\bin\wswc.exe", "", @SW_HIDE)

but the window remain visible :>

I tried to add multiple

WinSetState("VMware View Client", "", @SW_HIDE)

statements, but the windows keeps poping up. I add this statement at the begining of every so called phases.

Any more ideas ?

P.S.

If someone is willing to try it himself, I can setup a server reachable from the inernet and upload client sowhere that others can download it.

Share this post


Link to post
Share on other sites

try controlsettext :/ tht might work


[spoiler]My UDFs: Login UDF[/spoiler]

Share this post


Link to post
Share on other sites

try controlsettext :/ tht might work

How can this help, with forms hidding ?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

the best thing is to get to know the promt commands for vmware :unsure:

this is just new and u might wanna see this link:

http://webwereld.nl/nieuws/106282/vmware-vanaf-de-prompt.html#utm_source=front_techworld_1&utm_medium=website&utm_campaign=ww

just realized.... i hope you are dutch because the site is in dutch...

iff u aren't try google vmware promt commands :>

this commands u can put in your script;)

Edited by FMS

as finishing touch god created the dutch

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

@FMS

I know prompt commands for vmware view, but this doesn't help me to hide it's form.

Also I need to do a little more that you can do using romp command provided by vmware view.

Thank you anyway.

Edited by Najtssob

Share this post


Link to post
Share on other sites

@bogQ

Any more ideas how to hide form ?

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

i think your forgetting to use @SW_SHOW after you use @SW_HIDE

like use @SW_HIDE to hide the window you dont want to see and use @SW_SHOW on the window u want to see

Edited by pieeater

[spoiler]My UDFs: Login UDF[/spoiler]

Share this post


Link to post
Share on other sites

#14 ·  Posted

Any more ideas how to hide form ?

Could you post all your code, as it is now with the WinSetState() lines included?

Share this post


Link to post
Share on other sites

#15 ·  Posted

@bogQ

Any more ideas how to hide form ?

To tell you the truth, i don`t have VMware (i use only VirtualPC) so i cant test or confirm the problem with hiding the win, and i don`t know how the win reacts.

If i was you and WinSetState("VMware View Client", "", @SW_HIDE) failed i would try

_WinAPI_SetParent ( WinGetHandle ( "winname" ),$HandleToAutoitCreatedGui )

to put win in a autoit win and instead hiding main win with WinSetState to hide autoit created gui

GUISetState ( @SW_HIDE , $AutoitGui )

Note that before using _WinAPI_SetParent move your VMware win to 0 0 pos with WinMove

I don`t have slitest idea how will all of that will react because i cant test it, if it don`t work and you cant _WinAPI_SetParent to that win and hide it with gui only thing in my head left is to put win to some crazy pos, like WinMove("Untitled","",2000,2000) so that user cant click it until the time is right, or to wait to someone other have some better idea.


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

#16 ·  Posted

This is part of my code, modified so you can test it.

; Run the VMware View
Run("C:\Program Files\VMware\VMware View\Client\bin\wswc.exe -serverURL 193.110.145.164", "", @SW_HIDE)

; Wait for the VMware View to become active
Sleep(2000) ;without this, username and pass are not set
WinWaitActive("VMware View Client")
WinSetState("VMware View Client", "",@SW_HIDE)

ControlSetText("VMware View Client", "", "[ID:1004]", "Username")
ControlSetText("VMware View Client", "", "[ID:1066]", "pass")
;Send("{ENTER}")

Sleep(5000)
; let us see if there is anything in edit fields. If there is, then we were sucessfull
WinSetState("VMware View Client", "",@SW_SHOW)

Here you can get view client https://193.110.145.164/. It's 22MB in size.

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Well I'm not able to connect to your server from my pc, but thank you for providing a good script and the link to the VMware download. :unsure:

I do see somewhat what you mean, but I was able to get the window to hide with the WinSetState() function. The Run command doesn't seem to honor the show_flag parameter when set to @SW_HIDE. It'll do a @SW_MINIMIZE though.

The below is the fastest I've gotten it to hide upon startup:

Run("C:\Program Files\VMware\VMware View\Client\bin\wswc.exe", "", @SW_MINIMIZE)
WinWait("VMware View Client")
WinSetState("VMware View Client", "",@SW_HIDE)

ControlSetText("VMware View Client", "", "[CLASS:Edit; INSTANCE:1]", "Server Address")
Sleep(2000)

WinSetState("VMware View Client", "",@SW_RESTORE)
WinSetState("VMware View Client", "",@SW_SHOW)

The user/pass screen wouldn't come up without connecting, so I just set the server address field to simulate the same thing.

EDIT: This was tested on WinXP, can test on Vista later if need be.

Edited by bwochinski

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Dono if itl work, try to run it with -userName -password parametar?

Run("E:\Program Files\VMware\VMware View\Client\bin\wswc.exe -serverURL 193.110.145.164 -userName NamE -password PasS", "")

wswc.exe -checkin -staycheckedout -desktopName <name of desktop> -serverURL <URL of server> -userName <name of user> -password <password> -domainName <name of domain>

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

@bogQ

You can use command line parameters to input username and password for the DESKTOP. But there are no parameters for RSA username and password, so this part I wish to automate.

You have two levels of authentication. First level is RSA username and pass and second level is username and pass for the desktop.

Edited by Najtssob

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