ShadowElf Posted October 17, 2013 Share Posted October 17, 2013 (edited) Hy all I try to make a web aplication with some "desktop" function basicaly are a web aplication, but when a link (button, image, etc) with a ID is clicked, to execute autoit function for example... in webpage www.autoitscript.com there is logo div with id="logo". I want when I click div logo to execute autoit function I have tried with _IEHeadInsertEventScript($oIE, "document", "onclick", "alert('Someone clicked the document!');") but it is an javascript alert and if it leaves the first page... the "alert" dissapear here is my code expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> _IEErrorHandlerRegister() $postaskbar = _GetTaskBarPos() ; open gui relative to taskbar height $inaltime=@DesktopHeight-(@DesktopHeight-$postaskbar[2])-30 ; height of gui Local $oIE = _IECreateEmbedded() GUICreate("XXX", @DesktopWidth, $inaltime, 0 , 0 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) GUICtrlCreateObj($oIE, 10, 20, @DesktopWidth-24, $inaltime-30) GUISetState() ;Show GUI _IENavigate($oIE, "http://www.autoitscript.com") _IEHeadInsertEventScript($oIE, "document", "onclick", "alert('Someone clicked the document!');") ; Waiting for user to close the window While 1 Local $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() Exit ;function to get taskbar size Func _GetTaskBarPos() Global Const $ABM_GETTASKBARPOS = 0x5 $h_taskbar = WinGetHandle("","Start") $AppBarData = DllStructCreate("dword;int;uint;uint;int;int;int;int;int") DllStructSetData($AppBarData,1,DllStructGetSize($AppBarData)) DllStructSetData($AppBarData,2,$h_taskbar) $lResult = DllCall("shell32.dll","int","SHAppBarMessage","int",$ABM_GETTASKBARPOS,"ptr",DllStructGetPtr($AppBarData)) If Not @error Then If $lResult[0] Then Return StringSplit(DllStructGetData($AppBarData,5) & "|" & _ DllStructGetData($AppBarData,6) & "|" & DllStructGetData($AppBarData,7) & "|" & _ DllStructGetData($AppBarData,8),"|") EndIf EndIf SetError(1) Return 0 EndFunc thanks a lot for any help UPDATE i put _IEHeadInsertEventScript($oIE, "logo", "onclick", "alert('Someone clicked the document!');") in loop and now I can navigate in site and onclick function is executed... but it is a javascript code... I want autoit function to be executed While 1 _IEHeadInsertEventScript($oIE, "logo", "onclick", "alert('Someone clicked the document!');") Local $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Edited October 17, 2013 by ShadowElf I like IT: php, mysql, codeingiter, css, jquery and AUTOIT Link to comment Share on other sites More sharing options...
DaleHohm Posted October 17, 2013 Share Posted October 17, 2013 See ObjEvent() Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Link to comment Share on other sites More sharing options...
ShadowElf Posted October 17, 2013 Author Share Posted October 17, 2013 thanks DaleHohm but I realy need an working example. I have read documentation but it is a little over my skill. what I try expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> _IEErrorHandlerRegister() $postaskbar = _GetTaskBarPos() ; open gui relative to taskbar height $inaltime=@DesktopHeight-(@DesktopHeight-$postaskbar[2])-30 ; height of gui Local $oIE = _IECreateEmbedded() GUICreate("XXX", @DesktopWidth, $inaltime, 0 , 0 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS + $WS_CLIPCHILDREN) GUICtrlCreateObj($oIE, 10, 20, @DesktopWidth-24, $inaltime-30) GUISetState() ;Show GUI _IENavigate($oIE, "http://www.autoitscript.com") $oIEEvents = ObjEvent($oIE, "alertt_") ; Waiting for user to close the window While 1 _IEHeadInsertEventScript($oIE, "logo", "onclick", "alert('Someone clicked the document!'); return false;") _IEHeadInsertEventScript($oIE, "document", "oncontextmenu", "return false;") $oIEEvents = ObjEvent($oIE, "alertt_") Local $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() Exit ;function to get taskbar size Func _GetTaskBarPos() Global Const $ABM_GETTASKBARPOS = 0x5 $h_taskbar = WinGetHandle("","Start") $AppBarData = DllStructCreate("dword;int;uint;uint;int;int;int;int;int") DllStructSetData($AppBarData,1,DllStructGetSize($AppBarData)) DllStructSetData($AppBarData,2,$h_taskbar) $lResult = DllCall("shell32.dll","int","SHAppBarMessage","int",$ABM_GETTASKBARPOS,"ptr",DllStructGetPtr($AppBarData)) If Not @error Then If $lResult[0] Then Return StringSplit(DllStructGetData($AppBarData,5) & "|" & _ DllStructGetData($AppBarData,6) & "|" & DllStructGetData($AppBarData,7) & "|" & _ DllStructGetData($AppBarData,8),"|") EndIf EndIf SetError(1) Return 0 EndFunc Func alertt_alert() MsgBox(4096, "demo", "demo", 10) EndFunc I like IT: php, mysql, codeingiter, css, jquery and AUTOIT Link to comment Share on other sites More sharing options...
ShadowElf Posted October 17, 2013 Author Share Posted October 17, 2013 (edited) I have read all day all google and all autoit forum. No answer - example to my problem. I will stop now and wait to help me someone if it is possible. I can pay for this... if it is a must. Edited October 17, 2013 by ShadowElf I like IT: php, mysql, codeingiter, css, jquery and AUTOIT Link to comment Share on other sites More sharing options...
ShadowElf Posted October 18, 2013 Author Share Posted October 18, 2013 I have posted an freelancer job with this problem. If some-one want to try... https://www.freelancer.com/projects/Software-Architecture/Autoit-task.html I like IT: php, mysql, codeingiter, css, jquery and AUTOIT Link to comment Share on other sites More sharing options...
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