Damien56546 Posted November 27, 2008 Share Posted November 27, 2008 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. Link to comment Share on other sites More sharing options...
ken82m Posted November 27, 2008 Share Posted November 27, 2008 (edited) If your using IE as your browserYou 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 November 27, 2008 by ken82m "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." Link to comment Share on other sites More sharing options...
Damien56546 Posted November 28, 2008 Author Share Posted November 28, 2008 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! Link to comment Share on other sites More sharing options...
ken82m Posted November 28, 2008 Share Posted November 28, 2008 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 "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." Link to comment Share on other sites More sharing options...
Damien56546 Posted November 28, 2008 Author Share Posted November 28, 2008 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 Link to comment Share on other sites More sharing options...
ken82m Posted November 28, 2008 Share Posted November 28, 2008 Cool, nice progress Okay try to get a handle to the button using _IEGetObjById() or _IEGetObjByName Then you can use: _IEAction ( $LastButton , "click" ) -Kenny "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." Link to comment Share on other sites More sharing options...
Damien56546 Posted November 28, 2008 Author Share Posted November 28, 2008 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 Link to comment Share on other sites More sharing options...
ken82m Posted November 28, 2008 Share Posted November 28, 2008 Open up this image http://xxx.xxx.xxx.x/Citrix/MetaFrameXP/NF..._1114148227.gifIs that by any chance a picture of the button your trying to click on?Kenny "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." Link to comment Share on other sites More sharing options...
Damien56546 Posted November 28, 2008 Author Share Posted November 28, 2008 Yep that's the one ! Link to comment Share on other sites More sharing options...
ken82m Posted November 28, 2008 Share Posted November 28, 2008 Okay try this: _IEImgClick ( $oIE , "/Citrix/MetaFrameXP/NFuseIcons/Farm1x003aHarveyx0020x002dx0020VIC_1114148227.gif" ) -Kenny "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." Link to comment Share on other sites More sharing options...
Damien56546 Posted November 28, 2008 Author Share Posted November 28, 2008 That one unfortunantly doesnt work at all, even with xxx.xxx.xx.xx in front Link to comment Share on other sites More sharing options...
ken82m Posted November 28, 2008 Share Posted November 28, 2008 (edited) Try just this: _IEImgClick ( $oIE , "Farm1x003aHarveyx0020x002dx0020VIC_1114148227.gif", "src" ) OR _IEImgClick ( $oIE , "Harvey - VIC", "alt" ) Kenny Edited November 28, 2008 by ken82m "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." Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now