Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/23/2014 in all areas

  1. _IEJS has been deprecated, please see: These are a few functions I've put together either for current necessity, past necessity, or looking forward at possible future necessity (and no, I didn't see how many lines of code it was until I was putting this together to upload). Issues with interacting with all types of IE versions and in all types of modes (standard or quirks), and trying to develop the means to successfully drag and drop automated are what started me on this javascript injection method. But keep in mind, not all functions make use of JS. I tried to make it as inline with the IE.au3 library as I was comfortable with. Right now, there are no only a few example codes, there are headers for each function other than internal functions. Some functions (specifically the position ones) are either untested, have proven to be a pain with visible document area only issues, or are in conflict with other types of position functions. I've not had time to debug those and see where their benefit lie at the moment. I've not been able to successfully implement a drag and drop (moving one object to another objects location, firing all necessary events) scenario using the JS move/drag events or even postmessage + WM_[TYPE]BUTTONMOVE/DOWN/UP, etc, as of yet. The issue with the position functions above have been somewhat the issue. So, if you find a solution to that, let me know, if you find issues with the code, please provide a reproducer, IE version, OS Type/Arch, and AutoIt version you're running. I will not respond to "I get this error" or "It doesn't work" with nothing else. If you have javascript code and you'd like to implement, explain what it is, why it's a great idea, and we'll get it in there. Other than that... I'll get examples up as soon as I get a chance, I just knew if I didn't get it up today, I'd forget for another month or 2 years . [some Examples in Zip] Functions: _IEJS_CallObjEval() _IEJS_CallObjExecScript() _IEJS_CheckAppVersionAlways() _IEJS_ClickObjByPoint() _IEJS_CreateWithParams() _IEJS_EmbeddedGetVersion() _IEJS_EmbeddedSetVersion() _IEJS_GetAppMajorVersion() _IEJS_GetObjEval() _IEJS_GetObjParentWindow() _IEJS_GetObjPos() _IEJS_GetObjType() _IEJS_GetScroll() _IEJS_GetScrollPoint() _IEJS_GetWindowSize() _IEJS_MouseEventExec() _IEJS_JSClassNameGetArray() _IEJS_JSClassNameGetCollection() _IEJS_JSClickObj() _IEJS_JSClickObjById() _IEJS_JSClickObjByName() _IEJS_JSClickObjByPoint() _IEJS_JSDragEventObj() _IEJS_JSEnable() _IEJS_JSGetObjByClassName() _IEJS_JSGetObjPos() _IEJS_JSIsEnabled() _IEJS_JSMouseEventObj() _IEJS_JSMouseEventObjById() _IEJS_JSMouseEventObjByName() _IEJS_JSObjQuerySelector() _IEJS_JSObjQuerySelectorAll() _IEJS_JSTypeOf() _IEJS_TabAttach() _IEJS_TabCount() _IEJS_TabCreate() _IEJS_TabGetInstance() _IEJS_VersionInfo() _IEJS_WinGetBrowserObjArray() Changes: Changes from 0.0.3 - 0.0.5 have been lost! 2014-12-30 B0.0.6 Added: _IEJS_EmbeddedGetVersion(); Get the embedded version used from something like _IECreateEmbedded 2014-12-30 B0.0.6 Added: _IEJS_EmbeddedSetVersion(); Set the embedded version used from something like _IECreateEmbedded (see example) 2014-12-30 B0.0.6 Added: _IEJS_TabAttach(); Similar to _IEAttach(), but browser specific and different string cases 2014-12-30 B0.0.6 Added: _IEJS_TabCount(); Get a count of the tabs open in a specific browser session 2014-12-30 B0.0.6 Added: _IEJS_TabGetInstance(); Get the tab instance number from the specific browser session 2014-12-30 B0.0.6 Added: _IEJS_WinGetBrowserObjArray(); Get all the browser objects (tabs) from a specific browser window handle/title Fixes for next version (B0.0.7): ; I mistakenly left out interacting with 3 params (attach/visible/takefocus) Func _IEJS_CreateWithParams($sURL, $sParams = "", $iTryAttach = 0, $iVisible = 1, $iWait = 1, $iTakeFocus = 1) Local Static $sHKCR = ((@AutoItX64) ? "HKCR64" : "HKCR") Local Static $szCOMIE = FileGetShortName(RegRead($sHKCR & _ "\CLSID\{0002DF01-0000-0000-C000-000000000046}\LocalServer32","")) If Not FileExists(StringReplace($szCOMIE, '"', "")) Then $szCOMIE = FileGetShortName(RegRead($sHKCR & _ "\CLSID\{D5E8041D-920F-45e9-B8FB-B1DEB82C6E5E}\LocalServer32","")) If Not FileExists(StringReplace($szCOMIE, '"', "")) Then Return SetError($_IESTATUS_NoMatch, 1, 0) EndIf EndIf Local $oRet If $iTryAttach Then $oRet = _IEJS_TabAttach($sURL, "URL") If IsObj($oRet) Then $oRet.visible = $iVisible If $iVisible And $iTakeFocus Then WinActivate($oRet.hwnd) EndIf Return SetError($_IESTATUS_Success, 1, $oRet) EndIf EndIf ; get current shell windows open and their count Local $oShell = ObjCreate("Shell.Application") Local $oWin, $nCount = $oShell.windows.count() $sParams = (StringLen($sParams) > 0) ? " " & $sParams : "" Local $iTimer = TimerInit() ; set a 5 minute timeout Local $iPID = Run($szCOMIE & $sParams & ' "' & $sURL & '"') While 1 $oWin = $oShell.windows() If $oWin.count() <> $nCount Then $nCount = $oWin.count() $oRet = $oWin($nCount - 1) If $oRet.TopLevelContainer Then ExitLoop EndIf If (TimerDiff($iTimer) / 1000) >= 300 Then ; timed out waiting, close IE instance ProcessClose($iPID) Return SetError($_IESTATUS_LoadWaitTimeout, 2, 0) EndIf Sleep(10) WEnd If Not $iVisible Then $iTakeFocus = 0 $oRet.visible = False EndIf If $iTakeFocus Then WinActivate($oRet.hwnd) EndIf If $iWait Then _IELoadWait($oRet) If @error Then Return SetError(@error, 3, $oRet) EndIf EndIf Return SetError($_IESTATUS_Success, 2, $oRet) EndFunc ;==>_IEJS_CreateWithParams 2014-12-21: IEJS.B003.zip 2014-12-23: IEJS.B004.zip 2014-12-29: IEJS.B005.zip 2014-12-30: IEJS.B006.zip
    1 point
×
×
  • Create New...