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. teh_hahn

Beiträge von teh_hahn

  • Frage: Gloabal

    • teh_hahn
    • 2. August 2007 um 20:05

    Hi,

    das Problem ist, dass man mit HotKeySet() keine Parameter an die zu aufrufende Funktion übergeben kann. Somit müssen die Variablen/Konstanten, die in der entsprechenden Funktion verwendet werden global deklariert werden. Das erreicht man durch das Schlüsselwort Global, womit die Variable/Konstante im global scope erschaffen wird und von überall im Skript angesprochen werden kann.

    Wenn Du aber eine Variable außerhalb einer Funktion deklarierst, so ist sie IMMER global, da bringt auch kein Local was. (Dim vergessen wir komplett!)
    Mach mal Opt("MustDeclareVars", 1) oben in Deinem Skript. Dadurch wird die Sache schon um einiges sauberer!

    Wo ist denn das Problem bei Deinem Skript!? Du brauchst doch nur eine Konstante:

    Spoiler anzeigen
    [autoit]

    Opt("MustDeclareVars", 1)
    HotKeySet("{ESC}", "OnAutoItExit")

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

    Global Const $S_TEXT = InputBox("The Message", "Please enter the message you want to sent. Example: /w [myself] No Idling!")

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

    While 1
    Sleep(2000)
    Send("{ENTER}")
    Send("" & $S_TEXT)
    Send("{ENTER}")
    WEnd

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

    Func OnAutoItExit()
    Exit (0)
    EndFunc ;==>OnAutoItExit

    [/autoit]

    PS: Bitte in Zukunft Spoiler und AutoIt-Codes verwenden!!!

  • _FileCopyProgress

    • teh_hahn
    • 2. August 2007 um 09:52

    Hi,

    irgendwie sollte der Forumteil, der sich um UDFs dreht mal vereintheitlicht werden. Zum Beispiel den Sticky aus Hilfe & Support hier mit rein oder so.

    Jetzt aber zum Thema:
    Ich habe die Funktion _FileCopy mal ein bisschen aufgemotzt. Dazu waren bereits zwei Versionen im englischen Forum aufgetaucht:
    - Version 1 by SumTingWong on 2006-05-26.
    - Version 2 updated by lod3n on 2007-06-05.

    Diese waren mir aber noch zu unkonfortabel, weshalb ich momentan dabei bin eine Funktion _FileOperationProgress zu schreiben, die alle Möglichkeiten abdecken soll. Dazu habe ich ein paar Fragen und hätte gerne Verbesserungsvorschläge von Euch (in Bezug auf: ErrorHandling, Robustheit etc.)

    Hier ersteinmal die erste Version der Funktion:
    _FileOperationProgress

    Spoiler anzeigen
    [autoit]

    #region - wFunc: Values that indicate which operation to perform.
    Global Const $FO_COPY = 0x0002
    Global Const $FO_DELETE = 0x0003
    Global Const $FO_MOVE = 0x0001
    Global Const $FO_RENAME = 0x0004
    #endregion - wFunc: Values that indicate which operation to perform.

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

    #region - fFlags: Flags that control the file operation.
    Global Const $FOF_ALLOWUNDO = 0x0040 ;~ Preserve undo information, if possible. Operations can be undone only from the same process that performed the original operation. If, despite earlier warnings against doing so, pFrom does not contain fully-qualified path and file names, this flag is ignored.
    Global Const $FOF_CONFIRMMOUSE = 0x0002 ;~ Not used.
    Global Const $FOF_FILESONLY = 0x0080 ;~ Perform the operation only on files (not on folders) if a wildcard file name (*.*) is specified.
    Global Const $FOF_MULTIDESTFILES = 0x0001 ;~ The pTo member specifies multiple destination files (one for each source file in pFrom) rather than one directory where all source files are to be deposited.
    Global Const $FOF_NOCONFIRMATION = 0x0010 ;~ Respond with Yes to All for any dialog box that is displayed.
    Global Const $FOF_NOCONFIRMMKDIR = 0x0200 ;~ Do not ask the user to confirm the creation of a new directory if the operation requires one to be created.
    Global Const $FOF_NO_CONNECTED_ELEMENTS = 0x2000 ;~ Version 5.0. Do not move connected files as a group. Only move the specified files.
    Global Const $FOF_NOCOPYSECURITYATTRIBS = 0x0800 ;~ Version 4.71. Do not copy the security attributes of the file. The destination file receives the security attributes of its new folder.
    Global Const $FOF_NOERRORUI = 0x0400 ;~ Do not display a dialog to the user if an error occurs.
    Global Const $FOF_NORECURSEREPARSE = 0x8000 ;~ Not used.
    Global Const $FOF_NORECURSION = 0x1000 ;~ Only perform the operation in the local directory. Don't operate recursively into subdirectories, which is the default behavior.
    ;~ Global Const $FOF_NO_UI = "To-Do..." ;~ Version 6.0.6060 (Windows Vista). Perform the operation silently, presenting no user interface (UI) to the user. This is equivalent to FOF_SILENT | FOF_NOCONFIRMATION | FOF_NOERRORUI | FOF_NOCONFIRMMKDIR.
    Global Const $FOF_RENAMEONCOLLISION = 0x0008 ;~ Give the file being operated on a new name in a move, copy, or rename operation if a file with the target name already exists at the destination.
    Global Const $FOF_SILENT = 0x0004 ;~ Do not display a progress dialog box.
    Global Const $FOF_SIMPLEPROGRESS = 0x0100 ;~ Display a progress dialog box but do not show individual file names as they are operated on.
    Global Const $FOF_WANTMAPPINGHANDLE = 0x0020 ;~ If FOF_RENAMEONCOLLISION is specified and any files were renamed, assign a name mapping object that contains their old and new names to the hNameMappings member. This object must be freed using SHFreeNameMappings when it is no longer needed.
    Global Const $FOF_WANTNUKEWARNING = 0x4000 ;~ Version 5.0. Send a warning if a file is being permanently destroyed during a delete operation rather than recycled. This flag partially overrides FOF_NOCONFIRMATION.
    #endregion - fFlags: Flags that control the file operation.

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

    #region - Return Values.
    Global Const $DE_SAMEFILE = 0x71
    Global Const $DE_MANYSRC1DEST = 0x72
    Global Const $DE_DIFFDIR = 0x73
    Global Const $DE_ROOTDIR = 0x74
    Global Const $DE_OPCANCELLED = 0x75
    Global Const $DE_DESTSUBTREE = 0x76
    Global Const $DE_ACCESSDENIEDSRC = 0x78
    Global Const $DE_PATHTOODEEP = 0x79
    Global Const $DE_MANYDEST = 0x7A
    Global Const $DE_INVALIDFILES = 0x7C
    Global Const $DE_DESTSAMETREE = 0x7D
    Global Const $DE_FLDDESTISFILE = 0x7E
    Global Const $DE_FILEDESTISFLD = 0x80
    Global Const $DE_FILENAMETOOLONG = 0x81
    Global Const $DE_DEST_IS_CDROM = 0x82
    Global Const $DE_DEST_IS_DVD = 0x83
    Global Const $DE_DEST_IS_CDRECORD = 0x84
    Global Const $DE_FILE_TOO_LARGE = 0x85
    Global Const $DE_SRC_IS_CDROM = 0x86
    Global Const $DE_SRC_IS_DVD = 0x87
    Global Const $DE_SRC_IS_CDRECORD = 0x88
    Global Const $DE_ERROR_MAX = 0xB7
    Global Const $ERRORONDEST = 0x10000
    #endregion - Return Values.

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

    #cs ----------------------------------------------------------------------------
    UDF Name..........: _FileOperationProgress
    UDF Version.......: 1.0
    Change Date.......: 2007-08-02
    UDF Description...: Executes a file operation with Wndows file operation dialog.

    Author(s).........: teh_hahn
    Company...........: none
    URL...............: none

    Parameter(s)......: To-Do...
    Return Value......: Success: Returns 1
    Failure: Returns 0
    When the function fails @error contains extended information:
    To-Do...
    AutoIt Version....: 3.2.4.9
    Note(s)...........: - Version 1 by SumTingWong on 2006-05-26.
    - Version 2 updated by lod3n on 2007-06-05.
    - Not finished yet...
    #ce ----------------------------------------------------------------------------
    Func _FileOperationProgress(Const $source, Const $S_DEST = "", Const $I_CREATEDIR = 0, Const $HEX_MODE = 0x0002, Const $HEX_FLAGS = 0x0000)
    Local $objShell = 0
    Local $objFolder = 0
    Local $objScripting = 0
    Local $shfileopstruct = 0
    Local $pFrom = 0
    Local $pTo = 0
    Local $a_dllresult

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

    #region - This part isn't perfect yet. Would be better with DLLStruct...
    $objShell = ObjCreate("Shell.Application")
    If $objShell == 0 Then
    SetError(@error, 4)
    Return (0)
    EndIf

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

    $objFolder = $objShell.NameSpace (StringLeft($S_DEST, 2)) ;~ Checking if drive exists.
    If IsObj($objFolder) == 0 Then
    SetError(@error, 6)
    Return (0)
    EndIf

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

    If $I_CREATEDIR == 1 Then
    $objFolder.NewFolder (StringTrimLeft($S_DEST, 3))
    EndIf

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

    $objScripting = ObjCreate("Scripting.FileSystemObject") ;~ Creating destination folder on drive.
    If $objScripting == 0 Then
    SetError(@error, 5)
    Return (0)
    EndIf

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

    If $objScripting.FolderExists ($S_DEST) = False Then ;~ Checking if destination does not exist.#
    SetError(@error, 7)
    Return (0)
    EndIf
    #endregion - This part isn't perfect yet. Would be better with DLLStruct...

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

    $shfileopstruct = DllStructCreate("int;uint;ptr;ptr;uint;int;ptr;ptr")
    If @error <> 0 Then
    SetError(@error, 3)
    Return (0)
    EndIf

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

    DllStructSetData($shfileopstruct, 1, 0) ;~ hwnd
    DllStructSetData($shfileopstruct, 2, $HEX_MODE) ;~ wFunc

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

    #region - pFrom
    $pFrom = DllStructCreate("char[" & StringLen($source) + 2 & "]")
    DllStructSetData($pFrom, 1, $source)
    For $i = 1 To StringLen($source) + 2
    If DllStructGetData($pFrom, 1, $i) = 10 Then
    DllStructSetData($pFrom, 1, 0, $i)
    EndIf
    Next
    DllStructSetData($pFrom, 1, 0, StringLen($source) + 2)
    DllStructSetData($shfileopstruct, 3, DllStructGetPtr($pFrom))
    #endregion - pFrom

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

    #region - pTo
    $pTo = DllStructCreate("char[" & StringLen($S_DEST) + 2 & "]")
    DllStructSetData($pTo, 1, $S_DEST)
    DllStructSetData($pTo, 1, 0, StringLen($S_DEST) + 2)
    DllStructSetData($shfileopstruct, 4, DllStructGetPtr($pTo))
    #endregion - pTo

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

    DllStructSetData($shfileopstruct, 5, $HEX_FLAGS) ;~ fFlags
    DllStructSetData($shfileopstruct, 6, 0) ;~ fAnyOperationsAborted
    DllStructSetData($shfileopstruct, 7, 0) ;~ hNameMappings
    DllStructSetData($shfileopstruct, 8, 0) ;~ lpszProgressTitle

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

    $a_dllresult = DllCall("shell32.dll", "int", "SHFileOperation", "ptr", DllStructGetPtr($shfileopstruct))
    If @error <> 0 Then
    SetError(@error, 2)
    Return (0)
    EndIf

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

    $shfileopstruct = 0
    $pFrom = 0
    $pTo = 0

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

    If $a_dllresult[0] <> 0 Then
    SetError($a_dllresult[0], 1)
    Return (0)
    EndIf

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

    Return (1)
    EndFunc ;==>_FileOperationProgress

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

    Func _SHFileOperationErrorDecode(Const $HEX_ERROR)
    Switch Hex($HEX_ERROR)
    Case $DE_SAMEFILE
    Return ("The source and destination files are the same file.")
    Case $DE_MANYSRC1DEST
    Return ("Multiple file paths were specified in the source buffer, but only one destination file path.")
    Case $DE_DIFFDIR
    Return ("Rename operation was specified but the destination path is a different directory. Use the move operation instead.")
    Case $DE_ROOTDIR
    Return ("The source is a root directory, which cannot be moved or renamed.")
    Case $DE_OPCANCELLED
    Return ("The operation was cancelled by the user, or silently cancelled if the appropriate flags were supplied to SHFileOperation.")
    Case $DE_DESTSUBTREE
    Return ("The destination is a subtree of the source.")
    Case $DE_ACCESSDENIEDSRC
    Return ("Security settings denied access to the source.")
    Case $DE_PATHTOODEEP
    Return ("The source or destination path exceeded or would exceed MAX_PATH.")
    Case $DE_MANYDEST
    Return ("The operation involved multiple destination paths, which can fail in the case of a move operation.")
    Case $DE_INVALIDFILES
    Return ("The path in the source or destination or both was invalid.")
    Case $DE_DESTSAMETREE
    Return ("The source and destination have the same parent folder.")
    Case $DE_FLDDESTISFILE
    Return ("The destination path is an existing file.")
    Case $DE_FILEDESTISFLD
    Return ("The destination path is an existing folder.")
    Case $DE_FILENAMETOOLONG
    Return ("The name of the file exceeds MAX_PATH.")
    Case $DE_DEST_IS_CDROM
    Return ("The destination is a read-only CD-ROM, possibly unformatted.")
    Case $DE_DEST_IS_DVD
    Return ("The destination is a read-only DVD, possibly unformatted.")
    Case $DE_DEST_IS_CDRECORD
    Return ("The destination is a writable CD-ROM, possibly unformatted.")
    Case $DE_FILE_TOO_LARGE
    Return ("The file involved in the operation is too large for the destination media or file system.")
    Case $DE_SRC_IS_CDROM
    Return ("The source is a read-only CD-ROM, possibly unformatted.")
    Case $DE_SRC_IS_DVD
    Return ("The source is a read-only DVD, possibly unformatted.")
    Case $DE_SRC_IS_CDRECORD
    Return ("The source is a writable CD-ROM, possibly unformatted.")
    Case $DE_ERROR_MAX
    Return ("MAX_PATH was exceeded during the operation.")
    Case $ERRORONDEST
    Return ("An unspecified error occurred on the destination.")
    Case $DE_ROOTDIR
    Return ("Destination is a root directory and cannot be renamed.")
    Case 0x00
    Return ("Successful.")
    Case Else
    Return ("Unknown ErrorCode: " & Hex($HEX_ERROR))
    EndSwitch
    EndFunc ;==>_SHFileOperationErrorDecode

    [/autoit]


    Beispiel:

    Spoiler anzeigen
    [autoit]

    Local Const $S_FILE = "E:\Downloads\VMware-workstation-6.0.0-45731.exe"
    _FileOperationProgress($S_FILE, "C:\Downloads", 1, $FO_COPY, $FOF_SIMPLEPROGRESS + $FOF_NOCONFIRMATION)
    If @extended == 1 Then
    MsgBox(64, "_SHFileOperationErrorDecode", "Decode: " & _SHFileOperationErrorDecode(@error))
    EndIf
    Exit(0)

    [/autoit]

    Jetzt meine ersten Fragen:
    1. Wie komme ich an die Werte der Konstanten, wie z.B. FOF_NO_UI heran (die ja noch fehlt!) Die restlichen habe ich wie bereits erwähnt aus dem englischen Forum:
    Auch die MSDN-Seite gibt da nicht wirklich was her: http://msdn2.microsoft.com/en-us/library/ms538322.aspx
    2. Wo finde ich die Bedeutung der Rückgabewerte von SHFileOperation? Die Funktion _SHFileOperationErrorDecode erkennt zwar schon einige, aber längst nicht alle, so scheint mir (z.B. Abbrechen des Dialoges) EDIT: Grade gefunden: http://msdn2.microsoft.com/en-us/library/ms647743.aspx
    Aber wieso kennt er den z.B. den user cancel oder das Abbrechen für das Überschreiben nicht? Gibt es irgendwo eine komplette Auflistung?
    3. Wie bereits erwähnt: Wie löse ich das am besten mit dem ErrorHandling? Ist die momentane Lösung mit @extended in Ordnung oder wie könnte man das verbessern? Bin damit irgendwie nicht zufrieden!
    4. Warum funktioniert Default nicht als Übergabeparameter, obwohl die Parameter optional sind? So muss ich immer explizit den Modus angeben, was etwas unkonfortabel ist, wenn ich den Modus auf Standard belassen und nur die Flags ändern möchte!
    5. Ist der Teil innerhalb von region innerhalb der Funktion wirklich so nötig? Habs vorher ohne probiert, da kopiert er die Datei aus meinem Beispiel als Datei "Downloads" nach C:! Der Aufwand das Ganze auch mit DLLCalls zu machen wäre aber wahrscheinlich zu hoch...

    EDIT: Mir fehlt grade auf, dass die AutoIt-Syntax hier im Forum noch einen Bug hat. Kommt mit dem "'" bei region nicht klar...

  • Log hilfe

    • teh_hahn
    • 1. August 2007 um 23:39

    omfg. Das ist jetzt nicht ernst gemeint, oder? Ich meine Deinen Source-Code! Mit so schnipseln kann man wenig anfangen. oder zumindest ein anschauliches Beispiel!
    Und damit es wenigstens ordentlich ausschaut, benutzt Du am Besten vor dem posten immer TidyAutoIt (In SciTE: CTRL + T).

  • Log hilfe

    • teh_hahn
    • 1. August 2007 um 23:27

    Formulier doch mal klar, was Du möchtest! Und poste mal anständig Code, damit kann man ja überhaupt nichts anfangen!

    Schau Dir mal folgendes an:

    Spoiler anzeigen
    [autoit]

    #include <GUIConstants.au3>

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

    Opt("MustDeclareVars", 1)

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

    Local Const $S_LOGFILE = @ScriptDir & '\send.log'
    Local $a_logmsg[5] = ["Hier den Text für F1 eingeben", "Hier den Text für F2 eingeben", _
    "Hier den Text für F3 eingeben", "Hier den Text für F4 eingeben", "Hier den Text für F5 eingeben"]
    Local $a_msg = -1
    Local $h_maingui = -1
    Local $h_savebt = -1
    Local $h_file = -1

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

    $h_maingui = GUICreate("Log Test", 320, 240)
    $h_savebt = GUICtrlCreateButton("&Save", 10, 10)

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

    GUISetState(@SW_SHOW, $h_maingui)

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

    If FileExists($S_LOGFILE) == 1 Then
    ;~ Hier der Teil, falls die Logdatei existiert!
    Else
    ;~ Hier der Teil, falls die Logdatei nicht existiert!
    While 1
    $a_msg = GUIGetMsg(1)
    Select
    Case $a_msg[0] == $GUI_EVENT_CLOSE
    ExitLoop 1
    Case $a_msg[0] == $h_savebt
    $h_file = FileOpen($S_LOGFILE, 1)
    If $h_file <> -1 Then
    For $i = 0 To UBound($a_logmsg) - 1 Step 1
    FileWriteLine($h_file, $a_logmsg[$i])
    Next
    EndIf
    FileClose($h_file)
    MsgBox(64, "Please note", "The Logfile " & $S_LOGFILE & " has changed!")
    EndSelect
    WEnd
    EndIf
    Exit (0)

    [/autoit]
  • Copy vom Server

    • teh_hahn
    • 31. Juli 2007 um 00:07

    Ja ja, manchmal ist die gute alte Batchdatei doch nicht zu toppen:
    CopyFromServer.cmd

    Spoiler anzeigen
    Code
    @echo off
    xcopy "\\sw2\Public\Abt2\*.*" "%PROGRAMFILES%\Abt2\" /e /c /i /f /g /h /r /k /y
    exit


    Und so weiter...

  • script isolieren

    • teh_hahn
    • 30. Juli 2007 um 23:14

    Bitte [Spoiler][AutoIt]-Tags verwenden! Die ControlClicks und WinWaits stellen hier kein Problem dar. Daz Einzige, was in meinen Augen Probleme bereitet sind die Sends in der Mitte. Die müsstest Du aber auch über entsprechende ControlCommands automatisieren können.
    Du kannst die GUI mit WinSetTrans() transparent machen, dann geht trotzdem noch alles.

    EDIT: VLC scheint InstallShield zu sein. Google mal nach nach den SilentSchaltern davon!

  • script isolieren

    • teh_hahn
    • 30. Juli 2007 um 22:56

    Der Skript? :p

    Zitat

    ich bräuchte einen Befehl mithilfedessen ich die Eingabe per Maus oder Tastatur vollständig blockieren kann, allerdings suche ich nicht etwas wie blockinput, denn bei diesem Befehl wird ja alles blockiert


    Wie? Wat? Eingabe blockieren oder nicht? Handelt es sich dabei um eine Automatisierung von Tastaturkommandos und Mausclicks oder hat das Skript eine eigene GUI? Oder willst Du nur, dass man den Prozess nicht abschiessen kann?

    EDIT: Sry, nicht geschaut. Hat also keine GUI. Naja, wenn Du etwas automatisierst, ist es wohl schwer zu unterscheiden ob die aktuelle Eingabe nun vom Skript oder von Dir kommt. Wenn der User der Meinung ist ein Fenster zu öffne, obwohl das Skript z.B. ein WinWait() auf ein anderes macht, sieht es wohl schlecht aus. Automatisierungsvorgände mit wilden ControlClick-Orgien sollen wohl besser mit BlockInput abgescihert werden.

  • FTP Hide & Befehle ausführen

    • teh_hahn
    • 30. Juli 2007 um 19:27

    Ja, halt mit RunWait(@ComSpech & " /c " & $s_command). Die Problematik die Du beschreibst, tritt eigentlich nur bei Programmen auf, die keinen Direktaufruf erlauben (z.B. diskpart oder eben auch ftp). Hier würde ich immer den Umweg über eine Datei gehen (die Du ja auch zur Laufzeit erzeugen und danach wieder löschen kannst!).

  • Aktionen in Lineage 2 ausführen

    • teh_hahn
    • 30. Juli 2007 um 15:43

    Was ist das denn für ein komisches Testverfahren? Was soll denn z.B. bei einem Tastendruck auf F1 geschehen? Und wie startest Du das Skript aus dem Spiel heraus?

    Ich würde zunächst mal folgendes versuchen:

    Spoiler anzeigen
    [autoit]

    HotKeySet("!{F1}", "SendKey")

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

    While 1
    Sleep(100)
    WEnd

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

    Func SendKey()
    Send("{F1}")
    EndFunc

    [/autoit]
  • FTP Hide & Befehle ausführen

    • teh_hahn
    • 30. Juli 2007 um 15:35

    Ruf ftp.exe mit dem Paramter -s auf, dann schreibst du die Befehle in eine Textdatei und fertig. Beispiel:

    Spoiler anzeigen
    [autoit]

    Local Const $S_FTPFILE = @ScriptDir & "\FTPCommands.txt"

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

    RunWait(@ComSpec & ' /c ftp.exe -v -n -i -d -g -s:"' & $S_FTPFILE & '"', @WorkingDir, @SW_HIDE)
    Exit(0)

    [/autoit]

    Die Textdatei FTPCommands.txt sieht dann z.B. so aus:

    Spoiler anzeigen
    Code
    open mein.ftp.de
    user Admin
    password
    put meinedatei.txt
    exit
  • Bildschirmschoner bauen

    • teh_hahn
    • 30. Juli 2007 um 15:12

    So, hier nochmal meine Version mit "Verschieben":
    Bild gibts Du ganz oben an:

    Spoiler anzeigen
    [autoit]

    #include <GuiConstants.au3>

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

    Opt("GUICloseOnESC", 1)
    Opt("MustDeclareVars", 1)

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

    Local Const $S_PICTURE = @ScriptDir & "\3IOB_2wallpaper800x600.jpg"
    Local Const $I_CHANGE = 10
    Local Const $I_GUIWIDTH = @DesktopWidth
    Local Const $I_GUIHEIGHT = @DesktopHeight
    Local Const $I_PICWIDTH = 800
    Local Const $I_PICHEIGHT = 600
    Local $i_left = 0
    Local $i_top = 0
    Local $i_counter = 0
    Local $h_scrgui = -1
    Local $h_picgui = -1
    Local $h_scrpic = -1
    Local $msg = 0

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

    $h_scrgui = GUICreate("Simple Screen Saver", $I_GUIWIDTH, $I_GUIHEIGHT, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
    $h_picgui = GUICreate("", $I_PICWIDTH, $I_PICHEIGHT, $i_left, $i_top, $WS_CHILD, -1, $h_scrgui)
    $h_scrpic = GUICtrlCreatePic($S_PICTURE, 0, 0, $I_PICWIDTH, $I_PICHEIGHT)

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

    GUISetBkColor(000000, $h_scrgui)
    GUISetState(@SW_SHOW, $h_scrgui)
    GUISetState(@SW_SHOW, $h_picgui)

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

    Do
    Sleep($I_CHANGE)
    $i_left += 1
    $i_top += 1
    WinMove($h_picgui, "", $i_left, $i_top)
    $i_counter += 1
    Until $i_counter >= @DesktopHeight - $I_PICHEIGHT

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

    While 1
    $msg = GUIGetMsg()

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

    If $msg == $GUI_EVENT_CLOSE Then
    ExitLoop 1
    EndIf
    WEnd
    GUIDelete($h_scrgui)
    Exit (0)

    [/autoit]
  • Automatische Druckerverteilung

    • teh_hahn
    • 30. Juli 2007 um 08:29

    Oh, ist noch zu früh. Gefixed!

  • Automatische Druckerverteilung

    • teh_hahn
    • 30. Juli 2007 um 08:06

    Mhh, ich würde sagen, es liegt an den Leerzeichen des Druckernamens. Probier mal folgendes:

    [autoit]

    $printernewname = "HPColorLaserJet 3600dn"
    $printserver = "srvasvdifil002"
    ShellExecuteWait(@WindowsDir & "\system32\cscript.exe " & @WindowsDir & '\system32\prnmngr.vbs -ac -p "\\' & $printserver & "\" & $printernewname & '"')

    [/autoit]

    EDIT: Klammer gefixed!

  • Websiteparser

    • teh_hahn
    • 30. Juli 2007 um 00:06

    rofl. bangbros...
    no comment

  • ProcessWatcher

    • teh_hahn
    • 29. Juli 2007 um 22:05

    Ich würde einen anderen Ansatz wählen. Zunächst einmal würde ich die INI-Datei folgendermaßen ändern:

    Processes.ini

    Spoiler anzeigen
    Code
    [ProcessPriority]
    totalcmd.exe = 0
    everest.exe = 1
    mplayerc.exe = 4
    iexplore.exe = 2
    firefox.exe = 5


    Nach ein paar Modifizierungen am Skript, lässt sich jetzt bereits im Vorfeld festlegen, welcher Prozess, welche Priorität bekommen soll. (Damit wird ein Benutzereingriff unnötig!):
    ProcessWatcher.au3

    Spoiler anzeigen
    [autoit]

    Opt("MustDeclareVars", 1)
    Opt("TrayMenuMode", 1)
    HotKeySet("!e", "OnAutoItExit")

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

    Local Const $S_INIFILE = @ScriptDir & "\Processes.ini"
    Global Const $S_INISECTION = "ProcessPriority"
    Global $a_iniindex = IniReadSection($S_INIFILE, $S_INISECTION)
    If @error <> 0 Then
    MsgBox(16, "ERROR", "The INI file may not exist or the section may not exist!")
    Exit (1)
    EndIf
    Global $s_orginitime = FileGetTime($S_INIFILE, 0, 1)

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

    Local $h_abouttitem = -1
    Local $h_exitmitem = -1
    Local $i_msg = -1

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

    $h_abouttitem = TrayCreateItem("About")
    TrayCreateItem("")
    $h_exitmitem = TrayCreateItem("Exit")
    TraySetClick(8)
    AdlibEnable("CheckProcesses", 30000)

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

    While 1
    $i_msg = TrayGetMsg()
    Select
    Case $i_msg == $h_abouttitem
    MsgBox(64, "About:", "Zum Testen")
    Case $i_msg == $h_exitmitem
    ExitLoop 1
    EndSelect
    WEnd
    Exit (0)

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

    Func CheckProcesses()
    Local $s_curinitime = FileGetTime($S_INIFILE, 0, 1)
    If $s_curinitime <> $s_orginitime Then
    $a_iniindex = IniReadSection($S_INIFILE, $S_INISECTION)
    $s_orginitime = $s_curinitime
    EndIf

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

    For $i = 1 To $a_iniindex[0][0] Step 1
    If $a_iniindex[$i][0] >= 0 And $a_iniindex[$i][0] <= 5 Then
    ;~ MsgBox(64, "Debug", "Process: " & $a_iniindex[$i][0] & @CR & "Priority: " & $a_iniindex[$i][1])
    If ProcessExists($a_iniindex[$i][0]) <> 0 Then
    ProcessSetPriority($a_iniindex[$i][0], $a_iniindex[$i][1])
    EndIf
    Else
    MsgBox(48, "WARNING", 'The priority flag for "' & $a_iniindex[$i][0] & '" is invalid!', 3)
    EndIf
    Next
    EndFunc ;==>CheckProcesses

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

    Func OnAutoItExit()
    AdlibDisable()
    If @HotKeyPressed <> "" Then
    Exit (0)
    EndIf

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

    Exit (@exitCode)
    EndFunc ;==>OnAutoItExit

    [/autoit]


    Habe zusätzlich noch das Überprüfen auf Änderungen an der INI-Datei mit in die AdLib-Funktion gepackt (machte zuvor keinen Sinn!) und zwei MsgBoxen im Falle von Fehlern hinzugefügt.

  • text aufnehmen

    • teh_hahn
    • 29. Juli 2007 um 20:18

    Teste mal folgendes (Keine Ahnung, ob er den Fullscreen-Modus dann verlässt, aber einen Versuch ist es Wert.) Also vorher Skript anschmeissen und dann mal probieren.

    Spoiler anzeigen
    [autoit]

    #NoTrayIcon
    #include <GUIConstants.au3>
    #include <Misc.au3>

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

    Opt("MustDeclareVars", 1)
    HotKeySet("^!{F1}", "RecordeInput")

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

    Global $h_maingui = -1
    Global $h_fileinp = -1
    $h_maingui = GUICreate("", 320, 30, -1, -1, $WS_POPUP, $WS_EX_TOOLWINDOW + $WS_EX_TOPMOST)
    $h_fileinp = GUICtrlCreateInput("", 5, 5, 310, 20)

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

    While 1
    WEnd

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

    Func RecordeInput()
    Local $s_file = ""

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

    HotKeySet("", "RecordeInput")
    GUISetState(@SW_SHOW, $h_maingui)
    While 1
    If _IsPressed("0D") Then
    $s_file = GUICtrlRead($h_fileinp, 1)
    ;~ If FileExists($s_file) == 1 Then
    Run($s_file, @WorkingDir, @SW_HIDE)
    ;~ EndIf
    GUICtrlSetData($h_fileinp, "")
    GUISetState(@SW_HIDE, $h_maingui)
    HotKeySet("^!{F1}", "RecordeInput")
    EndIf
    WEnd
    EndFunc ;==>RecordeInput

    [/autoit]
  • ProcessWatcher

    • teh_hahn
    • 29. Juli 2007 um 19:23

    Das liegt daran, dass Du ja niemals aus Deinem Tray-Loop heraus kommst. Du musst alles in eine Schleife packen:

    Spoiler anzeigen
    [autoit]

    Opt("MustDeclareVars", 1)
    Opt("TrayMenuMode", 1)
    HotKeySet("!e", "OnAutoItExit")

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

    Local Const $S_INIFILE = @ScriptDir & "\ProcessNames.ini"
    Local $h_abouttitem = -1
    Local $h_exitmitem = -1
    Local $i_msg = -1
    Local $s_orginitime = FileGetTime($S_INIFILE, 0, 1)
    Local $s_curinitime = ""

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

    Local $a_iniindex = IniReadSection($S_INIFILE, "Process")
    If @error <> 0 Then
    Exit (1)
    EndIf

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

    $h_abouttitem = TrayCreateItem("About")
    TrayCreateItem("")
    $h_exitmitem = TrayCreateItem("Exit")
    TraySetClick(8)

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

    While 1
    $i_msg = TrayGetMsg()
    Select
    Case $i_msg == $h_abouttitem
    MsgBox(64, "About:", "Zum Testen")
    Case $i_msg == $h_exitmitem
    ExitLoop 1
    EndSelect

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

    For $i = 1 To $a_iniindex[0][0] Step 1
    If $a_iniindex[$i][1] <> "" Then
    If ProcessExists($a_iniindex[$i][1]) <> 0 Then
    ProcessSetPriority($a_iniindex[$i][1], 0)
    EndIf
    EndIf
    Next

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

    $s_curinitime = FileGetTime($S_INIFILE, 0, 1)
    If $s_curinitime <> $s_orginitime Then
    $a_iniindex = IniReadSection($S_INIFILE, "Process")
    $s_orginitime = $s_curinitime
    EndIf
    WEnd
    Exit (0)

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

    Func OnAutoItExit()
    If @HotKeyPressed <> "" Then
    Exit (0)
    EndIf

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

    Exit (@exitCode)
    EndFunc ;==>OnAutoItExit

    [/autoit]


    Das Problem dabei ist dann aber, dass Du entweder auf das Sleep verzichtest (siehe oben!) oder aber mittels AdlibEnable() die Funktion zum Überprüfen der Prozesse alle paar Sekunden aufrufst:

    Spoiler anzeigen
    [autoit]

    Opt("MustDeclareVars", 1)
    Opt("TrayMenuMode", 1)
    HotKeySet("!e", "OnAutoItExit")

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

    Local Const $S_INIFILE = @ScriptDir & "\ProcessNames.ini"
    Global $a_iniindex = IniReadSection($S_INIFILE, "Process")
    If @error <> 0 Then
    Exit (1)
    EndIf

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

    Local $h_abouttitem = -1
    Local $h_exitmitem = -1
    Local $i_msg = -1
    Local $s_orginitime = FileGetTime($S_INIFILE, 0, 1)
    Local $s_curinitime = ""

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

    $h_abouttitem = TrayCreateItem("About")
    TrayCreateItem("")
    $h_exitmitem = TrayCreateItem("Exit")
    TraySetClick(8)
    AdlibEnable("CheckProcesses", 1000)

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

    While 1
    $i_msg = TrayGetMsg()
    Select
    Case $i_msg == $h_abouttitem
    MsgBox(64, "About:", "Zum Testen")
    Case $i_msg == $h_exitmitem
    ExitLoop 1
    EndSelect

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

    $s_curinitime = FileGetTime($S_INIFILE, 0, 1)
    If $s_curinitime <> $s_orginitime Then
    $a_iniindex = IniReadSection($S_INIFILE, "Process")
    $s_orginitime = $s_curinitime
    EndIf
    WEnd
    Exit (0)

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

    Func CheckProcesses()
    For $i = 1 To $a_iniindex[0][0] Step 1
    If $a_iniindex[$i][1] <> "" Then
    If ProcessExists($a_iniindex[$i][1]) <> 0 Then
    ProcessSetPriority($a_iniindex[$i][1], 0)
    EndIf
    EndIf
    Next
    EndFunc

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

    Func OnAutoItExit()
    AdlibDisable()
    If @HotKeyPressed <> "" Then
    Exit (0)
    EndIf

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

    Exit (@exitCode)
    EndFunc ;==>OnAutoItExit

    [/autoit]


    Dies wird durch das Sleep() in der While-Schleife verursacht. Ich würde die zweite Variante verwenden und den Adlib-Intervall ruhig auf 10000 oder mehr setzen. (So zeitkritisch kann das Ganze doch nicht sein...)

  • dll call version 3.1 --> 3.2.4.x FEHLER

    • teh_hahn
    • 29. Juli 2007 um 18:42

    Ja, die Antwort steht doch schon da:
    See the DllCall() documentation for details on changing the calling convention.

    Bin mir nicht sicher, aber hat sich seit Version 3.2.4.0 nicht auch die Syntax der DllCall()-Funktion verändert? Überprüf das doch einfach mal! Und wie gtaspider schon anmerkte, am Besten immer DllOpen() vorher machen.

  • ProcessWatcher

    • teh_hahn
    • 29. Juli 2007 um 18:38

    Ob sinnvoll oder nicht: Für die, die es interessiert hier mal die einfache Version zum INI-ändern während der Laufzeit:

    Spoiler anzeigen
    [autoit]

    Opt("MustDeclareVars", 1)
    HotKeySet("!e", "OnAutoItExit")

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

    Local Const $S_INIFILE = @ScriptDir & "\ProcessNames.ini"
    Local $a_iniindex = IniReadSection($S_INIFILE, "Process")
    Local $s_orginitime = FileGetTime($S_INIFILE, 0, 1)
    Local $s_curinitime = ""

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

    If @error <> 0 Then
    Exit (1)
    EndIf

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

    While 1
    For $i = 1 To $a_iniindex[0][0] Step 1
    If $a_iniindex[$i][1] <> "" Then
    If ProcessExists($a_iniindex[$i][1]) <> 0 Then
    ProcessSetPriority($a_iniindex[$i][1], 0)
    EndIf
    EndIf
    Sleep(500)
    Next

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

    $s_curinitime = FileGetTime($S_INIFILE, 0, 1)
    If $s_curinitime <> $s_orginitime Then
    $a_iniindex = IniReadSection($S_INIFILE, "Process")
    $s_orginitime = $s_curinitime
    EndIf
    WEnd

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

    Func OnAutoItExit()
    If @HotKeyPressed <> "" Then
    Exit (0)
    EndIf

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

    Exit (@exitCode)
    EndFunc ;==>OnAutoItExit

    [/autoit]
  • Bildschirmschoner bauen

    • teh_hahn
    • 27. Juli 2007 um 18:05

    Ganz einfach, du hast Deine Do - Until Schleife in eine While-Schleife gepackt, damit kann wird sie jedesmal aufs neue ausgeführt...

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™