Hallo,
was meint ihr? Ist das hier mit AutoIt möglich?
https://developer.mozilla.org/en/Roll_your_o…embedding_HowTo
Hallo,
was meint ihr? Ist das hier mit AutoIt möglich?
https://developer.mozilla.org/en/Roll_your_o…embedding_HowTo
Auf was von der Seite beziehst du dich?
Nur die Layout-Engine, oder dieses ActiveX-Control weiterentwickeln, oder ...?
Und vor allem zu was?
_IECreateEmbedded()
_FFCreateEmbedded();das will er! (oder?)
Hat er ja nicht gesagt, nur auf eine Seite mit tausenderlei Möglichkeiten verwiesen - ich rate halt ungern.
Aber zu was braucht man den das? Also für welche ernsthafte Anwendung?
Um einen "Browser" zu basteln? =>
http://www.autoitscript.com/forum/index.php?showtopic=95595&view=findpost&p=712377
[EDIT]
Browser:
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <FF.au3>
Global $sHKLM = "HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox"
Global $sFFExe = RegRead($sHKLM & "\" & RegRead($sHKLM, "CurrentVersion") & "\Main", "PathToExe")
;main window
Global $hWnd
;FF window
Global $hWndFF
;Zoom value
Global $ZoomValue = 1.1
;window dimensions
Global $WGui = 640
Global $HGui = 580
Global $XBr = 10
Global $YBr = 80
Global $WBr = 620
Global $HBr = 490
Global $DefaultFolder = @ScriptDir & "\"
Global $StartURL = "www.google.com"
$hWnd = GUICreate ( "AFireFox", $WGui, $HGui,10, 10, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPCHILDREN)
_GUISetIcon($hWnd, $sFFExe, -3)
; get sizes of client area
$Rect = WinGetClientSize($hwnd)
; Create Buttons
$GUI_Home = GuiCtrlCreateButton("Home", 10, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Go to Home page")
$GUI_Back = GuiCtrlCreateButton("Back", 60, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Go to previous page")
$GUI_Forward = GuiCtrlCreateButton("Forward", 110,10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Go to next page")
$GUI_Stop = GuiCtrlCreateButton("Stop", 160, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Stop laoding")
$GUI_ZoomP = GuiCtrlCreateButton("(+)", 210, 10, 25, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Zoom in")
$GUI_ZoomM = GuiCtrlCreateButton("(-)", 235, 10, 25, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Zoom out")
$GUI_Reset = GuiCtrlCreateButton("Reset", 260, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
$GUI_Restore = GuiCtrlCreateButton("Restore", 310, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
$GUI_Search = GuiCtrlCreateButton("Search", 360, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Open Search dialog")
$GUI_Print = GuiCtrlCreateButton("Print", 410, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
$GUI_Config = GuiCtrlCreateButton("Config", 460, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Open Configuration dialog")
$GUI_About = GuiCtrlCreateButton("About", 510, 10, 50, 25)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "About FifeFox page")
; Create input control
$GUI_Input_Label = GuiCtrlCreateLabel("URL:", 30, 55, 30, 20)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
$GUI_Input = GuiCtrlCreateInput($StartURL, 65, 50, 295, 20)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
$GUI_Go = GuiCtrlCreateButton("Go", 365, 50, 50, 20)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Go to URL")
$GUI_Browse = GuiCtrlCreateButton("Browse", 420, 50, 50, 20)
GUICtrlSetResizing (-1, $GUI_DOCKALL)
GUICtrlSetTip(-1, "Browse file")
;=======================================
; Thanks to:
; http://www.autoitscript.com/forum/index.php?showtopic=95151
$Dum = GUICtrlCreateDummy()
Dim $Accels[1][2] = [["{ENTER}", $Dum]]
GUISetAccelerators($Accels)
GUISetState()
[/autoit] [autoit][/autoit] [autoit]$hWndFF = _FF_CreateEmbedded($hWnd, $XBr, $YBr, $WBr, $HBr)
[/autoit] [autoit][/autoit] [autoit]_FFOpenURL("about:blank")
[/autoit] [autoit][/autoit] [autoit]While True
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $GUI_Go or $msg = $Dum
$URL = GUICtrlRead($GUI_Input)
_FFOpenURL($URL)
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_About
_FFAction("About", "")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_Config
_FFOpenURL("about:config")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_Back
_FFAction("Back", "")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_Forward
_FFAction("Forward", "")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_Home
_FFAction("Home", "")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_Stop
_FFAction("Stop", "")
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
Case $msg = $GUI_ZoomP
$ZoomValue += 0.1
_FFAction("Zoom", $ZoomValue)
Case $msg = $GUI_ZoomM
If $ZoomValue > 0.5 then $ZoomValue -= 0.1
_FFAction("Zoom", $ZoomValue)
Case $msg = $GUI_Reset
_FFAction("Reset", "")
Case $msg = $GUI_Restore
TrickRestore()
Case $msg = $GUI_Search
_FFAction("Search", "")
WinActivate("[CLASS:MozillaDialogClass]","")
Case $msg = $GUI_Print
_FFAction("Print", "")
WinActivate("[CLASS:#32770]","")
Case $msg = $GUI_Browse
$URL = FileOpenDialog("Select any file to browse", @WorkingDir, "All files (*.*)", 1)
if not @error then
if StringInStr ($URL,'\') then $URL = _PathToURL($URL)
_FFOpenURL($URL)
$URL = _FFCmd(".location.href")
GUICtrlSetData($GUI_Input,$URL)
endif
EndSelect
$Rect_New = WinGetClientSize($hwnd)
if not @error and ($Rect_New[0] <> $Rect[0] or $Rect_New[1] <> $Rect[1]) then
$Rect = $Rect_New
WinMove($hWndFF, "", $XBr, $YBr, $rect[0] - 2*$XBr, $rect[1] - $YBr - $XBr)
endif
WEnd
;=============================
; take care!
; to escape error on close you should set
; pref option value "browser.tabs.warnOnClose" to false
$prefValue = "browser.tabs.warnOnClose"
_FFPrefSet($prefValue, "false")
;MsgBox(64, $prefValue, "Old value: " & @extended & @CrLf & "New value: " & _FFPrefGet($prefValue))
[/autoit] [autoit][/autoit] [autoit];and carefully close embedded FF window
WinClose($hWndFF)
_FFQuit()
GUIDelete()
exit
;===============================================================================
Func TrickRestore()
_FFOpenURL("about:blank")
_FFAction("Back", "")
EndFunc
;===============================================================================
Func _FF_CreateEmbedded($hGUI,$x, $y, $w, $h, $iTimeOut = 10000)
Local $OK
WinSetOnTop($hGUI,"",1)
[/autoit] [autoit][/autoit] [autoit]Run($sFFExe & ' -P "default" -new-window "about:blank"', "", @SW_HIDE)
Local $iTimeOutTimer = TimerInit()
While 1
Sleep(500)
If ProcessExists($_FF_PROC_NAME) Then ExitLoop
If (TimerDiff($iTimeOutTimer) > $iTimeOut) Then
MsgBox(0,"Error", "Browser process not exists!")
Return ""
EndIf
WEnd
Do
_FFConnect()
$OK = @error
If @error Then _FFDisConnect()
Until Not $OK
_FFWindowSelect()
[/autoit] [autoit][/autoit] [autoit]Local $hFF = _FFWindowGetHandle()
[/autoit] [autoit][/autoit] [autoit]; This doesn't work correctly!
; GUISetStyle(BitOR($WS_POPUP, $WS_SIZEBOX), $WS_EX_MDICHILD, $hFF)
; This one works!
_FFStyle($hFF, BitOR($WS_POPUP, $WS_SIZEBOX),$WS_EX_MDICHILD)
WinMove($hFF, "", $x, $y, $w, $h)
Do
_FFAction("pm", True)
Until Not @error
WinMove($hFF, "", $x, $y, $w, $h)
DllCall("user32.dll", "int", "SetParent", "hwnd", $hFF, "hwnd", $hGui)
WinSetOnTop($hGUI,"",0)
Return $hFF
EndFunc
;=================================================================================
; from
; http://www.autoitscript.com/forum/index.php?showtopic=96930
Func _GUISetIcon($hGui, $sModule, $iName)
GUISetIcon($sModule, $iName, $hGui)
[/autoit] [autoit][/autoit] [autoit]Local $a_hCall = DllCall("user32.dll", "lresult", "SendMessageW", _
"hwnd", $hGui, _
"dword", 0x007F, _; WM_GETICON
"wparam", 0, _; 1 = ICON_BIG, 0 = ICON_SMALL
"lparam", 0)
DllCall("user32.dll", "lresult", "SendMessageW", _
"hwnd", $hGui, _
"dword", 0x0080, _; WM_SETICON
"wparam", 1, _; 1 = ICON_BIG, 0 = ICON_SMALL
"lparam", $a_hCall[0])
EndFunc
[/autoit] [autoit][/autoit] [autoit];=================================================================================
; create URL for any files
Func _PathToURL($Path)
$Parts = StringSplit(StringStripWS($Path,3),"\")
$Res = "file:///"
if StringRight($Parts[$Parts[0]],4) = ".chm" then $Res = "chm:file://"
for $i = 1 to $Parts[0]
$Text = StringSplit(BinaryToString(StringToBinary($Parts[$i],4),1),"")
For $j = 1 To $Text[0]
$nChar = Asc($Text[$j])
Switch $nChar
Case 45, 46, 48 to 58, 65 To 90, 95, 97 To 122, 126
$Res &= $Text[$j]
Case Else
$Res &= "%" & Hex($nChar,2)
EndSwitch
Next
if $i <> $Parts[0] then $Res &= "%5C"
next
return $Res
EndFunc
;===================================
;Set FF window style
func _FFStyle($hWnd, $Style=-1, $ExStyle=-1)
local $GWL_STYLE = -16, $GWL_EXSTYLE = -20
;if $Style = -1 then $Style = BitOR($WS_POPUP, $WS_SIZEBOX)
if $Style = -1 then $Style = BitOR($WS_CHILD, $WS_SIZEBOX)
$res = DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_STYLE, "int", $Style)
if $ExStyle <> -1 then $res = DllCall("User32.dll", "int", "SetWindowLong", "hwnd", $hWnd, "int", $GWL_EXSTYLE, "int", $ExStyle)
DllCall("user32.dll", "int", "SetWindowPos", "hwnd", $hWnd, "hwnd", 0, "int", 0, "int", 0, "int", 0, "int", 0, "int", 0x47)
endfunc
Guten Tag,
Mal so als Frage. Wieso will das hier nicht funktionieren?
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
$oIE = ObjCreate("Mozilla.Browser.1")
; Create a simple GUI for our output
GUICreate ( "Embedded Web control Test", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX = GUICtrlCreateObj ( $oIE, 10, 40 , 600 , 360 )
$GUI_Button_Back = GuiCtrlCreateButton ("Back", 10, 420, 100, 30)
$GUI_Button_Forward = GuiCtrlCreateButton ("Forward", 120, 420, 100, 30)
$GUI_Button_Home = GuiCtrlCreateButton ("Home", 230, 420, 100, 30)
$GUI_Button_Stop = GuiCtrlCreateButton ("Stop", 330, 420, 100, 30)
GUISetState () ;Show GUI
[/autoit] [autoit][/autoit] [autoit]$oIE.navigate("about:")
[/autoit] [autoit][/autoit] [autoit]; Waiting for user to close the window
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
$oIE = 0
ExitLoop
Case $msg = $GUI_Button_Home
$oIE.navigate("http://www.autoitscript.com")
Case $msg = $GUI_Button_Back
$oIE.GoBack
Case $msg = $GUI_Button_Forward
$oIE.GoForward
Case $msg = $GUI_Button_Stop
$oIE.Stop
EndSelect
Wend
[/autoit] [autoit][/autoit] [autoit]GUIDelete ()
[/autoit] [autoit][/autoit] [autoit]Exit
[/autoit]Hab auch das Programm hier heruntergeladen und installiert.
Vielleicht weil das ActiveX Control nur bis FF V1.5 funktioniert?
Ähm funktionieren tut das schon, aber es navigiert nur nicht.
Ahja es funktioniert aber es geht nicht
Was denn nun?
Navigieren ist da ja alles Forward, Back, Stop ...
Also erstmal sry hab was falsch beschrieben. Bei diesem Script wird eine weiße Fläche bei mir erstellt (COM-Objekt). Das Problem daran ist, dass man damit keine Seite wie "www.google.de" öffnen kann.
#include <GUIConstants.au3>
#include <WindowsConstants.au3>
; Example: Embedding an Mozilla Object inside an AutoIt GUI
; Download Mozilla ActiveX Control
; from http://www.brothersoft.com/mozilla-active…load-78221.html
$Mozilla = ObjCreate("Mozilla.Browser.1") ; Get the Mozilla ActiveX instance
If Not IsObj($Mozilla) Then
MsgBox(0, "Mozilla", "Can't find Mozilla ActiveX Control")
EndIf
; Create a simple GUI for our output
GUICreate("Embedded Mozilla Test", 640, 580, (@DesktopWidth - 640) / 2, (@DesktopHeight - 580) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX = GUICtrlCreateObj($Mozilla, 10, 40, 600, 360)
$GUI_Button_Back = GUICtrlCreateButton("Back", 10, 420, 100, 30)
$GUI_Button_Forward = GUICtrlCreateButton("Forward", 120, 420, 100, 30)
$GUI_Button_Home = GUICtrlCreateButton("Home", 230, 420, 100, 30)
$GUI_Button_Stop = GUICtrlCreateButton("Stop", 330, 420, 100, 30)
GUISetState() ;Show GUI
[/autoit] [autoit][/autoit] [autoit]$Mozilla.navigate("http://www.autoitscript.com/forum/index.php?showtopic=95595") ;Klappt nicht -.-
;~ MsgBox(0, "", $Mozilla.Path())
; Waiting for user to close the window
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $GUI_Button_Home
$Mozilla.navigate("http://www.autoitscript.com/forum/")
Case $msg = $GUI_Button_Back
$Mozilla.GoBack
Case $msg = $GUI_Button_Forward
$Mozilla.GoForward
Case $msg = $GUI_Button_Stop
$Mozilla.Stop
EndSelect
WEnd
[/autoit] [autoit][/autoit] [autoit]$Mozilla = 0
GUIDelete()
Exit
[/autoit]Keine Ahnung hier funktioniert es - trotz Vista.
Ganz schön aufwendig - 169 Dateien für ein bisschen Fenster
Aber der komplette Zugriff auf FireFox wird wohl verwehrt bleiben, es hat die gleiche API wie der IE - also weit kommt damit nicht.
Bei dir funkioniert es? Wie sehen damit die Buttons auf Google aus? Acuh so kantig wie beim Iexplorer?
Unter Vista sehen die alle aus.
Aber es schon ein FF-Fenster, kannst ja mal als Adresse:
javascript:document.write(navigator.userAgent);
eingeben.
Nur dank IE-API gibts allerdings auch nur das Context-Menü vom IE .
[EDIT]
1111 Beitrag
bei mir kommt da:
[autoit]$Mozilla = ObjCreate("Mozilla.Browser.1") ; Get the Mozilla ActiveX instance
If Not IsObj($Mozilla) Then
MsgBox(0, "Mozilla", "Can't find Mozilla ActiveX Control")
EndIf
immer ein fehler das mozilla nicht installiert ist aber ich benutze immer mozilla und habe es auch installiert also keine Portable
Naja mich wundert eh, daß das stellenweise eh geht.
FF 2 hat das Dings immer mit einem Crash quitiert.
Offiziel wurde nur noch FF1.5 unterstützt:
http://www.iol.ie/~locka/mozilla/mozilla.htm
und das Mozillazine hat ausdrücklich davor gewarnt das Dings in neueren Versionen zu verwenden (funktionieren leider die Links gerade nicht)
Hi es ist wieder möglich mit Mozilla ActiveX Control 1.7.12
; *************************************************************************; Example: Embedding an Mozilla Object inside an AutoIt GUI; Standalone Mozilla ActiveX Control installers. Note these contain just; the control and the parts of Mozilla Gecko it needs to function.; It does not contain the full Mozilla browser.; Download Mozilla ActiveX Control; from: http://www.iol.ie/~locka/mozilla/control.htm; Version: http://www.iol.ie/~locka/mozilla/MozillaControl177.exe; *************************************************************************;#include #include $oFF = ObjCreate("Mozilla.Browser.1")
; Create a simple GUI for our outputGUICreate ( "Embedded Web control Test", 640, 580,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)$GUIActiveFF= GUICtrlCreateObj ( $oFF, 10, 40 , 600 , 360 )$GUI_Button_Back = GuiCtrlCreateButton ("Back", 10, 420, 100, 30)$GUI_Button_Forward = GuiCtrlCreateButton ("Forward", 120, 420, 100, 30)$GUI_Button_Home = GuiCtrlCreateButton ("Home", 230, 420, 100, 30)$GUI_Button_Stop = GuiCtrlCreateButton ("Stop", 330, 420, 100, 30)
GUISetState () ;Show GUI
$oFF.navigate("about:")
; Waiting for user to close the windowWhile 1$msg = GUIGetMsg()
SelectCase $msg = $GUI_EVENT_CLOSE$oFF = 0ExitLoopCase $msg = $GUI_Button_Home$oFF.navigate("http://www.autoitscript.com")Case $msg = $GUI_Button_Back$oFF.GoBackCase $msg = $GUI_Button_Forward$oFF.GoForwardCase $msg = $GUI_Button_Stop$oFF.StopEndSelect
Wend
GUIDelete ()
Exit
Cool das funzt sogar
Stilgar kann ich das i-wie in Kombination mit der Youtube-API verwenden?