1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. philipp

Beiträge von philipp

  • SMTP E-Mail Funktion funktioniert nicht!

    • philipp
    • 19. August 2014 um 17:37

    Hallo,

    folgende Funktion geht einfach nicht, mach ich irgendwas falsch???

    [autoit]

    #include <File.au3>

    [/autoit][autoit][/autoit][autoit]

    $SmtpServer = "mail.gmx.net" ; address for the smtp-server to use - REQUIRED
    $FromName = "Name" ; name from who the email was sent
    $FromAddress = "*@yahoo.de" ; address from where the mail should come
    $ToAddress = "*@outlook.de" ; destination address of the email - REQUIRED
    $Subject = "test" ; subject from the email - can be anything you want it to be
    $Body = "test" ; 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 = "" ; address for cc - leave blank if not needed
    $BccAddress = "" ; 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

    [/autoit][autoit][/autoit][autoit]

    Global $x = 0
    Global $oMyRet[2]
    Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc")

    [/autoit][autoit][/autoit][autoit]

    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 & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
    If FileExists($S_Files2Attach[$x]) Then
    $objEmail.AddAttachment($S_Files2Attach[$x])
    Else
    ConsoleWrite('!> File not found to attach: ' & $S_Files2Attach[$x] & @CRLF)
    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, 8)
    $oMyRet[0] = $HexNumber
    $oMyRet[1] = StringStripWS($oMyError.description, 3)
    ConsoleWrite("### COM Error ! Number: " & $HexNumber & " ScriptLine: " & $oMyError.scriptline & " Description:" & $oMyRet[1] & @CRLF)
    SetError(1); something to check for when this function returns
    Return
    EndFunc ;==>MyErrFunc

    [/autoit]

    und die nächste Funktion auch nicht!

    [autoit]

    #include <INet.au3>

    [/autoit][autoit][/autoit][autoit]

    Local $s_SmtpServer = "smtp.mail.yahoo.com"
    Local $s_FromName = "Name"
    Local $s_FromAddress = "*@yahoo.de"
    Local $s_ToAddress = "*@hotmail.de"
    Local $s_Subject = "test"
    Local $as_Body = "test"
    Local $Response = _INetSmtpMail($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, "EHLO " & @ComputerName ,-1,1)
    Local $err = @error
    If $Response = 1 Then
    MsgBox(0, "Erfolg!", "Die E-Mail wurde versandt")
    Else
    MsgBox(0, "Fehler!", "Das versenden der E-Mail schlug fehl. Fehlercode: " & $err)
    EndIf

    [/autoit]

    Die erste schließt sich immer sofort wieder also hat gerade einmal eine Dauer von 200 Millisekunden. Die zweite gibt immer den Fehlercode 51 aus.. Gibt es noch eine weitere Methode eine EMail zu senden?

    Lg Phil-IT

  • ID Programm zeigt Fehler bei Go

    • philipp
    • 19. August 2014 um 11:40

    Du kannst versuchen nach dem _FileListToArray(...) eine If @error Überprüfung

    [autoit]

    $List = _FileListToArray(...)
    If Not @error Then
    For $i = 1 To $List [0]
    ...
    Next
    EndIf

    [/autoit]


    zu verwenden. Es sieht so aus als würde es den Pfad in deinem _FileListToArray(...) nicht geben!

  • _FTP_* File Up- und Download funktionieren nicht!

    • philipp
    • 19. August 2014 um 11:31
    Zitat von traumhaeftling

    Hab dein Edit gar nicht gesehen, sorry :)


    Habs doch extra an den Anfang gesetzt damit sich nicht jeder erst alles durchlesen muss:D naja, danke tdm..

  • _FTP_* File Up- und Download funktionieren nicht!

    • philipp
    • 19. August 2014 um 10:41

    Darum ging es aber nicht weil ich nur den Beispiel Code aus autoitscript.com ein wenig umgeformt hab! Aber gut, ich hab ja gelöst..

  • _FTP_* File Up- und Download funktionieren nicht!

    • philipp
    • 18. August 2014 um 23:53

    Hallo,

    *EDIT: Parameter Passive mal auf 1 gesetzt und schon gehts! Weiß nicht genau wofür der gut ist aber hat geholfen mal die Params genauer anzusehen!;D

    ich wollte heute versuchen in ein Script eine 'Update'-Funktion einzubauen, das heißt einen Updater der einfach prüft ob in einer Datei namens 'Update.txt' ein Schlüsselbegriff steht das ihm sagt eine neue Datei runterzuladen. Doch weder der Blick in diese Datei, noch ein File Up- und Download funktionierten. Ich habe alles mögliche versucht aber irgendwie will es einfach nicht. Was auch sehr seltsam ist, wenn ich einen Fileupload starte, und meinen Serverpfad bei Filezilla beobachte, erstellt sich eine Datei, soetwas wie eine Temp. Datei denke ich, aber sobald es abgeschlossen ist, verschwindet die Datei und die Upload datei ist nicht vorhanden! Beim Filedownload soziemlich das selbe, ich wollte die 'index.html' downloaden, zum Test, diese erstellt sich, beim beenden des Scripts (automatisch weil danach kein Code mehr kommt) löscht sie sich jedoch wieder!

    Kann mir evtl. jemand behilflich sein, hatte schonmal jemand das gleiche Problem?

    Lg Phil-IT

  • CMD Output speichern als Unicode

    • philipp
    • 18. August 2014 um 23:35

    Machs doch so, nicht die beste Möglichkeit, aber wenigstens eine;)

    *EDIT: Ups da war wohl jemand schneller:D

    [autoit]

    #include <Constants.au3>

    [/autoit][autoit][/autoit][autoit]

    $old = ClipGet()
    $read = _CMDRead('Tree "Z:\test" |clip')
    ;~ ConsoleWrite($read)
    $hFile = FileOpen('Tree-Output.txt', 2+32)
    FileWrite($hFile, ClipGet())
    FileClose($hFile)
    ClipPut($old)

    [/autoit][autoit][/autoit][autoit]

    Func _CMDRead($command)
    Local $line

    [/autoit][autoit][/autoit][autoit]

    $CMD = Run(@ComSpec & " /c " & $command, @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)

    [/autoit][autoit][/autoit][autoit]

    While 1
    $line &= StdoutRead($CMD)
    If @error Then ExitLoop
    WEnd
    Return $line
    EndFunc

    [/autoit]
  • Compiled.exe beendet sich sofort wieder, läuft aber im Hintergrund weiter

    • philipp
    • 15. August 2014 um 15:56

    Was willst du denn erreichen? Also dein Programm soll via CMD aufgerufen werden, und dann was bestimmtes in die CMD schreiben? Mach das doch mit einem weiteren Batch Script:

    Code
    @echo off
    echo Hallo Welt!

    Batch ist viel angenehmer wenn es um Console und so geht!

  • Datumsabfrage

    • philipp
    • 14. August 2014 um 11:33

    Ich würde es mit einem GUICtrlCreateDate machen, viel einfacher und bessere Styles.. Hab mal schnell ein vielleicht für dich passendes Script geschrieben:

    [autoit]

    #include <GUIConstants.au3>

    [/autoit][autoit][/autoit][autoit]

    date()
    Func date()
    GUICreate("Datum", 230, 110, -1, -1, -1, $WS_EX_TOOLWINDOW)
    GUISetFont(11, 400, 1, "Calibri")
    GUISetBkColor(0x808080)
    GUICtrlCreateLabel("Datum auswählen:", 10, 10, 150)
    GUICtrlSetFont(-1, 12, 400, 1, "Calibri")
    $date = GUICtrlCreateDate(@YEAR & "/" & @MON & "/" & @MDAY, 10, 40, 210, 22);, $DTS_SHORTDATEFORMAT)
    $cancel = GUICtrlCreateButton("Abbrechen", 8, 80, 102, 22)
    $ok = GUICtrlCreateButton("Auswählen", 120, 80, 102, 22)
    GUISetState()

    While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or $msg = $cancel Then
    Exit
    ElseIf $msg = $ok Then
    $yn = MsgBox(4, "Ausgewählt!", "Folgendes Datum ist ausgewählt: " & @CRLF & GUICtrlRead($date) & @CRLF & "Ist das richtig?")
    If $yn = 6 Then
    Exit
    EndIf
    EndIf
    WEnd
    EndFunc

    [/autoit]
  • GUICtrlCreatePic(...) Fehler bei Variable als Höhe

    • philipp
    • 13. August 2014 um 21:46

    Ok ich habe selbst eine Lösung gefunden: AutoItScript.com machts möglich!:D einfach 0 als höhe sowie als breite angeben, damit die original größen verwendet werden, und die position ist dann auch egal.. ;)

  • GUICtrlCreatePic(...) Fehler bei Variable als Höhe

    • philipp
    • 13. August 2014 um 21:37

    Hi,

    ich hab was versucht um ein Bild in einer gui genau mittig anzuzeigen, und dafür halt zosusagen die Höhe von dem bild ausgelesen und damit ausrechnen lassen... Aber es scheitert einfach daran, dass das programm die variable nicht annimmt. wenn ich diese mit ner MsgBox oder so ausgebe passt das optimal aber GUICtrlCreatePic kommt damitn icht klar. Hier der Code:

    [autoit]

    #include <GUIConstants.au3>
    #include <GDIPlus.au3>

    [/autoit][autoit][/autoit][autoit]

    main()
    Func main()
    $file = @ScriptDir & "\Bild1.jpg"
    GUICreate("Bild", 320, 350)
    GUISetBkColor(0xFFFFFF)
    $pic = GUICtrlCreatePic($file, 10, _GetY($file, 300, 1), 300, _GetY($file, 300, 0))
    GUISetState()

    While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
    Exit
    EndIf
    WEnd
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func _GetY($file, $height, $dim)
    _GDIPlus_Startup()
    $load = _GDIPlus_ImageLoadFromFile($file)
    If $dim = 0 Then
    Return _GDIPlus_ImageGetHeight($load)
    ElseIf $dim = 1 Then
    Return ($height - _GDIPlus_ImageGetHeight($load))/2
    EndIf
    _GDIPlus_Shutdown()
    EndFunc

    [/autoit]
  • WLAN Hotspot Programm

    • philipp
    • 3. August 2014 um 17:21

    Ich weiß, danke trotzdem. Ich bin gerade dabei das ganze ein bisschen auf Schnelligkeit auszureizen:D Mein Ersatz sieht so aus:

    [autoit]


    $string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
    $split = StringSplit($string, "")
    For $i = 1 To $chr
    $r = $r & $split[Random(1, 67, 1)]
    Next
    Return $r

    [/autoit]
  • WLAN Hotspot Programm

    • philipp
    • 3. August 2014 um 14:09

    Hi,

    wie bestimmt viele schon wissen kann man ab Windows 7 einen Hotspot vom Laptop aus erstellen via CMD. Ich hab das ganze mal in ein paar Code-Zeilen gepackt, damit man nicht immer alles neu in die CommandPrompt eingeben muss. Außerdem ist noch eine kleine Funktion zum erstellen von Passwörtern mit eingebaut..:) Man muss allerdings noch in der Systemsteuerung die Freigabe aktivieren, siehe Bild:
    [Blockierte Grafik: http://praxistipps.s3.amazonaws.com/aktive-internetverbindung-teilen_5332b565.jpg]

    Naja also wer es brauchen kann :D , ich nutze es mitlerweile relativ häufig und es funktioniert echt gut! Hier ist der Code:

    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <EditConstants.au3>
    #include <Process.au3>

    [/autoit][autoit][/autoit][autoit]

    #RequireAdmin

    [/autoit][autoit][/autoit][autoit]

    main()
    Func main()
    GUICreate("WLAN Hotspot", 300, 140);, -1, -1, -1, $WS_EX_TOOLWINDOW)
    GUISetBkColor(0x808080)
    GUISetFont(11, 400, 1, "Century Gothic")
    $newname = GUICtrlCreateLabel("Name:", 10, 10)
    GUICtrlSetCursor(-1, 0)
    ;~ $name = GUICtrlCreateInput(@ComputerName & "-Hotspot", 100, 10, 190, 21)
    $name = GUICtrlCreateInput("WLAN-" & Generate(5), 100, 10, 190, 21)
    $newpw = GUICtrlCreateLabel("Passwort:", 10, 40)
    GUICtrlSetCursor(-1, 0)
    $pw = GUICtrlCreateInput(Generate(10), 100, 40, 190, 21);, $ES_PASSWORD)
    $perm = GUICtrlCreateCheckbox(" Permanent", 9, 70)
    $secure = GUICtrlCreateSlider(120, 70, 170, 30)
    GUICtrlSetLimit(-1, 20, 5)
    GUICtrlSetBkColor(-1, 0x808080)
    GUICtrlSetData(-1, 10)
    $on = GUICtrlCreateButton("An", 7, 105, 140, 24)
    $off = GUICtrlCreateButton("Aus", 152, 105, 140, 24)
    GUICtrlSetState($off, $GUI_DISABLE)
    GUISetState()

    While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
    Exit
    ElseIf $msg = $on Then
    GUICtrlSetState($on, $GUI_DISABLE)
    GUICtrlSetState($name, $GUI_DISABLE)
    GUICtrlSetState($pw, $GUI_DISABLE)
    GUICtrlSetState($perm, $GUI_DISABLE)
    GUICtrlSetState($off, $GUI_ENABLE)
    If GUICtrlRead($perm) = $GUI_CHECKED Then
    _RunDos("netsh wlan set hostednetwork mode=allow ssid=" & GUICtrlRead($name) & " key=" & GUICtrlRead($pw) & " keyUsage=persistent")
    Else
    _RunDos("netsh wlan set hostednetwork mode=allow ssid=" & GUICtrlRead($name) & " key=" & GUICtrlRead($pw) & " keyUsage=temporary")
    EndIf
    _RunDos("netsh wlan start hostednetwork")
    ElseIf $msg = $off Then
    GUICtrlSetState($off, $GUI_DISABLE)
    GUICtrlSetState($on, $GUI_ENABLE)
    GUICtrlSetState($name, $GUI_ENABLE)
    GUICtrlSetState($pw, $GUI_ENABLE)
    GUICtrlSetState($perm, $GUI_ENABLE)
    _RunDos("netsh wlan stop hostednetwork")
    ElseIf $msg = $newname Then
    GUICtrlSetData($name, "WLAN-" & Generate(5))
    ElseIf $msg = $secure Or $msg = $newpw Then
    GUICtrlSetData($pw, Generate(GUICtrlRead($secure)))
    EndIf
    WEnd
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func Generate($max)
    $chr = ""
    For $i = 1 To $max
    $nchr = Random(0, 1, 1)
    If $nchr = 1 Then
    $chr = $chr & _ToLetter(Random(1, 52, 1))
    Else
    $chr = $chr & Random(0, 9, 1)
    EndIf
    Next
    Return $chr
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func _ToLetter($num)
    If $num = 1 Then
    Return "a"
    ElseIf $num = 2 Then
    Return "b"
    ElseIf $num = 3 Then
    Return "c"
    ElseIf $num = 4 Then
    Return "d"
    ElseIf $num = 5 Then
    Return "e"
    ElseIf $num = 6 Then
    Return "f"
    ElseIf $num = 7 Then
    Return "g"
    ElseIf $num = 8 Then
    Return "h"
    ElseIf $num = 9 Then
    Return "i"
    ElseIf $num = 10 Then
    Return "j"
    ElseIf $num = 11 Then
    Return "k"
    ElseIf $num = 12 Then
    Return "l"
    ElseIf $num = 13 Then
    Return "m"
    ElseIf $num = 14 Then
    Return "n"
    ElseIf $num = 15 Then
    Return "o"
    ElseIf $num = 16 Then
    Return "p"
    ElseIf $num = 17 Then
    Return "q"
    ElseIf $num = 18 Then
    Return "r"
    ElseIf $num = 19 Then
    Return "s"
    ElseIf $num = 20 Then
    Return "t"
    ElseIf $num = 21 Then
    Return "u"
    ElseIf $num = 22 Then
    Return "v"
    ElseIf $num = 23 Then
    Return "w"
    ElseIf $num = 24 Then
    Return "x"
    ElseIf $num = 25 Then
    Return "y"
    ElseIf $num = 26 Then
    Return "z"
    ElseIf $num = 27 Then
    Return "A"
    ElseIf $num = 28 Then
    Return "B"
    ElseIf $num = 29 Then
    Return "C"
    ElseIf $num = 30 Then
    Return "D"
    ElseIf $num = 31 Then
    Return "E"
    ElseIf $num = 32 Then
    Return "F"
    ElseIf $num = 33 Then
    Return "G"
    ElseIf $num = 34 Then
    Return "H"
    ElseIf $num = 35 Then
    Return "I"
    ElseIf $num = 36 Then
    Return "J"
    ElseIf $num = 37 Then
    Return "K"
    ElseIf $num = 38 Then
    Return "L"
    ElseIf $num = 39 Then
    Return "M"
    ElseIf $num = 40 Then
    Return "N"
    ElseIf $num = 41 Then
    Return "O"
    ElseIf $num = 42 Then
    Return "P"
    ElseIf $num = 43 Then
    Return "Q"
    ElseIf $num = 44 Then
    Return "R"
    ElseIf $num = 45 Then
    Return "S"
    ElseIf $num = 46 Then
    Return "T"
    ElseIf $num = 47 Then
    Return "U"
    ElseIf $num = 48 Then
    Return "V"
    ElseIf $num = 49 Then
    Return "W"
    ElseIf $num = 50 Then
    Return "X"
    ElseIf $num = 51 Then
    Return "Y"
    ElseIf $num = 52 Then
    Return "Z"
    Else
    Return ""
    EndIf
    EndFunc

    [/autoit]
  • FTP - Wechsel in ein übergeordnetes Verzeichnis

    • philipp
    • 31. Juli 2014 um 23:46

    Verstehe ich das richtig du willst dir einfach Werte aus Dateien eines Anderen Pfades von deinem Server ziehen? Hast du das ganze schon mal mit Admin-Rechten ausgeführt also mit #RequireAdmin, weil wenn gar nichts passiert, kann das vielleicht damit zusammen hängen. Kannst du dich überhaupt auf den Server schalten oder schlägt selbst das fehl? Und letzte Frage die sich stellt ist das andere Verzeichnis auf dem FTP erstellt?

  • GoogleBar: Schnelle Suche

    • philipp
    • 31. Juli 2014 um 22:32

    Hier ein kurzes Script was dabei helfen soll, schnell mal was zu googlen: GoogleBar. Ich denke das ist ausbaufähig, aber seinen Zweck erfüllt es allemal jetzt schon!
    :)

    [autoit]


    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <File.au3>
    #include <Misc.au3>
    #include <IE.au3>

    [/autoit][autoit][/autoit][autoit]

    Opt("TrayMenuMode", 1)
    Local $exit = TrayCreateItem("Beenden")
    TraySetState()

    [/autoit][autoit][/autoit][autoit]

    GoogleBar()
    Func GoogleBar()
    GUICreate("GoogleBar", 300, 50, @DesktopWidth/2 - 150, -50, $WS_POPUP, $WS_EX_TOOLWINDOW)
    GUISetBkColor(0x357df3)
    $input = GUICtrlCreateInput("", 10, 10, 280, 28)
    GUICtrlSetFont(-1, 13, 400, 0, "Century Gothic")
    GUICtrlSetBkColor(-1, 0x357df3)
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUISetState()

    While 1
    $msg = GUIGetMsg()
    $pos = MouseGetPos()
    $winpos = WinGetPos("GoogleBar")
    If $msg = $GUI_EVENT_CLOSE Then
    For $i = 0 To -50 Step -1
    WinMove("GoogleBar", "", @DesktopWidth/2 - 150, $i)
    Sleep((50 + $i)/5)
    Next
    BackWait()
    ElseIf TrayGetMsg() = $exit Then
    Exit
    ElseIf $pos[0] > @DesktopWidth/4 And $pos[1] < 100 And $pos[0] < @DesktopWidth/4*3 And $winpos[1] < 0 Then
    WinSetOnTop("GoogleBar", "", 1)
    For $i = -50 To 0
    WinMove("GoogleBar", "", @DesktopWidth/2 - 150, $i)
    Sleep(-$i/5)
    Next
    ElseIf $pos[0] < @DesktopWidth/4 Or $pos[0] > @DesktopWidth/4*3 Or $pos[1] > 180 And $winpos[1] = 0 Then
    For $i = 0 To -50 Step -1
    WinMove("GoogleBar", "", @DesktopWidth/2 - 150, $i)
    Sleep((50 + $i)/5)
    Next
    ElseIf _IsPressed("0D") And WinGetTitle("") = "GoogleBar" And $winpos[1] = 0 Then
    For $i = 0 To -50 Step -1
    WinMove("GoogleBar", "", @DesktopWidth/2 - 150, $i)
    Sleep((50 + $i)/5)
    Next
    WebSearch(GUICtrlRead($input))
    EndIf
    WEnd
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func WebSearch($search)
    GUIDelete()
    GUICreate("GoogleBar", @DesktopWidth*4/5, @DesktopHeight*4/5, -1, -1, $WS_POPUP, $WS_EX_TOOLWINDOW)
    GUISetBkColor(0x357df3)
    $ie = _IECreateEmbedded()
    $browser = GUICtrlCreateObj($ie, 10, 10, @DesktopWidth*4/5 - 20, @DesktopHeight*4/5 - 20)
    _IENavigate($ie, "http://www.google.de/#q=" & $search)
    GUISetState()

    While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Or _IsPressed("1B") Then
    While _IsPressed("1B")
    Sleep(10)
    WEnd
    GUIDelete()
    GoogleBar()
    ElseIf TrayGetMsg() = $exit Then
    Exit
    EndIf
    WEnd
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func BackWait()
    TrayTip("GoogleBar", "Die GoogleBar ist immernoch geöffnet, befindet sich jedoch im Standby. Sie können sie jederzeit mit F9 starten und mit F10 beenden!", 5)
    While 1
    HotKeySet("{F9}", "main")
    HotKeySet("{F10}", "close")
    If TrayGetMsg() = $exit Then Exit
    WEnd
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func Close()
    Exit
    EndFunc

    [/autoit]

    Dateien

    GoogleBar.rar 372,99 kB – 323 Downloads
  • Markierter Text kopieren?

    • philipp
    • 26. Juli 2014 um 23:04
    Zitat von anno2008
    [autoit]

    #Include
    If _IsPressed(01) then ...

    [/autoit]

    Bei _IsPressed() aber immer auf die Parameterschreibweise achten! Bei Zahlen funktioniert es ja, aber bei Buchstaben und Zahlen (z.B. 0D = Enter) immer schön Strings benutzen! Also am besten gleich _IsPressed("01") schreiben.

    [Edit BugFix]
    Hiermit nominiere ich dich zum Leichenschänder des Jahres. :wacko:

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™