Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/02/2019 in all areas

  1. try this way... #include <IE.au3> HotKeySet("{ESC}", "_Close") _IEErrorHandlerRegister(_ErrFunc) $oIE = _IECreateEmbedded() $hGui = GUICreate("Test", 700, 500, -1, -1) GUICtrlCreateObj($oIE, 0, 0, 700, 500) _IENavigate($oIE, "about:blank") $sHTML = "" $sHTML &= "<html>" $sHTML &= "<head>" $sHTML &= "<title>Test</title>" $sHTML &= "</head>" $sHTML &= "<body>" $sHTML &= '<button type="button" id="btnMenu">=</button>' $sHTML &= '<button type="button" id="btnClose">X</button>' $sHTML &= "</body>" $sHTML &= "</html>" _IEDocWriteHTML($oIE, $sHTML) _IEAction($oIE, "refresh") GUISetState() ; ------------------------------------------------------------------------------- ; inject a reference to the javascript global object into the WebBrowser document ; this works for the BrowserControl, but it doesn't on the IE browser ; ; http://perfectionkills.com/unnecessarily-comprehensive-look-into-a-rather-insignificant-issue-of-global-objects-creation/#ecmascript_5_strict_mode $oIE.document.parentwindow.setTimeout("JSglobal = (1,eval)(""this"");", 0) Local $ohJS Do Sleep(1000) $ohJS = Execute('$oIE.document.parentwindow.JSglobal') Until IsObj($ohJS) ; getting references to javascript objects in this way will then work on ObjEvent $oButtonMenu = $ohJS.btnMenu ;_IEGetObjById($oIE, "btnMenu") $oButtonClose = $ohJS.btnClose ; _IEGetObjById($oIE, "btnClose") ; ------------------------------------------------------------------------------- $oEvent = ObjEvent($oButtonMenu, "_MY_EVENT_HANDLER_", "HTMLButtonElementEvents2") $oEvent2 = ObjEvent($oButtonClose, "_MY_EVENT_HANDLER_", "HTMLButtonElementEvents2") While (1) Sleep(20) WEnd Volatile Func _MY_EVENT_HANDLER_onclick($oEventObj) ; https://msdn.microsoft.com/en-us/library/aa703876(v=vs.85).aspx MsgBox(4096, "Yay!", "You clicked the button. But which one ? this ID --> " & $oEventObj.srcElement.id) EndFunc ;==>_MY_EVENT_HANDLER_onclick Func _Close() ; the end $oEvent.stop $oEvent2.stop $oEvent = 0 $oEvent2 = 0 $oIE = 0 ; Remove IE from memory GUIDelete($hGui) ; Remove GUI Exit EndFunc ;==>_Close Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc p.s. For another example of use for the WebControl, have a look to this script also... (https://www.autoitscript.com/forum/topic/186422-who-is-who-a-little-dragdrop-game/)
    2 points
  2. I need to read windows push notifications, but I'm at a loss. I've captured them with this code, however I cannot find any controls inside the window to read. #include <APISysConstants.au3> #include <WinAPISysWin.au3> Global $gui = GUICreate( '' ) GUIRegisterMsg( _WinAPI_RegisterWindowMessage( "SHELLHOOK" ), "WM_SHELLHOOK" ) _WinAPI_RegisterShellHookWindow( $gui ) OnAutoItExitRegister('OnAutoItExit') While 1 Sleep( 10 ) WEnd Func WM_SHELLHOOK( $hWnd, $iMsg, $wParam, $lParam ) #forceref $iMsg Switch $hWnd Case $gui Local $title = WinGetTitle( $lParam ) Switch $wParam Case $HSHELL_REDRAW If IsString( $title ) Then If $title == "New notification" Then Local $data = "" ; ?? ConsoleWrite( "Notification: " & $data & @CRLF ) EndIf EndIf EndSwitch EndSwitch EndFunc Func OnAutoItExit() _WinAPI_DeregisterShellHookWindow($gui) EndFunc
    1 point
  3. mikell

    help with regex

    #include<array.au3> local $a[0][3] Global $STRUCT1 = "Struct;char host[128];char sudo[128];char user[128];char pass[128];char path[256];char cmd[128];int code;EndStruct" _ArrayAdd($a , StringRegExpReplace(StringRegExpReplace(StringRegExpReplace($STRUCT1, ';?(End)?Struct;?', ""), '\]?;', @crlf) , '[ \[]', "|") ) _ArrayDisplay($a) Edit The new smileys are *awful*
    1 point
  4. borsTiHD, Well done - excellent detective work. Now looking into it. M23
    1 point
  5. Of course always glad to help! Good Luck!
    1 point
  6. ? what's wrong with Run () Run(".\abc.d")
    1 point
  7. Here is another method following the same logic as jchd's example. #include <String.au3> Local $str = _ "WORD_1 : RESULT_1" & @CRLF & _ "ANYLETTER_2 : RESULT_2" & @CRLF & _ "WORDNEXT_3 : RESULT_3" & @CRLF & _ "SOMEWORDMORE_4 : RESULT_4" & @CRLF & _ "ONLY_5 : RESULT_6" Global $max = 0 Execute(StringRegExpReplace($str, "(?m)(\w+)(\h+.+\v*)", '__MaxLen(''$1'')& ') & "''") ; Get maximium number of characters of the first word in all lines. ;ConsoleWrite($max & @CRLF) Local $sFormated = Execute(StringRegExpReplace($str, "(\w+)(\h+:\h+)(\w+\v*)", "'$1'&_StringRepeat(' ', $max - StringLen('$1'))& ' : $3'&") & "''") ConsoleWrite($sFormated & @CRLF) Func __MaxLen($sWord) If StringLen($sWord) > $max Then $max = StringLen($sWord) EndFunc ;==>__MaxLen And, an abbreviation of the above script. ; https://www.autoitscript.com/forum/topic/197984-regexp-replace-insert-whitespace/?do=findComment&comment=1420097 Local $str = _ "WORD_1 : RESULT_1" & @CRLF & _ "ANYLETTER_2 : RESULT_2" & @CRLF & _ " WORDNEXT_3 : RESULT_3 " & @CRLF & _ "SOMEWORDMORE_4 : RESULT_4" & @CRLF & _ "ONLY_5 : RESULT_6" Local $max = 0 ; Get $max, the maximium number of characters of the first word in all lines. Execute(StringRegExpReplace($str, "(\w+).+\v*", '(Stringlen(''$1'')>$max?Assign("max",Stringlen(''$1'')):"")&') & "''") ;ConsoleWrite($max & @CRLF) Local $sFormatted = Execute(StringRegExpReplace($str, "(\w+)\h*:\h*(\w+.*\v*)", 'StringFormat("%-"&$max&"s : %s","$1","$2")&') & "''") ConsoleWrite($sFormatted & @CRLF)
    1 point
  8. Subz

    Array sum values in colom

    Basic example: #include <Array.au3> Local $aArray[3][2] = [[2, ""],[1,5],[3,1]] ConsoleWrite(Execute(_ArrayToString($aArray, "", 1, -1, "+", 1, 1)) & @CRLF)
    1 point
  9. This might work. Local $str = 'I need to find dates such as "31-01-2018" and "21-02-2018"' & @CRLF & _ ' 13-3-2018 and "1-4-2018"' Local $aMnth[13] = [12, "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"] Local $sModifiedStr = Execute("'" & StringRegExpReplace($str, "(\d{1,2}).(\d{1,2}).(\d{2,4})", "'&$1&'-'&$aMnth[$2]&'-$3") & "'") ; Or ;Local $sModifiedStr = Execute("'" & StringRegExpReplace($str, "(\d{1,2}).(\d{1,2}).(\d{2,4})", "'&StringRight('00'&$1,2)&'-'&$aMnth[$2]&'-$3") & "'") ; One digit day (n) to two digit day (0n). ConsoleWrite($sModifiedStr & @CRLF)
    1 point
  10. Try this : Opt ("MustDeclareVars", 1) #include <IE.au3> Local $oIE = _IECreate("https://www.hpba.org/Membership/Organization-Search/Organization-Profile/orgcd/111773") Local $cFrames = _IEFrameGetCollection ($oIE) Local $iNumFrames = @extended Local $sTxt = $iNumFrames & " frames found" & @CRLF & "Error = " & @error & @CRLF ; MsgBox (0,"",$sTxt) Local $oFrame = 0 $oFrame = _IEFrameGetCollection($oIE, 0) Local $cTags = _IETagNameGetCollection ($oFrame, "dd") Local $sInfo = "", $sTag, $iS For $oTag in $cTags $sTag = $oTag.innerText $iS = StringInStr ($sTag,"; }",0,-1) if $iS then $sTag = StringMid($sTag,$iS+4) $sInfo &= $sTag & @CRLF Next MsgBox (0,"",$sInfo) _IEQuit($oIE)
    1 point
  11. borsTiHD, It's almost impossible just to point out the cause of the problem. But I'm pretty sure the problem can't be solved in GUIListViewEx.au3. You need to look for the problem in your own code. So the problem is that $NM_CUSTOMDRAW notifications sent from the operating system to the header control do not work because the return values do not reach the parent control, ie. the listview control. $CDDS_PREPAINT notifications are correctly sent from the operating system, but $CDRF_NOTIFYITEMDRAW return values do not reach the listview control. This means that the subsequent $CDDS_ITEMPREPAINT and $CDDS_ITEMPOSTPAINT are simply not generated by the operating system. The consequence is that custom draw functionality does not work in the header control. Only the default functionality works. Ie. there are only default colors. It's probably not just $NM_CUSTOMDRAW notifications that do not work, but all notifications. In the header control there is only default functionality with respect to the functionality that's controlled by notifications. To figure out the cause of the problem you have to do some proper debugging. There are two easy methods you can use. One is to copy code from your original script to a new blank script. Start by just copying the GUI itself, the listview and the GUIListViewEx.au3 functionality. When you run the script you should see a fully functional listview that also has colors in the header control. Then you copy features one at a time from the original script to the new one and test after each feature. When the header colors are missing, you know which feature is causing the problem. From there you can then try to solve the problem. Another method is to make a copy of the original script, and then delete features one at a time and test after each deleted feature. When the colors appear in the header control, you have identified the problem. Lars.
    1 point
  12. borsTiHD, No idea I am afraid. M23 Edit: But I have just reached out to someone who might....
    1 point
  13. Recently i had the same problem, but it's not a Wrapper's bug - the reason in OS, move your exe to another location or rename it and you will see changing icon.
    1 point
×
×
  • Create New...