anpspb Posted April 22, 2012 Posted April 22, 2012 Hello all! I try to solve a simple task: to open local webpage in Chrome. As anybody know there is no a special Chrome menu command (or a switch) of doing it. If we put in the same directory Portable Chrome exe-file and webpage (help.html) and the au3-script and hope to get for example: file:///H:/0FLASH/exe/GoogleChromePortable11/help.html in Chrome's omnibox - NO result, it shows after about 5 secs instead: file^|||H^\0FLASH\exe\GoogleChromePortable11|help/html Why? Script is attached below because of small size. Thanks in advance! (WinXP SP3, Celeron M) ---------------------------------- dim $var=@ScriptDir & "\chrome.exe" dim $file="file:///" & @ScriptDir & "/help.html" $pid=Run($var, "",@SW_MAXIMIZE) WinActivate("New tab - Google Chrome", "") $handle = WinGetHandle("New tab - Google Chrome", "") sleep(10) Opt("WinTextMatchMode", 4) ControlSend($handle, "", "[CLASSNN:Chrome_OmniboxView1]", $file,1) ; Sends a string in raw mode sleep(10)
PhoenixXL Posted April 23, 2012 Posted April 23, 2012 (edited) If u Move Chrome to the script Dir ......... I dont think thats gonna solve your problem Becoz the chrome must also be requiring some external files in its Directory So it would be a better idea to move the Script at the Chrome's Directory You may get better from this Example!! Opt("WinTextMatchMode", 4) dim $var='C:UsersabhishekAppDataLocalGoogleChromeApplication' & "chrome.exe" dim $file="file:///" & @ScriptDir & "/help.html" $pid=ShellExecute($var, "",@SW_MAXIMIZE) WinWaitActive("[CLASS:Chrome_WidgetWin_0; TITLE:Abhishek Mohanty - Google Chrome]", "") $handle = WinGetHandle("[CLASS:Chrome_WidgetWin_0; TITLE:Abhishek Mohanty - Google Chrome]", "") sleep(10) ControlSetText($handle, "", "[CLASSNN:Chrome_OmniboxView1]", $file ) ControlSend($handle, "", "[CLASSNN:Chrome_OmniboxView1]",'{ENTER}') sleep(10) Edited April 23, 2012 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
anpspb Posted April 23, 2012 Author Posted April 23, 2012 PhoenixXL, thank you very much for the answer!! As _portable_ Chrome and webpage should start from somebody's CD/flash under any Wimdows I still have to use Chrome dir as a subdir of total (with title webpage) project. And in addition I set more long 'sleep' delay (for faster computers). All other code works perfectly! And I dont't know even where have you come to "[CLASS:Chrome_WidgetWin_0; TITLE:New Tab - Google Chrome]" ! It works in spite of I couldn't find anything like in AutoIt Window Info in my system. The result script that works attached. Thank you so much!chrome-autoit.au3
PhoenixXL Posted April 24, 2012 Posted April 24, 2012 EveryThing is Almost Available in the Compiled HTML Help File............ U can search the Help File for 'Advanced Title Match Mode' or 'opt(WinTitleMatchMode,4)' and u will get a good concept about the 'CLASS' , 'INSTANCE' , 'CLASSNN' and Much More......... If not you can always seek help in this Forum ; We are always there to help you out Regards Phoenix XL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
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