Beiträge von SEuBo
-
-
Sorry, Flüchtigkeitsfehler:
Spoiler anzeigen
[autoit]Func _ScreenCapture_Capture($sFileName = "", $iLeft = 0, $iTop = 0, $iRight = -1, $iBottom = -1, $fCursor = True)
[/autoit] [autoit][/autoit] [autoit]
If $iRight = -1 Then $iRight = _WinAPI_GetSystemMetrics(0)
If $iBottom = -1 Then $iBottom = _WinAPI_GetSystemMetrics(1)
If $iRight < $iLeft Then Return SetError(-1, 0, 0)
If $iBottom < $iTop Then Return SetError(-2, 0, 0)Local $iW = $iRight - $iLeft
[/autoit] [autoit][/autoit] [autoit]
Local $iH = $iBottom - $iTop
Local $hWnd = _WinAPI_GetDesktopWindow()
Local $hDDC = _WinAPI_GetDC($hWnd)
Local $hCDC = _WinAPI_CreateCompatibleDC($hDDC)
Local $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iW, $iH)
_WinAPI_SelectObject($hCDC, $hBMP)
_WinAPI_BitBlt($hCDC, 0, 0, $iW, $iH, $hDDC, $iLeft, $iTop, 0x00CC0020)If $fCursor Then
[/autoit] [autoit][/autoit] [autoit]
Local $aCursor = _WinAPI_GetCursorInfo()
If $aCursor[1] Then
Local $hIcon = _WinAPI_CopyIcon($aCursor[2])
Local $aIcon = _WinAPI_GetIconInfo($hIcon)
_WinAPI_DeleteObject($aIcon[4]) ; delete bitmap mask return by _WinAPI_GetIconInfo()
_WinAPI_DrawIcon($hCDC, $aCursor[3] - $aIcon[2] - $iLeft, $aCursor[4] - $aIcon[3] - $iTop, $hIcon)
_WinAPI_DestroyIcon($hIcon)
EndIf
EndIf_WinAPI_ReleaseDC($hWnd, $hDDC)
[/autoit] [autoit][/autoit] [autoit]
_WinAPI_DeleteDC($hCDC)
If $sFileName = "" Then Return $hBMP_ScreenCapture_SaveImage($sFileName, $hBMP)
[/autoit]
_WinAPI_DeleteObject($hBMP)
EndFunc ;==>_ScreenCapture_CaptureWenn das auch nich klappt, geh ich in Rente.
-
*Ausbuddel*
Der Lösungsvorschlag hat leider nicht geholfen (wir hatten das ja bereits per PM besprochen.
Ich hab den Code mittlerweile so weit:
Spoiler anzeigen
[autoit]#include <Constants.au3>
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
#include <EditConstants.au3>
#include <GuiToolbar.au3>
#include <RichEditConstants.au3>
#include <SendMessage.au3>
#include <ToolbarConstants.au3>
#include <Array.au3>
#include <GuiRichEdit.au3>
#include <WindowsConstants.au3>
Global $bYellow ; If False, use Blue as next Color
Global $sIniPath = @AppDataDir & "\RegExpIt\Settings.ini"
Global $idNew, $idOpen, $idSave, $idHelp
$sString = "";~ If Not FileExists($sIniPath) Then ; Ini neu schreiben.
[/autoit] [autoit][/autoit] [autoit]
;~ IniWrite($sIniPath, "Genral Settings", "Resolution", "800x600")
;~ EndIf
$aGUIRes = StringSplit(IniRead($sIniPath, "General Settings", "Resolution", "800x600"), "x", 2)
$hGUI = GUICreate("RegExpIt", $aGUIRes[0], $aGUIRes[1], -1, -1)
GUISetFont(12)$hRE_RegExp = _GUICtrlRichEdit_Create($hGUI, '', 10, 10, 445, 120, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlRichEdit_SetFont($hRE_RegExp, 12)$hRE_Repl = _GUICtrlRichEdit_Create($hGUI, "", 460, 10, 320, 115, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL))
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlRichEdit_SetFont($hRE_Repl, 12)$hRE_TestString = _GUICtrlRichEdit_Create($hGUI, $sString, 10, 170, 780, 200, BitOR($ES_MULTILINE, $WS_VSCROLL, $WS_HSCROLL))
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlRichEdit_SetFont($hRE_TestString, 12)$hRE_Matches = _GUICtrlRichEdit_Create($hGUI, "", 10, 400, 780, 200, BitOR($ES_MULTILINE, $WS_VSCROLL, $WS_HSCROLL))
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlRichEdit_SetFont($hRE_Matches, 15)GUISetState(@SW_SHOW)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$hRepl = GUICtrlCreateCheckbox("Replace", 50, 370)
$hChildGUI = GUICreate("", $aGUIRes[0] * 0.95, 40, 10, 125, $WS_POPUP, $WS_EX_MDICHILD, $hGUI)
$hToolbar = _GUICtrlToolbar_Create($hChildGUI, $TBSTYLE_TRANSPARENT)
_GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)
_GUICtrlToolbar_AddButton($hToolbar, $idNew, $STD_FILENEW)
_GUICtrlToolbar_AddButton($hToolbar, $idOpen, $STD_FILEOPEN)
_GUICtrlToolbar_AddButton($hToolbar, $idSave, $STD_FILESAVE)
_GUICtrlToolbar_AddButtonSep($hToolbar)
_GUICtrlToolbar_AddButton($hToolbar, $idHelp, $STD_HELP)
GUISetState()
;~ GUISetBkColor(0xFF0000,$hChildGUI)While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit (GUIDelete($hGUI) = 0) ;GUI löschen, wegen RichEdit.
EndSwitch
If GUICtrlRead($hRepl) = 4 Then
_RichEdit_ApplyRegExp($hRE_RegExp)
_RichEdit_ApplyRegExp($hRE_TestString)
Else
_RichEdit_ApplyReplace($hRE_RegExp)
EndIf
WEndFunc _RichEdit_ApplyReplace(ByRef $hRichEdit)
[/autoit] [autoit][/autoit] [autoit]
If _GUICtrlRichEdit_IsModified($hRichEdit) Then
_GUICtrlRichEdit_SetModified($hRichEdit, False)
$sString = StringRegExpReplace(_RichEdit_GetText($hRE_TestString), _RichEdit_GetText($hRE_RegExp), _RichEdit_GetText($hRE_Repl))
If Not @error Then
__RichEdit_ColorViaRegExp($hRE_TestString)
_GUICtrlRichEdit_SetText($hRE_Matches, $sString)
Else
_GUICtrlRichEdit_SetText($hRE_Matches, "")
EndIf
_GUICtrlRichEdit_SetModified($hRE_Matches, False)
EndIf
EndFunc ;==>_RichEdit_ApplyReplaceFunc _RichEdit_ApplyRegExp(ByRef $hRichEdit)
[/autoit] [autoit][/autoit] [autoit]
If _GUICtrlRichEdit_IsModified($hRichEdit) Then
_GUICtrlRichEdit_SetModified($hRichEdit, False)
$sRegExp = _RichEdit_GetText($hRE_RegExp)
Switch $sRegExp
Case "", "\b"
Return
EndSwitch
$aTmp = StringRegExp(_RichEdit_GetText($hRE_TestString), $sRegExp, 3)
If Not @error And IsArray($aTmp) Then
_GUICtrlRichEdit_SetText($hRE_Matches, _ArrayToString($aTmp, @CRLF))
Global $bYellow = True$hFocus = __RichEdit_Hasfocus()
[/autoit] [autoit][/autoit] [autoit]
$aSel = _GUICtrlRichEdit_GetSel($hFocus) ; Get curren Cursor Pos.__RichEdit_ColorViaRegExp($hRE_Matches)
[/autoit] [autoit][/autoit] [autoit]
__RichEdit_ColorViaRegExp($hRE_TestString)_GUICtrlRichEdit_SetSel($hFocus, $aSel[0], $aSel[1]) ;restore Cursor Pos
[/autoit] [autoit][/autoit] [autoit]
Else
_GUICtrlRichEdit_SetText($hRE_Matches, "")
_RichEdit_ResetHighlighting($hRE_RegExp)
_RichEdit_ResetHighlighting($hRE_Matches)
_RichEdit_ResetHighlighting($hRE_TestString)
EndIf
EndIf
EndFunc ;==>_RichEdit_ApplyRegExpFunc _RichEdit_GetText($hWnd, $fCrToCrLf = False, $iCodePage = 0, $sReplChar = "")
[/autoit] [autoit][/autoit] [autoit]
If Not IsHWnd($hWnd) Then Return SetError(101, 0, "")
If Not IsBool($fCrToCrLf) Then Return SetError(102, 0, "")
If Not __GCR_IsNumeric($iCodePage) Then Return SetError(103, 0, "")Local $iLen = _GUICtrlRichEdit_GetTextLength($hWnd, False, True) + 1
[/autoit] [autoit][/autoit] [autoit]
Local $sUni = ''
If $iCodePage = $CP_UNICODE Or Not $iCodePage Then $sUni = "w"
Local $tText = DllStructCreate($sUni & "char[" & $iLen & "]")Local $tGetTextEx = DllStructCreate($tagGETTEXTEX)
[/autoit] [autoit][/autoit] [autoit]
DllStructSetData($tGetTextEx, "cb", DllStructGetSize($tText))Local $iFlags = 0
[/autoit] [autoit][/autoit] [autoit]
If $fCrToCrLf Then $iFlags = $GT_USECRLF
DllStructSetData($tGetTextEx, "flags", $iFlags)If $iCodePage = 0 Then $iCodePage = $CP_UNICODE
[/autoit] [autoit][/autoit] [autoit]
DllStructSetData($tGetTextEx, "codepage", $iCodePage)Local $pUsedDefChar = 0, $pDefaultChar = 0
[/autoit] [autoit][/autoit] [autoit]
If $sReplChar <> "" Then
Local $tDefaultChar = DllStructCreate("char")
$pDefaultChar = DllStructGetPtr($tDefaultChar, 1)
DllStructSetData($tDefaultChar, 1, $sReplChar)
Local $tUsedDefChar = DllStructCreate("bool")
$pUsedDefChar = DllStructGetPtr($tUsedDefChar, 1)
EndIf
DllStructSetData($tGetTextEx, "lpDefaultChar", $pDefaultChar)
DllStructSetData($tGetTextEx, "lpbUsedDefChar", $pUsedDefChar)Local $iRet = _SendMessage($hWnd, $EM_GETTEXTEX, DllStructGetPtr($tGetTextEx), DllStructGetPtr($tText))
[/autoit] [autoit][/autoit] [autoit]
If $iRet = 0 Then Return SetError(700, 0, "")
If $sReplChar <> "" Then SetExtended(DllStructGetData($tUsedDefChar, 1) <> 0)
Return DllStructGetData($tText, 1)EndFunc ;==>_RichEdit_GetText
[/autoit] [autoit][/autoit] [autoit]Func __RichEdit_ColorViaRegExp($hRichEdit)
[/autoit] [autoit][/autoit] [autoit]
$aTmp = StringRegExp(_RichEdit_GetText($hRE_TestString), _RichEdit_GetText($hRE_RegExp), 3)
_GUICtrlRichEdit_SetSel($hRichEdit, 0, -1, True)
_GUICtrlRichEdit_SetCharBkColor($hRichEdit, 0xFFFFFF)
If _RichEdit_GetText($hRE_RegExp) <> "" Then
Local $sText = _RichEdit_GetText($hRichEdit), $iCounter = 0
Global $bYellow = True
If $aTmp[0] = "" Then Return SetError(@error, @extended, "")
For $i = 0 To UBound($aTmp) - 1
$bYellow = Not $bYellow
Local $iPos = StringInStr($sText, $aTmp[$i], 1) - 1
_GUICtrlRichEdit_SetSel($hRichEdit, $iPos + $iCounter, $iPos + $iCounter + StringLen($aTmp[$i]), True)
If $bYellow Then _GUICtrlRichEdit_SetCharBkColor($hRichEdit, 0xFFF000)
If Not $bYellow Then _GUICtrlRichEdit_SetCharBkColor($hRichEdit, 0x80C0FF)
$sText = StringTrimLeft($sText, $iPos + 1)
$iCounter += $iPos + 1
Next
EndIf
_GUICtrlRichEdit_SetModified($hRichEdit, False)
EndFunc ;==>__RichEdit_ColorViaRegExpFunc __RichEdit_Hasfocus()
[/autoit] [autoit][/autoit] [autoit]
$iRet = ControlGetHandle($hGUI, "", ControlGetFocus($hGUI))
If Not @error Then Return $iRet
Return 0
EndFunc ;==>__RichEdit_HasfocusFunc _RichEdit_ResetHighlighting($hRichEdit)
[/autoit]
$hFocus = __RichEdit_Hasfocus()
ConsoleWrite($hFocus & @CRLF)
If $hFocus <> 0 Then
$aSel = _GUICtrlRichEdit_GetSel($hFocus)
_GUICtrlRichEdit_SetSel($hRichEdit, 1, -1, True)
_GUICtrlRichEdit_SetCharBkColor($hRichEdit, 0xFFFFFF)
_GUICtrlRichEdit_SetSel($hFocus, $aSel[0], $aSel[1])
_GUICtrlRichEdit_SetModified($hRichEdit, False)
_GUICtrlRichEdit_SetModified($hFocus, False)
EndIf
EndFunc ;==>_RichEdit_ResetHighlightingLeider habe ich das Problem bisher nicht lösen können.
Anderes Beispiel:
TestString ist "hallohallo".
Wir suchen nun nach "hallo$"
Gefunden wird von StringRegExp der zweite Teil (der, wo "hallo" ans Zeilenende grenzt.). StringInStr findet natürlich nur das erste Vorkommen, weil StringRegExp auch nur "hallo" zurückgibt.Hat einer eine Idee, wie ich dieses Problem in den Griff kriege?
-
Hallo,
Ersetze doch mal bitte testweise Zeile 65 und 66 durch das hier:
[autoit]
[/autoit]
If $iRight = -1 Then $iRight = _WinAPI_GetSystemMetrics(0)
If $iBottom = -1 Then $iBottom = _WinAPI_GetSystemMetrics(1) -
schick denen eine email mit Sourcecode & .exe.
In der Regel dauert es keine 48 Stunden, bis die dein Programm in der neuen Virendefinitionsdatei aufgenommen haben. Dann wirds nicht mehr erkannt. -
Ja, damit man ein Tabitem an einer bestimmten Position erstellen kann. Mit dem normalen GUICtrlCreateTabItem kann nur ein TabItem ans Ende angehängt werden. Über die UDF gehts auch so. Es hat alles seinen Zweck, aber du musst natürlich entscheiden, welcher Weg für dich am einfachsten und effektivsten ist.
Anderes Beispiel:
Mit GUICtrlCreateListViewItem("Spalte1|Spalte2|Spalte3") kann man direkt ein Listviewitem mit mehreren subitems erstellen. Mit der UDF muss man für das Item jedes SubItem einzelnd einfügen. (Code nicht korrekt, da nur ein Beispiel:)
_GUICtrlListview_AddItem("Spalte1")
_GUICtrlListview_AddsubItem("Spalte2",1)
_GUICtrlListview_AddsubItem("Spalte3",2)Du hast diverse Vorteile bei den UDF Funktionen (Mehr Freiraum für dein Programm), aber auch den Nachteil, dass du für manche Sachen mehr Code brauchst.
-
nur für Verständnis, wieso geht das aus der Hilfe nicht?
Gehen tut das schon. Macht aber alles unnötig kompliziert.
Spoiler anzeigen
[autoit]#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
[/autoit] [autoit][/autoit] [autoit]
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>Opt('MustDeclareVars', 1)
[/autoit] [autoit][/autoit] [autoit]$Debug_TAB = False ; Prüft den Klassennamen (ClassName), der an die Tab-Funktion übergeben wird. Setze dies versuchsweise auf True und verwende dann ein Handle zu einem anderen Control, um die Funktionsweise zu verstehen.
[/autoit] [autoit][/autoit] [autoit]_Main()
[/autoit] [autoit][/autoit] [autoit]Func _Main()
[/autoit] [autoit][/autoit] [autoit]
Local $hTab; Erstellt eine GUI
[/autoit] [autoit][/autoit] [autoit]
GUICreate("Tab-Control: Setzt die minimale Tabbreite", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState(); Fügt Tabs hinzu
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlTab_SetMinTabWidth($hTab, 80)
_GUICtrlTab_InsertItem($hTab, 0, "Tab 1")
_GUICtrlTab_InsertItem($hTab, 1, "Tab 2")
_GUICtrlTab_InsertItem($hTab, 2, "Tab 3")_GUICtrlTab_SetCurFocus($hTab, -1) ; Auswahl aufheben
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlTab_SetCurFocus($hTab, 0) ; 1 Tab wählen
GUICtrlCreateButton("Button auf Tab 1", 20, 50)
_GUICtrlTab_SetCurFocus($hTab, -1) ; Auswahl aufheben
_GUICtrlTab_SetCurFocus($hTab, 1) ; 2. Tab wählen
GUICtrlCreateButton("Button auf Tab 2", 50, 50)
_GUICtrlTab_SetCurFocus($hTab, -1) ; usw
_GUICtrlTab_SetCurFocus($hTab, 2)
GUICtrlCreateButton("Button auf Tab 3", 100, 100)_GUICtrlTab_SetCurFocus($hTab, -1)
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlTab_SetCurFocus($hTab, 0);wie erstelle ich einen Button im Tab 2
[/autoit] [autoit][/autoit] [autoit]; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst
[/autoit]
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main -
Mach doch mit GUICtrlCreateTabItem statt der _GUICtrlTab_InsertItem Funktion.
Spoiler anzeigen
[autoit]#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
[/autoit] [autoit][/autoit] [autoit]
#include <GuiConstantsEx.au3>
#include <GuiTab.au3>Opt('MustDeclareVars', 1)
[/autoit] [autoit][/autoit] [autoit]$Debug_TAB = False ; Prüft den Klassennamen (ClassName), der an die Tab-Funktion übergeben wird. Setze dies versuchsweise auf True und verwende dann ein Handle zu einem anderen Control, um die Funktionsweise zu verstehen.
[/autoit] [autoit][/autoit] [autoit]_Main()
[/autoit] [autoit][/autoit] [autoit]Func _Main()
[/autoit] [autoit][/autoit] [autoit]
Local $hTab; Erstellt eine GUI
[/autoit] [autoit][/autoit] [autoit]
GUICreate("Tab-Control: Setzt die minimale Tabbreite", 400, 300)
$hTab = GUICtrlCreateTab(2, 2, 396, 296)
GUISetState(); Fügt Tabs hinzu
[/autoit] [autoit][/autoit] [autoit]
_GUICtrlTab_SetMinTabWidth($hTab, 80)
GUICtrlCreateTabItem("Tab 1")
GUICtrlCreateTabItem("Tab 2")
GUICtrlCreateButton("Button", 50, 50)
GUICtrlCreateTabItem("Tab 3");wie erstelle ich einen Button im Tab 2
[/autoit] [autoit][/autoit] [autoit]; Die Schleife wiederholt sich, bis der Benutzer die Beenden-Aktion der GUI auslöst
[/autoit]
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main -
poste doch mal deinen code.
-
[autoit]
[/autoit]
;....
_IEFormSubmit($oForm) ; Form abschicken
_IELoadWait($oIE)
If StringInStr(_IEBodyReadHTML($oIE), 'Welcome to "Programm".') Then
MsgBox(0, "", "Erfolgreich eingeloggt.")
Else
MsgBox(0, "", "Fehler beim einloggen")
EndIf -
Eigentlich nicht, \w lässt den Umbruch auch aus.
\w = alphanumerische Zeichen
\W = Nicht alphanumerische Zeichen[\w\W] = Alphanumerische Zeichen + Nicht alphanumerische Zeichen = Alles.
-
Bitte poste auch die dazugehörigen dateien. Man kann das Script ja nichtmal starten. Mehrere Embedded IE Objekte gehen Problemlos.
Hier ist mal ein Browser Beispiel von mir: (Nur um zu zeigen, dass es funktioniert :P)
Spoiler anzeigen
[autoit]#include <IE.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <WindowsConstants.au3>_IEErrorHandlerRegister()
[/autoit] [autoit][/autoit] [autoit]Dim $aGUIArray[1][4]
[/autoit] [autoit][/autoit] [autoit]
Global $iSel = 0, $hDummy = GUICreate("")$hGUI = GUICreate("Browser Beispiel", 800, 600)
[/autoit] [autoit][/autoit] [autoit]
$hURL = GUICtrlCreateInput("about:blank", 200, 540, 400)
$hNTab = GUICtrlCreateButton("Tab +", 20, 540, -1, -1)
$hRTab = GUICtrlCreateButton("Tab -", 60, 540, -1, -1)
$hABack = GUICtrlCreateButton(" <- ", 140, 540, -1, -1)
$hANext = GUICtrlCreateButton(" -> ", 165, 540, -1, -1)$aGUIArray[0][0] = GUICtrlCreateButton("about:blank", 20, 570, -1, -1, 0x8000)
[/autoit] [autoit][/autoit] [autoit]
$aGUIArray[0][1] = GUICreate("Child GUI", 700, 510, 50, 20, 0x80000000, $WS_EX_MDICHILD, $hGUI)
$aGUIArray[0][3] = __IECreateEmbedded($aGUIArray[0][2])GUISetBkColor(0x000000, $hGUI)
[/autoit] [autoit][/autoit] [autoit]
GUISetBkColor(0xFF0000, $aGUIArray[0][1])
GUISetState(@SW_SHOW, $aGUIArray[0][1])
GUISetState(@SW_SHOW, $hGUI)While 1
[/autoit] [autoit][/autoit] [autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $hNTab
_Browser_TabAdd($aGUIArray)
_Browser_SyncURLBar()
Case $hURL
$oIE = _Browser_ReturnActiveObj()
_IENavigate($oIE, GUICtrlRead($hURL))
_Browser_SyncURLBar()
Case $hRTab
_Browser_TabRemove()
Case $hABack
$oIE = _Browser_ReturnActiveObj()
_IEAction($oIE,"back")
Case $hANext
$oIE = _Browser_ReturnActiveObj()
_IEAction($oIE,"forward")
EndSwitchFor $i = 0 To UBound($aGUIArray) - 1
[/autoit] [autoit][/autoit] [autoit]
If $nMsg = $aGUIArray[$i][0] Then
If $i = $iSel Then ContinueLoop 2
_Browser_AnimateChild($iSel, 0)
_Browser_AnimateChild($i, 1)
$iSel = $i
ExitLoop
EndIf
NextIf ControlGetHandle("", "", ControlGetFocus("")) <> GUICtrlGetHandle($hURL) Then
[/autoit] [autoit][/autoit] [autoit]
_Browser_SyncURLBar()
EndIf
WEndFunc __IECreateEmbedded(ByRef $_oIE)
[/autoit] [autoit][/autoit] [autoit]
$_oIE = _IECreateEmbedded()
$sObjCtrl = GUICtrlCreateObj($_oIE, 0, 0, 700, 510)
_IENavigate($_oIE, "about:blank")
Return $sObjCtrl
EndFunc ;==>__IECreateEmbeddedFunc _Browser_TabAdd(ByRef $aArray)
[/autoit] [autoit][/autoit] [autoit]
_Browser_AnimateChild($iSel, 0)
$iUbound = UBound($aArray)
$hSwitch = GUISwitch($hGUI)
ReDim $aArray[$iUbound + 1][4]
$aCPos = ControlGetPos($hGUI, "", $aArray[$iUbound - 1][0])
$aArray[$iUbound][0] = GUICtrlCreateButton("Tab " & $iUbound + 1, $aCPos[0] + $aCPos[2] + 5, 570, -1, -1, 0x8000)
$aArray[$iUbound][1] = GUICreate("Child GUI", 700, 510, 50, 20, 0x80000000, $WS_EX_MDICHILD, $hGUI)
$aArray[$iUbound][3] = __IECreateEmbedded($aArray[$iUbound][2])
_Browser_AnimateChild($iUbound, 1)
$iSel = $iUbound
GUISwitch($hSwitch)
EndFunc ;==>_Browser_TabAddFunc _Browser_TabRemove()
[/autoit] [autoit][/autoit] [autoit]
If UBound($aGUIArray) <= 1 Then Return
_Browser_AnimateChild($iSel, 0)
GUICtrlDelete($aGUIArray[$iSel][3])
GUIDelete($aGUIArray[$iSel][1])
GUICtrlDelete($aGUIArray[$iSel][0])
For $i = $iSel To UBound($aGUIArray) - 2
$aGUIArray[$i][0] = $aGUIArray[$i + 1][0]
$aGUIArray[$i][1] = $aGUIArray[$i + 1][1]
$aGUIArray[$i][2] = $aGUIArray[$i + 1][2]
$aGUIArray[$i][3] = $aGUIArray[$i + 1][3]
Next
ReDim $aGUIArray[UBound($aGUIArray) - 1][4]
If $iSel > 0 Then
$iSel -= 1
EndIf
ConsoleWrite($iSel & @CRLF)
_Browser_TabRepairSize()
_Browser_AnimateChild($iSel, 1)
EndFunc ;==>_Browser_TabRemoveFunc _Browser_ReturnActiveObj()
[/autoit] [autoit][/autoit] [autoit]
Return $aGUIArray[$iSel][2]
EndFunc ;==>_Browser_ReturnActiveObjFunc _Browser_AnimateChild($iIndex, $iFlag)
[/autoit] [autoit][/autoit] [autoit]
Switch $iFlag
Case 0
For $i = 255 To 0 Step -10
WinSetTrans($aGUIArray[$iIndex][1], "", $i)
Next
WinSetState($aGUIArray[$iIndex][1], "", @SW_HIDE)
Case 1
WinSetTrans($aGUIArray[$iIndex][1], "", 0)
WinSetState($aGUIArray[$iIndex][1], "", @SW_SHOW)
For $i = 0 To 255 Step 10
WinSetTrans($aGUIArray[$iIndex][1], "", $i)
Next
EndSwitch
EndFunc ;==>_Browser_AnimateChildFunc _Browser_SyncURLBar()
[/autoit] [autoit][/autoit] [autoit]
$oIE = _Browser_ReturnActiveObj()
$sUrl = _IEPropertyGet($oIE, "locationurl")
$sName = _IEPropertyGet($oIE, "locationname")
If $sUrl <> GUICtrlRead($hURL) Or ($sName <> GUICtrlRead($aGUIArray[$iSel][0]) AND StringLeft($sName, 15) & "..." <> GUICtrlRead($aGUIArray[$iSel][0])) Then
GUICtrlSetData($hURL, $sUrl)
$sText = $sName
If StringLen($sText) > 15 Then $sText = StringLeft($sText, 15) & "..."
GUICtrlSetData($aGUIArray[$iSel][0], $sText)
_Browser_TabRepairSize()
WinSetTitle($hGUI, "", $sName)
EndIf
EndFunc ;==>_Browser_SyncURLBarFunc _Browser_TabRepairSize()
[/autoit]
$hSwitch = GUISwitch($hDummy)
For $i = 0 To UBound($aGUIArray) - 1
$aCPos = ControlGetPos($hGUI, "", $aGUIArray[$i][0])
$hLableDummy = GUICtrlCreateButton(GUICtrlRead($aGUIArray[$i][0]), 0, 0, -1, -1)
$aCLPos = ControlGetPos($hDummy, "", $hLableDummy)
$aCPos[2] = $aCLPos[2]
ControlMove($hGUI, "", $aGUIArray[$i][0], $aCPos[0], $aCPos[1], $aCPos[2])
If $i = 0 Then ControlMove($hGUI, "", $aGUIArray[$i][0], 20, 570, $aCPos[2])
For $j = $i + 1 To UBound($aGUIArray) - 1
$aCTPos = ControlGetPos($hGUI, "", $aGUIArray[$j][0])
ControlMove($hGUI, "", $aGUIArray[$j][0], ($aCPos[0] + $aCPos[2] + 5), $aCTPos[1])
Next
Next
GUISwitch($hSwitch)
EndFunc ;==>_Browser_TabRepairSize -
-
Das hier als include: (alles ungetestet, nur im Texteditor schnell zusammenkopiert, weil ich bei nem kollegen sitze)
Spoiler anzeigen
[autoit]#include-once
[/autoit]
#Include<file.au3>
Global $oMyRet[2]
Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")
Func _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject = "", $as_Body = "", $s_AttachFiles = "", $s_CcAddress = "", $s_BccAddress = "", $s_Importance="Normal", $s_Username = "", $s_Password = "", $IPPort = 25, $ssl = 0)
Local $objEmail = ObjCreate("CDO.Message")
$objEmail.From = '"' & $s_FromName & '" <' & $s_FromAddress & '>'
$objEmail.To = $s_ToAddress
Local $i_Error = 0
Local $i_Error_desciption = ""
If $s_CcAddress <> "" Then $objEmail.Cc = $s_CcAddress
If $s_BccAddress <> "" Then $objEmail.Bcc = $s_BccAddress
$objEmail.Subject = $s_Subject
If StringInStr($as_Body, "<") And StringInStr($as_Body, ">") Then
$objEmail.HTMLBody = $as_Body
Else
$objEmail.Textbody = $as_Body & @CRLF
EndIf
If $s_AttachFiles <> "" Then
Local $S_Files2Attach = StringSplit($s_AttachFiles, ";")
For $x = 1 To $S_Files2Attach[0]
$S_Files2Attach[$x] = _PathFull($S_Files2Attach[$x])
ConsoleWrite('@@ Debug(62) : $S_Files2Attach = ' & $S_Files2Attach & @LF & '>Error code: ' & @error & @LF) ;### Debug Console
If FileExists($S_Files2Attach[$x]) Then
$objEmail.AddAttachment ($S_Files2Attach[$x])
Else
ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @LF)
SetError(1)
Return 0
EndIf
Next
EndIf
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = $s_SmtpServer
If Number($IPPort) = 0 then $IPPort = 25
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = $IPPort
;Authenticated SMTP
If $s_Username <> "" Then
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = $s_Username
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = $s_Password
EndIf
If $ssl Then
$objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
EndIf
;Update settings
$objEmail.Configuration.Fields.Update
; Set Email Importance
Switch $s_Importance
Case "High"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "High"
Case "Normal"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Normal"
Case "Low"
$objEmail.Fields.Item ("urn:schemas:mailheader:Importance") = "Low"
EndSwitch
$objEmail.Fields.Update
; Sent the Message
$objEmail.Send
If @error Then
SetError(2)
Return $oMyRet[1]
EndIf
$objEmail=""
EndFunc ;==>_INetSmtpMailCom
;
;
; Com Error Handler
Func MyErrFunc()
$HexNumber = Hex($oMyError.number,
$oMyRet[0] = $HexNumber
$oMyRet[1] = StringStripWS($oMyError.description, 3)
ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @LF)
SetError(1); something to check for when this function returns
Return
EndFunc ;==>MyErrFuncSo rufst du die Funktion auf:
Spoiler anzeigen
[autoit]$SmtpServer = "MailServer" ; address for the smtp-server to use - REQUIRED
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
$FromName = "Name" ; name from who the email was sent
$FromAddress = "your@Email.Address.com" ; address from where the mail should come
$ToAddress = "your@Email.Address.com" ; destination address of the email - REQUIRED
$Subject = "Userinfo" ; subject from the email - can be anything you want it to be
$Body = "" ; the messagebody from the mail - can be left blank but then you get a blank mail
$AttachFiles = "" ; the file you want to attach- leave blank if not needed
$CcAddress = "CCadress1@test.com" ; address for cc - leave blank if not needed
$BccAddress = "BCCadress1@test.com" ; address for bcc - leave blank if not needed
$Importance = "Normal" ; Send message priority: "High", "Normal", "Low"
$Username = "******" ; username for the account used from where the mail gets sent - REQUIRED
$Password = "********" ; password for the account used from where the mail gets sent - REQUIRED
$IPPort = 25 ; port used for sending the mail
$ssl = 0 ; enables/disables secure socket layer sending - put to 1 if using httpS
;~ $IPPort=465 ; GMAIL port used for sending the mail
;~ $ssl=1 ; GMAILenables/disables secure socket layer sending - put to 1 if using httpS$rc = _INetSmtpMailCom($SmtpServer, $FromName, $FromAddress, $ToAddress, $Subject, $Body, $AttachFiles, $CcAddress, $BccAddress, $Importance, $Username, $Password, $IPPort, $ssl)
[/autoit]
If @error Then
MsgBox(0, "Error sending message", "Error code:" & @error & " Description:" & $rc)
EndIf
Nein, du brauchst KEINE Variablen zu benutzen, sondern kannst die Daten auch direkt so eintragen...Zitat2. Was hat die Funktion eigentlich für einen Rückgabewert (Bei Erfolg und bei Fehler)? Und wie sieht es mit dem error handling der Funktion aus (@error)? Sehe das irgendwie nicht.
@error 1: Dateianhang nicht gefunden.
@error 2: Fehler beim Senden
Ansonsten ist noch ein Error Handler für die Com-Events eingebaut.@andere Frage:
WinSetState("Fenster","",@SW_MINIMIZE) ? -
Schau dir mal das Hilfebeispiel zu
[autoit]_IEFormElementSetValue()
[/autoit]an.
//EDIT:
[autoit]
so sollte es aussehen:_IENavigate($oIE,"http://mybralogin.pytalhost.com/System/User/Test/login.php")
[/autoit]
;Die daten holt man am besten Per Web Developer Toolbar, oder per FireBug ( FF-Addons )
$oForm = _IEFormGetCollection($oIE,0) ; Formular durch Index ansprechen ( Index: 0 )
$oName = _IEFormElementGetObjByName($oForm,"username") ; Feld für Username in Objektvariablen speichern
$oPass = _IEFormElementGetObjByName($oForm,"passwort") ; gleiches für das Passwort Feld.
_IEFormElementSetValue($oName,GUICtrlRead($Input1)) ; werte eintragen
_IEFormElementSetValue($oPass,GUICtrlRead($Input2)) ; " "
_IEFormSubmit($oForm) ; Form abschicken -
Vielleicht hat er die Funktionen kombiniert z.B. so:
irgendwie bezweifel ich das.
-
[autoit]
If ControlGetHandle("","",ControlGetFocus("")) = GUICtrlGetHandle($hEdit) Then
[/autoit]
;...
EndIfoder direkt als Funktion
[autoit]
[/autoit][autoit][/autoit][autoit]
If _ControlHasFocus($hEdit) Then
;...
EndIfFunc _ControlHasFocus($CtrlID)
[/autoit]
If ControlGetHandle("", "", ControlGetFocus("")) = GUICtrlGetHandle($CtrlID) Then Return True
Return False
EndFunc ;==>_ControlHasFocus -
Weil diese Zeichen keine besondere Bedeutung haben. Ausschließlich die 11 aufgeführten Zeichen haben eine Doppelfunktion und müssen deshalb maskiert werden.Vielleicht hab ich ja was übersehen, aber {...} wird 1. zur Quantifizierung, und 2. zum "trennen" von Backreferenze und richtigen Zahlen verwendet.
Ansonsten kannst du mir aber mal sagen, warum das hier nicht funktioniert:
[autoit]MsgBox(0,"",_Search_LIKE("test{2}","t__t{2}"))
[/autoit]Bzw. warum das hier funktinoiert (was es ja eigenltich nicht sollte )
[autoit]MsgBox(0,"",_Search_LIKE("tt","t{2}"))
[/autoit]Außerdem: Wenn du schon [ maskierst, solltest du das auch mit ] machen.
Sonst versuchst du ja im RegExp eine Zeichenklasse zu schließen, die nie geöffnet wurde.
Ich bin mir fast sicher, dass das auch zu Laufzeitfehlern im RegExp führen wird. -
Für den Fall, dass sich noch etwas anderes hinter die Video-ID schlängelt (zb.: &feature=related), dann gehts auch so:
[autoit]$sString = "http://www.youtube.com/watch?v=Tg2dxqZQ84w&feature=related"
[/autoit]
$aResult = StringRegExp($sString,"(?<=v=)[^&]+",3)
MsgBox(0,"",$aResult[0]) -
Coole Sache. Wenn man RegExp kann ist das allerdings relativ unnötig
Rein interessehalber: Warum ist denn ']' nicht bei den Metachars?
Und was ist mit '{' und '}' ?