Jump to content
seangriffin

Chrome UDF

Recommended Posts

jdelaney

Try using the class instead

[CLASS:Chrome_WidgetWin_1]


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.

Share this post


Link to post
Share on other sites
Zohaib

Hello Friends.
please guide me for how to navigate chrome by its autoit udfs.
 

_ChromeStartup() ... this function takes url and opne chrome with this url. i want to navigate the chrome frome this url to another url. how i can do it?

Thanks in Advance

Share this post


Link to post
Share on other sites
junkew

I assume you can do something like

Not tested but should lead to something like

_ChromeEval("window.location = "http://www.mozilla.org";");

alternate udf is to search for iuiautomation in example forum

  • Like 1

Share this post


Link to post
Share on other sites
Zohaib

I assume you can do something like

Not tested but should lead to something like

_ChromeEval("window.location = "http://www.mozilla.org";");

alternate udf is to search for iuiautomation in example forum

 

I tried to use _ChromeEval("window.location = "http://www.mozilla.org";"); this but it dosn't work. i also find iuiautomation example but it was mouse movement. i want to automate chrome without using mouse like IE and FF.

Is there any other way to navigate chorome?

Share this post


Link to post
Share on other sites
arthalita01

where  _ChromeObjSetValueById ?

 i try add

Func _ChromeObjSetValueById($objid, $value, $index = 0, $timeout = 5)

    dim $response = ""

    $response = _ChromeEval("document.getElementsById('" & $objid & "')[" & $index & "].value = '" & $value & "';", $timeout)

    SetError(@error)

    return $response
EndFunc

Html Target

<TITLE>Chrome Example Form</TITLE>

<input type='text' id='textExample' value='http://' size='20' maxlength='30'>
#Include <Array.au3>
#Include <Chrome.au3>

_ChromeShutdown()
_ChromeStartup("http://192.168.2.100/x/cromeauto1")
_ChromeDocWaitForExistenceByTitle("Chrome Example Form", 5)

_ChromeObjSetValueById("textExample", "12121218") ;<<<<<<<---- BUT not working

>_<


tanks..

Edited by arthalita01

Share this post


Link to post
Share on other sites
neonoff

Hello Friends.

please guide me for how to navigate chrome by its autoit udfs.

 

_ChromeStartup() ... this function takes url and opne chrome with this url. i want to navigate the chrome frome this url to another url. how i can do it?

Thanks in Advance

_ChromeEval("document.location.replace('YOUR URL');")

that worked for me

Edited by neonoff

Share this post


Link to post
Share on other sites
neonoff

Recently Google has  disabled all extensions not from the google extension store. That's why this UDF stopped work, cause autoit extension was disabled by chrome. There are several ways to hack this but the most appropriate for my goals was to downgrade chrome.

This politics was annonced by Google in the January 2014 so all versions of Chrome after January automatically disables non store extensions. I chose the latest stable version of Chrome before 2014, it is 31.0.1650.63. Then I modified my host file (C:WINDOWSsystem32driversetchosts) with usual Windows notepad and added this strings:

127.0.0.1 clients.google.com
127.0.0.1 clients1.google.com
127.0.0.1 clients2.google.com
127.0.0.1 clients3.google.com
127.0.0.1 clients4.google.com
127.0.0.1 clients5.google.com
127.0.0.1 clients6.google.com
127.0.0.1 clients7.google.com
127.0.0.1 clients8.google.com
127.0.0.1 clients9.google.com
127.0.0.1 lh1.googleusercontent.com
127.0.0.1 lh2.googleusercontent.com
127.0.0.1 lh3.googleusercontent.com
127.0.0.1 lh4.googleusercontent.com
127.0.0.1 lh5.googleusercontent.com
127.0.0.1 lh6.googleusercontent.com
127.0.0.1 lh7.googleusercontent.com
127.0.0.1 encrypted-tbn1.gstatic.com
127.0.0.1 encrypted-tbn2.gstatic.com
127.0.0.1 encrypted-tbn3.gstatic.com
127.0.0.1 encrypted-tbn4.gstatic.com
127.0.0.1 encrypted-tbn5.gstatic.com

 

this strings prevent Chrome from upgrading.

Pros

I have working version of Chrome where I can install any extension I want and this extansions are enabled each time I start up Chrome.

Cons

I have not the latest version of Chrome with possible drawbacks, but I have this version installed on my virtual machine so for me it's not a minus at all.

P.S. One can have up-to-date Chrome and working extension, but each time you start up Chrome you will see annoying message about non store extension with suggestion to disable it.

Edited by neonoff

Share this post


Link to post
Share on other sites
duzers

where  _ChromeObjSetValueById ?

 i try add

Func _ChromeObjSetValueById($objid, $value, $index = 0, $timeout = 5)

    dim $response = ""

    $response = _ChromeEval("document.getElementsById('" & $objid & "')[" & $index & "].value = '" & $value & "';", $timeout)

    SetError(@error)

    return $response
EndFunc

Html Target

<TITLE>Chrome Example Form</TITLE>

<input type='text' id='textExample' value='http://' size='20' maxlength='30'>
#Include <Array.au3>
#Include <Chrome.au3>

_ChromeShutdown()
_ChromeStartup("http://192.168.2.100/x/cromeauto1")
_ChromeDocWaitForExistenceByTitle("Chrome Example Form", 5)

_ChromeObjSetValueById("textExample", "12121218") ;<<<<<<<---- BUT not working

>_<

tanks..

 

Not getElementsById but getElementById, and maybe without $index.

Try this:

Func _ChromeObjSetValueById($objid, $value,  $timeout = 5)
    dim $response = ""
    $response = _ChromeEval("document.getElementById('" & $objid & "').value = '" & $value & "';", $timeout)
    SetError(@error)
    return $response
EndFunc

Share this post


Link to post
Share on other sites
sthornhill11

 

STEP 2: Install the AutoIT Chrome Native Messaging Host.

Open the following link and download the file named autoit_chrome_native_messaging_host_install.exe:

https://docs.google.com/file/d/0B_6JmwNIIZ06eDgxaVJPNUNxa28/edit?usp=sharing

Note - you may be prompted to login with a Google account as this file is hosted on Google Drive.

 

I cannot get this file to download.

It keeps giving me an error message -

"Sorry, this file is infected with a virus

Only the owner is allowed to download infected files."

 

Looking forward to trying this out!

Share this post


Link to post
Share on other sites
AdnanZahid

I can install AutoIt extension but cannot enable it because it is not available on Chrome Web Store. Any ideas?

Share this post


Link to post
Share on other sites
Berfs

Hi,

Thanks for the script. I have the problem, that when i use your first example, autoit opens chrome and navigate to the page. But nothing happens, no entry is filled or clicked.

Edited by Berfs

Share this post


Link to post
Share on other sites
junkew

@Berfs: Probably better to open a new thread in general help and support if you have issues with the iuiautomation and chrome. Most likely you missed chrome://accessibility page

For others using chrome you can communicate thru a textbox and addressbar commands

Type this once for each page and an edit will be added

javascript: var e = document.createElement("input");e.setAttribute("value","Hello world");document.body.appendChild(e);void(0); 

then if you want to have data in it you type in addressbar

javascript: e.setAttribute("value", document.documentElement.innerHTML);

and this data you can retrieve with regular IUIAutomation scripts

I just did not have time to wrap that into UIAWrappers logic (as this concept works on all browsers that support bookmarklets)

Edited by junkew

Share this post


Link to post
Share on other sites
Oldeschool

Is there any plans of getting the Chrome UDF submitted to the Chrome Store?  I see that you are going a different way with IUI automation?    Can we still get support for the Chrome UDF such as downloading the files required?  Would you be willing to let someone else pursue the submitting extension to the Google store?

Share this post


Link to post
Share on other sites
obryana

Any ideas for how I can automatically disable the Save Password box that pops up every time someone logs in to a password protected website?

Share this post


Link to post
Share on other sites
directxguy

Hello. I too am wondering if there are any plans to submit this to the store so that it can be used with current versions of chrome.

Share this post


Link to post
Share on other sites
amartinez

Extensions can be loaded in unpacked mode by following these steps:

  1. Visit chrome://extensions (via omnibox or menu -> Tools -> Extensions).
  2. Enable Developer mode by ticking the checkbox in the upper-right corner.
  3. Click on the "Load unpacked extension..." button.
  4. Select the directory containing your unpacked extension.

The crx file needs to be extracted first. CRX files are zip files with a different header. Any capable zip program should be able to open it. If you don't have such a program, I recommend 7-zip.

Edited by amartinez

Share this post


Link to post
Share on other sites
mazinasm

Hi I have a problem with querySelector.

When i use my code, extension is down and doesn't work 

 image: http://screencast.com/t/AT1F45pF

Translation image

"There has been a breakdown AutoIT for Google Chrome. Click on this message to re-download this extension"

$class="input.mailbox__auth__button[type='submit']"
$oInputs = 'document.querySelector("'&$class&'").click()'
_ChromeEval("document.getElementsByName('Login')[0].value='petrsbu62'")
_ChromeEval("document.getElementsByName('Password')[0].value='z123456'")
_ChromeEval($oInputs)

I check full js in input.txt all is right 

document.querySelector("input.mailbox__auth__button[type='submit']").click()

I know that i can use some of the function from chrome.au3, but i need to now is querySelector are work in Chrome.ua3 or not. 

Edited by mazinasm

Share this post


Link to post
Share on other sites
wowxxoo

hi,polymath.

i have a question:i have opened one chrome browser,can i use the opening chrome  navigate another url by the chrome UDF? thank you very much!! 

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

  • Similar Content

    • Gowrisankar
      By Gowrisankar
      Dear members, 
      I am working on a project where, emails from outlook are to be read and moved to various folders within the mailbox, based on the content of the emails.
      I used the below code for moving mails. It works fine when I run it against individual mail ids. But when I run it on Shared mailbox, the mails are not moved to respective folders.
      _OL_ItemMove($oOutlook, $sEntryId, Default, $sDestinationFolder) The value of $sEntryId is saved in an excel report initially. The current process reads the $sEntryId from the excel and passes it to "_OL_ItemMove" statement.
      Requesting the guidance of the forum members in this issue.
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening everyone
      I am working with Word UDF ( thanks @water! ), and, especially, with the function _Word_DocFindReplace().
      The replace does work everywhere in the document, but, it does not work in Headers or Footers.
      Am I missing something or am I forced to use the code below?
      I have already looked in the Help file ( about _Word_DocFindReplace() ), but there are no mentions about replace text in Headers/Footers.
      Sub FindAndReplaceFirstStoryOfEachType() Dim rngStory As Range For Each rngStory In ActiveDocument.StoryRanges With rngStory.Find .Text = "find text" .Replacement.Text = "I'm found .Wrap = wdFindContinue .Execute Replace:=wdReplaceAll End With Next rngStory End Sub Thanks everyone in advance


      Best Regards.
    • ScriptJunky
      By ScriptJunky
      I noticed a lack of a constants file for _WinAPI_GetSystemMetrics() so I made this for anyone who wants to add it to their library. Enjoy!  (file attached below)
      #include-once ; #INDEX# ======================================================================================================================= ; Title .........: WinAPI GetSystemMetrics Constants ; AutoIt Version : 3.3.14.5 ; Language ......: English ; Description ...: Constants for _WinAPI_GetSystemMetrics(). ; Author(s) .....: ScriptJunky ; =============================================================================================================================== ; #CONSTANTS# =================================================================================================================== ; _WinAPI_GetSystemMetrics() Global Const $ARRANGE = 56 Global Const $CLEANBOOT = 67 Global Const $CMONITORS = 80 Global Const $CMOUSEBUTTONS = 43 Global Const $CONVERTIBLESLATEMODE = 0x2003 Global Const $CXBORDER = 5 Global Const $CXCURSOR = 13 Global Const $CXDLGFRAME = 7 Global Const $CXDOUBLECLK = 36 Global Const $CXDRAG = 68 Global Const $CXEDGE = 45 Global Const $CXFIXEDFRAME = 7 Global Const $CXFOCUSBORDER = 83 Global Const $CXFRAME = 32 Global Const $CXFULLSCREEN = 16 Global Const $CXHSCROLL = 21 Global Const $CXHTHUMB = 10 Global Const $CXICON = 11 Global Const $CXICONSPACING = 38 Global Const $CXMAXIMIZED = 61 Global Const $CXMAXTRACK = 59 Global Const $CXMENUCHECK = 71 Global Const $CXMENUSIZE = 54 Global Const $CXMIN = 28 Global Const $CXMINIMIZED = 57 Global Const $CXMINSPACING = 47 Global Const $CXMINTRACK = 34 Global Const $CXPADDEDBORDER = 92 Global Const $CXSCREEN = 0 Global Const $CXSIZE = 30 Global Const $CXSIZEFRAME = 32 Global Const $CXSMICON = 49 Global Const $CXSMSIZE = 52 Global Const $CXVIRTUALSCREEN = 78 Global Const $CXVSCROLL = 2 Global Const $CYBORDER = 6 Global Const $CYCAPTION = 4 Global Const $CYCURSOR = 14 Global Const $CYDLGFRAME = 8 Global Const $CYDOUBLECLK = 37 Global Const $CYDRAG = 69 Global Const $CYEDGE = 46 Global Const $CYFIXEDFRAME = 8 Global Const $CYFOCUSBORDER = 84 Global Const $CYFRAME = 33 Global Const $CYFULLSCREEN = 17 Global Const $CYHSCROLL = 3 Global Const $CYICON = 12 Global Const $CYICONSPACING = 39 Global Const $CYKANJIWINDOW = 18 Global Const $CYMAXIMIZED = 62 Global Const $CYMAXTRACK = 60 Global Const $CYMENU = 15 Global Const $CYMENUCHECK = 72 Global Const $CYMENUSIZE = 55 Global Const $CYMIN = 29 Global Const $CYMINIMIZED = 58 Global Const $CYMINSPACING = 48 Global Const $CYMINTRACK = 35 Global Const $CYSCREEN = 1 Global Const $CYSIZE = 31 Global Const $CYSIZEFRAME = 33 Global Const $CYSMCAPTION = 51 Global Const $CYSMICON = 50 Global Const $CYSMSIZE = 53 Global Const $CYVIRTUALSCREEN = 79 Global Const $CYVSCROLL = 20 Global Const $CYVTHUMB = 9 Global Const $DBCSENABLED = 42 Global Const $DEBUG = 22 Global Const $DIGITIZER = 94 Global Const $IMMENABLED = 82 Global Const $MAXIMUMTOUCHES = 95 Global Const $MEDIACENTER = 87 Global Const $MENUDROPALIGNMENT = 40 Global Const $MIDEASTENABLED = 74 Global Const $MOUSEPRESENT = 19 Global Const $MOUSEHORIZONTALWHEELPRESENT = 91 Global Const $MOUSEWHEELPRESENT = 75 Global Const $NETWORK = 63 Global Const $PENWINDOWS = 41 Global Const $REMOTECONTROL = 0x2001 Global Const $REMOTESESSION = 0x1000 Global Const $SAMEDISPLAYFORMAT = 81 Global Const $SECURE = 44 Global Const $SERVERR = 289 Global Const $SHOWSOUNDS = 70 Global Const $SHUTTINGDOWN = 0x2000 Global Const $SLOWMACHINE = 73 Global Const $STARTER = 88 Global Const $SWAPBUTTON = 23 Global Const $TABLETPC = 86 Global Const $XVIRTUALSCREEN = 76 Global Const $YVIRTUALSCREEN = 77  
      WinAPISystemMetricsConstants.au3
    • rcmaehl
      By rcmaehl
      A UDF with Extended Functions for Window Management
       
      Notes:
      Fixes WinGetClassList's barbaric returning of a @LF separated string instead of an array.
       
      Potential Uses:
      Automating applications that change their controls' handles/classes on each launch (e.g. half of Cisco's programs)
       
      Functions:
      _WinGetClassList
      _WinGetClassNNList
      _WindowGetHandleList
      _WindowGetHandleListFromPos
       
      Download: 
      WindowEx.zip  (v0.4)
       
      Changelog:
      10/04/2016 (v0.4): _WinGetClassNNList Fixed : Not Returning an Index when using $2D_ARRAY _WinGetClassNNList Fixed : Not Properly returning $aArray[x][1] on Classes with instances > 9 when using $2D_ARRAY 10/03/2016 (v0.3): _WinGetClassList Added : Exactly the same as WinGetClassList but returns a more civilized Array _WinGetClassNNList Added : Returns Classes and their instances in either a 1D or 2D array depending on Flags _WindowGetHandleList Renamed: _WinGetHandleList SCRIPT BREAKING! _WindowGetHandleListFromPos Renamed: _WinGetHandleListFromPos SCRIPT BREAKING! 10/01/2016 (v0.2): WindowsExConstants.au3 Added : Flags in _WindowGetHandleListFromPos _WindowGetHandleListFromPos Removed: ConsoleWrite left in during debug _WindowGetHandleListFromPos Added : Flag for if part of a Control is at $X, $Y return it as well. 10/01/2016 (v0.1): _WindowGetHandleList Added : Retrieves the handles of classes from a window. _WindowGetHandleListFromPos Added : Retrieves the handles of classes at a specific position from a window. Known and Reported Bugs:
      None reported To Do:
      To Be Decided. Opinions welcome! Upcoming Changes:
      To Be Decided.
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good morning everyone

      I was playing a little bit with "Screen Capture" UDF, and I was trying to make a "Window" capture, but, since I made a GUI which through I fire the event "Capture", my GUI is captured as well, and I don't want to
      This is the line of code that makes the capture:
       
      _ScreenCapture_CaptureWnd($strScreenCaptureFileName, $objActiveWindow, 0, 0, -1, -1, False) And these are the lines of code which select the "active" window:
       
      Local $objCurrentWindow = 9999 If _IsPressed("01") Then $objCurrentWindow = WinGetHandle("[ACTIVE]") If $objCurrentWindow <> $objMyGUI Then $objActiveWindow = $objCurrentWindow EndIf EndIf Sorry If I made stupid mistakes
      Thanks in advance.

      Francesco
×