Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/19/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
  2. Back to regex ConsoleWrite(Convert2Sec("01:01:30") & @CRLF) Func Convert2Sec($sTime) ;format HH:MM:SS, no error / validity check for input! Return Execute("'" & StringRegExpReplace($sTime, "(\d+):(\d+):(\d+)", "' & $1*3600+$2*60+$3 & '") & "'") EndFunc
    1 point
  3. A little simpler ConsoleWrite(Convert2Sec("00:01:30") & @CRLF) Func Convert2Sec($sTime) ;format HH:MM:SS, no error / validity check for input! Return 60^2 * StringSplit($sTime, ":")[1] + 60 * StringSplit($sTime, ":")[2] + StringSplit($sTime, ":")[3] EndFunc
    1 point
  4. Something like this here? ConsoleWrite(Convert2Sec("00:01:30") & @CRLF) Func Convert2Sec($sTime) ;format HH:MM:SS, no error / validity check for input! Return 60^2 * StringRegExpReplace($sTime, "(\d+):\d+:\d+", "$1") + 60 * StringRegExpReplace($sTime, "\d+:(\d+):\d+", "$1") + StringRegExpReplace($sTime, "\d+:\d+:(.+)", "$1") EndFunc Br, UEZ
    1 point
  5. EDIT: @jdelaney beat me to it I hit post at the same time. That said, this is a different way if you are not starting with a string. How do you get the original hrs, mins, secs that you want to covert? $hrs=2 $mins=5 $secs=10 func _convertToSecs($hrs,$mins,$secs) $hrSecs=$hrs*60*60 $minSecs=$mins*60 return $hrSecs+$minSecs+$secs EndFunc MsgBox("","",_convertToSecs($hrs,$mins,$secs))
    1 point
  6. $string = "00:01:30" $a = StringRegExp($string,"\d+",3) $iTime = 0 For $i = UBound($a)-1 To 0 Step -1 $iTime += $a[$i]*(60^(UBound($a)-1-$i)) Next ConsoleWrite($iTime & @CRLF)
    1 point
  7. SmOke_N

    IE_Create and vista

    IE version and mode you're running in? Edit: Also, AutoIt version being ran on the Vista? Edit2: UAC enabled / disabled? Anti-Virus software running...
    1 point
  8. Show us what the contents of the variables $totalshipments and $totalshipments2 contain. The exact contents, because even an extra space will cause it to not match.
    1 point
  9. Let me see I understand what you are saying here: You know you are not using the latest version of au3stripper. You still report this without testing first with the latest beta. You don't know if you will upgrade any time soon. Sweet, Jos
    1 point
  10. Take a look at the example for _IELinkGetCollection. Essentially, you are getting reference to the collection of all links, looping through, and when the .href = the .href of the link you want, clicking on it. See my modified example below; #include <IE.au3> $oIE = _IECreate("www.google.com") _IELinkGetCollection($oIE) Local $oLinks = _IELinkGetCollection($oIE) Local $iNumLinks = @extended MsgBox(0, "Link Info", $iNumLinks & " links found") For $oLink In $oLinks MsgBox(0, "Link Info", $oLink.href) If $oLink.href = "http://www.youtube.com/?tab=w1" Then ;click on the youtube link _IEAction($oLink, "click") ExitLoop EndIf Next EDIT: If this method doesn't work, you need to be more specific about your problem.
    1 point
×
×
  • Create New...