JSunn Posted September 3, 2007 Share Posted September 3, 2007 Hi All, I am working on a project that needs a function to launch a webpage with a logon form, with the typical username and password elements, like an webmail login page. Here are my questions: If the cursor is blinking in the username field, is there a way for autoit to detect which field or element has the cursor, and grab the element id or name from it? Thanks in advance for the help. -John Link to comment Share on other sites More sharing options...
DaleHohm Posted September 3, 2007 Share Posted September 3, 2007 The DOM makes it easy to set focus to a given element, but not to find out what has focus. What are you trying to do once you know the answer to that question? If you are simply trying to process a form, see _IEFormElementSetValue and then it does not matter where focus is to begin with. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
JSunn Posted September 3, 2007 Author Share Posted September 3, 2007 The DOM makes it easy to set focus to a given element, but not to find out what has focus.What are you trying to do once you know the answer to that question? If you are simply trying to process a form, see _IEFormElementSetValue and then it does not matter where focus is to begin with.DaleThanks for the reply Dale. Sorry if I was a bit vague. Here is what I'm trying to do - I have a program written in Autoit that stores passwords in an encrypted format. It also allows the user to store the URL of the website they are storing username / password creds for. I was thinking it would be pretty cool to have a feature that when a user clicks on an account within this program, the program will launch IE to the website and auto logon to the site for the user using the stored credentials. The problem is that autoit must know the element name of the username and password fields (elements) in order to know where to paste the username and password and proceed to logging in. Every site is different with different names for their elements, so i was thinking maybe I could create a mini wizard, for example when a user stores the username and password and URL for a specific site, I could launch the URL and direct the user to click and set the cursor in the username field (Where autoit would then grab the element name / info to be stored for future autologon use) and then have the user click and set the cursor in the password field for the same reason. The whole idea is to grab the element name for the username and password fields on any given login page without the user having to view the html source looking for them manually. Hope I described that ok. Thanks again for the reply.-John Link to comment Share on other sites More sharing options...
DaleHohm Posted September 3, 2007 Share Posted September 3, 2007 You may want to look at keepass end keeform http://www.autoitscript.com/forum/index.ph...&hl=keeformDale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
JSunn Posted September 3, 2007 Author Share Posted September 3, 2007 You may want to look at keepass end keeform http://www.autoitscript.com/forum/index.ph...&hl=keeformDaleThanks for the reply Dale. Unfortunately I can't rely on an outside utility for this one, so I may be forced to move on to a different language of there is no way to perform a detection of the username / password fields from within Autoit, or at least get the current cursor position on form. I appreciate you taking the time to reply.Thanks,John Link to comment Share on other sites More sharing options...
DaleHohm Posted September 3, 2007 Share Posted September 3, 2007 Keeform is in AutoIT and has source. I believe it scans the document for common username and password fields. I don 't think this is a language thing, but a DOM thing. There may be a way to get the element with focus, but I don't know it. You can use events to get element information when things change, like onfocus but I'm not sure that is really what you want - you would need inject client-side javascript to get the info. Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
JSunn Posted September 4, 2007 Author Share Posted September 4, 2007 Keeform is in AutoIT and has source. I believe it scans the document for common username and password fields.I don 't think this is a language thing, but a DOM thing. There may be a way to get the element with focus, but I don't know it. You can use events to get element information when things change, like onfocus but I'm not sure that is really what you want - you would need inject client-side javascript to get the info.DaleUsing Events to notify of on onfocus eents, is any info returned on which element / part of the webpage has focus? Thanks Dale-John Link to comment Share on other sites More sharing options...
DaleHohm Posted September 5, 2007 Share Posted September 5, 2007 Take a look here: http://www.autoitscript.com/forum/index.ph...amp;hl=objeventDale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
JSunn Posted September 13, 2007 Author Share Posted September 13, 2007 Take a look here: http://www.autoitscript.com/forum/index.ph...amp;hl=objeventDaleDale,I wanted to take a second to let you now how much your suggestions regarding Keeform have helped point me in the right direction and most of all, say thanks for taking the time to help out! I really appreciate the advice.regards,John Link to comment Share on other sites More sharing options...
DaleHohm Posted September 13, 2007 Share Posted September 13, 2007 Glad to help... Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble 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