Sign in to follow this  
Followers 0
Damien56546

WindowWaitHelp?

12 posts in this topic

ShellExecute('http://xxx.xxx.xxx.x/citrix/metaframexp/default/login.asp')

WinWaitActive("MetaFrame XP Login")

Sleep('1400')

Send('myusername{TAB}')

Send('mypassword{TAB}{ENTER}')

Sleep('1200')

Send('{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}')

WinWaitActive("Logon to HaRVEY - \\Remote")

Sleep('2000')

Send('username{TAB}')

Send('password{TAB}{TAB}{ENTER}')

Hi all,

Just wondering,

If there is a better way to write my autologin script.

It's a remote application that goes in via Citrix.

So It opens up the citrix login page in the browser,

Then types my user, then tab, then password, the enter.

Then the app pops up.

Then it sends my app user

Then my app password.

Questions:

The TAB TAB TAB TAB TAB is how i've got it to select the link I want at the moment.

This isn't really a good way to do it, as all it'd take is another hyperlink on the page and it would then be 'tabbing' to the wrong one and screwing it all up.

I'd rather it seek out the button/link then click it, is that possible?

Also, is it possible to wait til the webpage had loaded completly before it sends my

Send('myusername{TAB}')

Send('mypassword{TAB}{ENTER}')

The script works fine, but first thing in the morning when I'm accessing the page for the first time, a) the browser is slower to load up, and :) the page isn't all cached. It starts sending the username too soon and ends up putting it in the wrong place and thus stuffing the script.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If your using IE as your browser

You should be able to use _IE Functions for this:

ShellExecute('http://xxx.xxx.xxx.x/citrix/metaframexp/default/login.asp')

WinWaitActive("MetaFrame XP Login")

Sleep('1400')

Send('myusername{TAB}')

Send('mypassword{TAB}{ENTER}')

Sleep('1200')

Send('{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}')

And ControlSend/ControlClick commands for this:

Send('username{TAB}')

Send('password{TAB}{TAB}{ENTER}')

You'll need to use the AutoIT Window Info Tool to get the

information on the windows and controls.

All of the above commands will directly target the buttons and boxes,

rather than tabbing and hoping your in the right place.

Give it a try and if you have trouble post some code and I'll give you a hand.

Kenny

Edited by ken82m

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites

Would probably need some help on how to use this ControlClick and IE funct

Cheers

I know the experts hate handing the code to a newbie on a silver platter, after all.. howa re they to learn.

So maybe some examples. Or the code if you want! :)

Share this post


Link to post
Share on other sites

This will launch IE go to the page and pause the script until the page is finished loading.

#include <IE.au3> 
$IE = _IECreate("http://xxx.xxx.xxx.x/citrix/metaframexp/default/login.asp", 0, 1, 1, 1)

_IEFormGetObjByName to grab a handle for the form.

_IEFormElementGetObjByName to get a handle for the input fields

_IEFormElementSetValue to write the username and password

_IEFormSubmit to submit the info

WinWaitActive("Logon to HaRVEY - \\Remote")

ControlSend to send your username and password

ControlClick to hit the ok or login button.

You're going to need to get the info for those commands specifically from the webpage and application your using so I can't help you with that using the info you gave me.

Try to work with that and see how you do.

-Kenny


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites

50% working.

#include <IE.au3>

$oIE = _IECreate("http://xxx.xxx.xxx.x/citrix/metaframexp/default/login.asp", 0, 1, 1, 1)

$oForm = _IEFormGetObjByName ($oIE, "NFuseForm")

$oText = _IEFormElementGetObjByName ($oForm, "user")

_IEFormElementSetValue ($oText, "MYUSERNAME")

$oText2 = _IEFormElementGetObjByName ($oForm, "password")

_IEFormElementSetValue ($oText2, "MYPASSWORD")

_IEFormSubmit ($oForm)

So the box opens up, waits for the page to load, sends my details in and click submit.

From here, I need to have a button clicked to launch the application

How would I use control+click? The button is not in a form, it's just a link.

The rest shouldn't be too hard

Share this post


Link to post
Share on other sites

Cool, nice progress :)

Okay try to get a handle to the button using _IEGetObjById() or _IEGetObjByName

Then you can use:

_IEAction ( $LastButton , "click" )

-Kenny


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites

Cool, nice progress :)

Okay try to get a handle to the button using _IEGetObjById() or _IEGetObjByName

Then you can use:

_IEAction ( $LastButton , "click" )

-Kenny

<td ALIGN="LEFT" VALIGN="TOP" WIDTH="33%">

<span class="xxsBold">

<a class="appLinks" href="launch.asp?NFuse_Application=Farm1x003aHarveyx0020x002dx0020VIC&NFuse_AppFriendlyNameURLEncoded=Harveyx0020x002dx0020VIC" target="hiddenwindow" onclick="resetSessionTimeout(); ">

<span style="display:inline">

<IMG SRC="/Citrix/MetaFrameXP/NFuseIcons/Farm1x003aHarveyx0020x002dx0020VIC_1114148227.gif" border=0

alt="Harvey - VIC"

title="Harvey - VIC"

align=bottom hspace=3>

I can't find it's name or ID

Share this post


Link to post
Share on other sites

Open up this image

http://xxx.xxx.xxx.x/Citrix/MetaFrameXP/NF..._1114148227.gif

Is that by any chance a picture of the button your trying to click on?

Kenny


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites

Yep that's the one !

Share this post


Link to post
Share on other sites

Okay try this:

_IEImgClick ( $oIE , "/Citrix/MetaFrameXP/NFuseIcons/Farm1x003aHarveyx0020x002dx0020VIC_1114148227.gif" )

-Kenny


My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

Share this post


Link to post
Share on other sites

That one unfortunantly doesnt work at all, even with xxx.xxx.xx.xx in front

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Try just this:

_IEImgClick ( $oIE , "Farm1x003aHarveyx0020x002dx0020VIC_1114148227.gif", "src" )

OR

_IEImgClick ( $oIE , "Harvey - VIC", "alt" )

Kenny

Edited by ken82m

My Contributions _StringMultiReplace PC Builders Console - Secure PDF Creator - Cisco VPN Installer MS DNS Server Backup Script - MS DHCP Backup Script IT Admin Console - Toggle Admin Mode - MyMovies-Add Discs Script - IT Help Desk and System Information Tool - Set On Lid Close Power Option - Streaming Media Server & Website "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains."

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