Wanabeelee Posted June 3, 2013 Share Posted June 3, 2013 I'm very basic in my knowlege of programing. Batch file is about as good as it gets, but willing to learn more. What I am needing may be very simple for people who understand programing. I need a button that is always ontop that reads the active IE windows and grabs the domain name only. And appends it to a text file. Example: If I was at www.google.com, it would write google.com to line one in the text if I clicked it while on another page http://ebm.e.redbox.com it would take the redbox.com and write it to line two of the text file. Could someone show me how this would be done? Thanks for your time and help. Link to comment Share on other sites More sharing options...
BugFix Posted June 3, 2013 Share Posted June 3, 2013 Have a look at: _IEPropertyGet() With this function you can get the "locationurl". Best Regards BugFix Link to comment Share on other sites More sharing options...
Wanabeelee Posted June 3, 2013 Author Share Posted June 3, 2013 Like I said, I'm green like spring. I get an error. Also thinking it will not get just the base domain name but the whole url. Dont know how to make it into a button. Little help please #include <File.au3> #include <ie.au3> $sURL = IEPropertyGet($oIE, "locationurl") write("$sURL") Func write($thingstowrite) $sFilePath = @HomeDrive & "\test.txt" _FileCreate($sFilePath) $file = FileOpen($sFilePath, 1) FileWrite($file,$thingstowrite & @CRLF) FileClose($file) EndFunc Link to comment Share on other sites More sharing options...
Danp2 Posted June 3, 2013 Share Posted June 3, 2013 You have to set the value of $oIE before you can use it with any of the _IE functions. Suggest that you try reviewing and running some of the help file examples. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Wanabeelee Posted June 3, 2013 Author Share Posted June 3, 2013 Been trying for hours, Guess this is just beyond my understanding. Link to comment Share on other sites More sharing options...
BrewManNH Posted June 3, 2013 Share Posted June 3, 2013 Try this.#include <ie.au3> $oIE = _IECreate("www.google.com") $sURL = _IEPropertyGet($oIE, "locationurl") $sDomain = StringRight($sURL, StringInStr($sURL, ".", 0, -2) - 1) write($sDomain) Func write($thingstowrite) $sFilePath = @HomeDrive & "\test.txt" $file = FileOpen($sFilePath, 1) FileWrite($file, $thingstowrite & @CRLF) FileClose($file) EndFunc ;==>write If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Wanabeelee Posted June 3, 2013 Author Share Posted June 3, 2013 Try this. #include <ie.au3> $oIE = _IECreate("www.google.com") $sURL = _IEPropertyGet($oIE, "locationurl") $sDomain = StringRight($sURL, StringInStr($sURL, ".", 0, -2) - 1) write($sDomain) Func write($thingstowrite) $sFilePath = @HomeDrive & "\test.txt" $file = FileOpen($sFilePath, 1) FileWrite($file, $thingstowrite & @CRLF) FileClose($file) EndFunc ;==>write A close thing. It opens google. I guess I'm not understanding the whole function thing. Also in the url it is logging it cuts off the G in google.com I need it to grab what ever the current opened site is. Link to comment Share on other sites More sharing options...
jdelaney Posted June 3, 2013 Share Posted June 3, 2013 (edited) $sDomain = StringRight($sURL, StringInStr($sURL, ".", 0, -2) - 1) change to: $sDomain = StringRight($sURL, StringInStr($sURL, ".", 0, -2)) was playing around with regexp: $sURL = "http://www.google.com/test/test/blah.bla" $string = StringRegExpReplace($sURL, "(?i)(https?:/{2,2}w{0,3}.?)(.*.[w]{3,3})(W.*)", "2") Edited June 3, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Wanabeelee Posted June 5, 2013 Author Share Posted June 5, 2013 Thanks for the help. Had a good friend write something up for me that works great. I've learned a lot from your post. Thank you for your time. 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