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

Beiträge von gmmg

  • Access ADODB Connection

    • gmmg
    • 9. April 2018 um 09:43

    olfibits:

    misterspeed:

    Danke für eure Beteiligung. Richtig, ein normaler User hat nur Schreibrechte auf den Share Ordner. Daher wird ein Szenario benötigt, welches mir ermöglicht, das ich das Script mit User YX ausführe, welcher auf diesen Ordner Schreibrechte hat. Das Speichern der Zugangsdaten im Script sehe ich nicht als Problem, weil man dafür einen Dummy User nutzen kann, der dann nur auf diesem Share Ordner schreibrechte hat.

    Außerdem kann man die Zugangsdaten noch verschlüsselt ablegen.

    100% Sicherheit gibt es nicht, aber es sind auch keine Sicherheitsrelavante Daten im Script, es geht nur darum, dass der normale User nichts löscht, weil das kann er ja mit ändern rechten.

    Ich habe jetzt aber eine Lösung gefunden. Ich habe die Zugriffsrechte so angepasst, dass man schreiben darf, aber nicht löschen.

    Gruß gmmg

  • Access ADODB Connection

    • gmmg
    • 6. April 2018 um 11:37

    Danke für die Antworten.

    Wie geschrieben, hat der User nur Lese Rechte auf dieser Freigabe, deshalb sollte das Schreiben in die DB über einen anderen User gelöst werden.

    Gruß gmmg

  • Access ADODB Connection

    • gmmg
    • 5. April 2018 um 12:18

    Hallo Zusammen,

    ich habe eine Access Accdb. Diese leigt im Netzwerklauf. Alle Benutzer haben hier nur Leserechte.

    Wenn der User das Script ausführt wird Aufgrund da er nur Leserechte hat nichts in die DB geschrieben.

    Ist es daher möglich der ADODB Connection ein User und PWD zu übergeben? Oder gibt es hier einen anderen Lösungsansatz, ohne dem User ändern Rechte zu geben?

    AutoIt
    $adoCon = ObjCreate("ADODB.Connection")
        $adoCon.Open("Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & $dbname & ";")
        $adoRs = ObjCreate("ADODB.Recordset")
    
        ;$adocon = ObjCreate("ADODB.Connection")
        ;$adocon.open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $dbname)
        ;$adors = ObjCreate("ADODB.Recordset")
    
        Local $sQuery = "INSERT INTO Schulung (`Schulungsauswahl`,`Detailauswahl`,`Detailauswahl_Erweitert`,`Beschreibung`,`User`,`Datum`) VALUES ('" & $Wert01 & "','" & $Wert02 & "','" & $Wert03 & "','" & $Wert04 & "','" & $User & "','" & $Datum & "')"
        $adoCon.Execute($sQuery)
        $adoCon.Close
    Alles anzeigen

    Danke

    Gruß gmmg

  • Eingebundene Dateien verwenden

    • gmmg
    • 12. März 2018 um 10:53

    Hallo wwasow,

    so mache ich das immer:

    AutoIt
    $Archiv = "c:\Test\Test.zip"
    
    $Output = "c:\Test\Entpackt\
    
    RunWait(@ComSpec & " /c " & @ScriptDir & "\TEMP\7z.exe x " & '"' & $Archive & '"' & " -aoa -y -o" & '"' & $Output & '"')

    Gruß gmmg

  • Anfängerfrage - Submit Button

    • gmmg
    • 26. Januar 2018 um 14:19

    Du brauchst dafür ein 2D Array.

    Wenn du Excel hast, kannst du dir ein Dokument mit deinen Daten (Spalte 1, Spalte 2 ) erstellen und das dann auslesen. Beispiele dazu stehen auch in der Hilfe Datei.

    Mit der Funktion _ExcelReadSheetToArray wird das Dokument in ein Array gelesen.

    Code
    Local $oExcelapp = _Excel_Open()
    Local $oExcel = _Excel_BookOpen($oExcelapp, $sFilePath & "Excel Datei")
    
    If @error = 1 Then
    MsgBox(0, "Error!", "Unable to Create the Excel Object")
    Exit
    ElseIf @error = 2 Then
    MsgBox(0, "Error!", "File does not exist - Shame on you!")
    Exit
    EndIf
    
    ;$aArray = _ExcelReadSheetToArray($oExcel,1) ;Using Default Parameters
    
    Local $aArray = _Excel_RangeRead($oExcel,Default,Default)
    _ArrayDisplay($aArray, "Array using Default Parameters")
    Alles anzeigen

    Gruß gmmg

  • Anfängerfrage - Submit Button

    • gmmg
    • 25. Januar 2018 um 13:37

    Hallo AlphavibeZ,

    hier mal ein Script dafür. Das kann dann entsprechend angepasst werden.


    Code
    #include <IE.au3>
    
    $mail = "test@test.de"
    $pwd = "12345678"
    
    $link = "https://www.wohnkult24.com/login.php"
    
    $titel = "Anmelden"
    
    $oIE = _IECreate ($link)
    
    WinSetState ($titel, "", @SW_MAXIMIZE)
    _IELoadWait($oIE)
    
    $oForm = _IEGetObjById($oIE, "login")
    $oEmail = _IEFormElementGetObjByName($oForm, "email_address")
    _IEFormElementSetValue($oEmail, $mail)
    $oPasswd = _IEFormElementGetObjByName($oForm, "password")
    _IEFormElementSetValue($oPasswd, $pwd)
    _IEFormSubmit ($oForm)
    Alles anzeigen

    oder mit GUI

    C
    #include <IE.au3>
    #include <GUIConstantsEx.au3>
    
    ;$mail = "test@test.de"
    ;$pwd = "12345678"
    
    $Form = GUICreate("Login " & FileGetVersion(@ScriptName), 250, 150)
    GUISetBkColor(0xC0C0B2)
    ;GUICtrlSetBkColor(-1,0x66CC00)
    GUICtrlCreateLabel("Email", 20, 20)
    $Input_email = GUICtrlCreateInput("", 100, 20, 100, 20)
    GUICtrlCreateLabel("Passwort", 20, 60)
    $Input_pwd = GUICtrlCreateInput("", 100, 60, 100, 20)
    $Button_login = GUICtrlCreateButton("Login", 110, 100, 80, 25)
    GUISetState(@SW_SHOW)
    
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Button_login
    
                $mail = GUICtrlRead($Input_email)
                $pwd = GUICtrlRead($Input_pwd)
    
                If $mail = "" or $pwd = "" Then
                    MsgBox (0,"Info","Bitte alle Felder auswählen!")
                Else
                    _login($mail,$pwd)
                    Exit
                EndIf
        EndSwitch
    WEnd
    
    
    Func _login($mail,$pwd)
    
        $link = "https://www.wohnkult24.com/login.php"
        $titel = "Anmelden"
    
    
        $oIE = _IECreate ($link)
    
        WinSetState ($titel, "", @SW_MAXIMIZE)
        _IELoadWait($oIE)
    
        $oForm = _IEGetObjById($oIE, "login")
        $oEmail = _IEFormElementGetObjByName($oForm, "email_address")
        _IEFormElementSetValue($oEmail, $mail)
        $oPasswd = _IEFormElementGetObjByName($oForm, "password")
        _IEFormElementSetValue($oPasswd, $pwd)
        _IEFormSubmit ($oForm)
    
    Endfunc
    Alles anzeigen


    Gruß gmmg :)

  • Script zum auto öffnen von Dateien mit "if" Bedingung

    • gmmg
    • 19. Dezember 2017 um 12:04

    Ob das Programm offen ist, kann man vorher prüfen.

    Das gibt es die Funktion "ProcessExists" in Autoit. Das steht auch in der Hilfe gut beschrieben, mit Beispielen.

  • Script zum auto öffnen von Dateien mit "if" Bedingung

    • gmmg
    • 19. Dezember 2017 um 10:45

    Nochmal für uns, du Öffnest aus dem Pfad "C:\Zeiss_Programme\Programmierbereich\1234\inspection" die Programm exe?

    Wie heißt die genaue Exe Datei die du öffnest?

    Öffnest du dann in diesem Programm, die calypso.im oder was wird gemacht?

  • Script zum auto öffnen von Dateien mit "if" Bedingung

    • gmmg
    • 19. Dezember 2017 um 10:17

    Hallo Sascha,

    am besten du erstellst dir eine GUI mit einer Inputbox und den entsprechenden Button und rufst dein 3D Messprogramm danach mit dem Run Befehl auf.

    C
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    
    $Form = GUICreate("3D", 190, 160)
    GUISetBkColor(0xC0C0B2)
    GUICtrlCreateLabel("Teilenummer:", 15, 15, 150, 20)
    $Input = GUICtrlCreateInput("", 15, 35, 150, 20)
    $Button = GUICtrlCreateButton("start", 50, 120, 73, 25)
    GUISetState(@SW_SHOW)
    
    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
    
            Case $Button
                
            $teilenummer = GUICtrlRead($Input)
            
            If $teilenummer = "1234567" Then RUN ("Pfad zur Exe")
            
    
        EndSwitch
    WEnd
    Alles anzeigen

    Hier mal ein Beispiel.

    Wenn du viele Teilenummern hast, liest ma am besten eine Datei in ein Array ein und fragt dieses dann ab.

    Bekommst du heraus, ob man dem Messprogramm parameter übergeben kann? Wenn das nicht geht, müsstest du dann dan Programm öffnen und die Bedienung per Control, Maus Befehle steuern.

    Gruß gmmg

  • Autoit Forum Browser

    • gmmg
    • 18. Dezember 2017 um 11:31

    Hallo alpines,

    das stimmt natürlich. Das ist dann alles bisschen gefrickel :)

    Gruß gmmg

  • Autoit Forum Browser

    • gmmg
    • 18. Dezember 2017 um 09:38

    Man kann das Firefox Fenster aber als Child GUI einbetten. Folgend ein Beispiel, welches auch im englischen Forum zu finden ist.

    C
    #include <GUIConstantsEx.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    #include <Constants.au3>
    
    Local $iPID = Run('"C:\Program Files (x86)\Mozilla Firefox\firefox.exe" -new-window "http://www.autoit.de"',"",@SW_HIDE)
    
    Sleep(2000)
    
    $hGUIMain = GUICreate("Parent", 800, 600)
    GUISetState(@SW_SHOW, $hGUIMain)
    
    Opt("WinTitleMatchMode", 2)
    
    $hGUITool = WinGetHandle("Mozilla Firefox")
    If $hGUITool = 0 Then
        MsgBox(0,"","Run firefox first!")
        Exit
    EndIf
    
    $Toolbarfenster = WinGetPos($hGUITool)
    GUISetStyle(BitOR($WS_CHILD, $WS_BORDER), 0, $hGUITool) ; den Style ändern
    _WinAPI_SetParent($hGUITool, $hGUIMain) ; einbetten
    WinMove($hGUITool, "", 0, 0, 800, 600) ; an 0,0 des Hauptfensters schieben
    _WinAPI_RedrawWindow($hGUITool) ; neu zeichenen
    _WinAPI_RedrawWindow($hGUIMain) ; neu zeichenen
    
    While 1
        $avMsg = GUIGetMsg(1)
        Switch $avMsg[1]
            Case $hGUIMain
                Switch $avMsg[0]
                    Case -3
                        Exit
                EndSwitch
        EndSwitch
    WEnd
    Alles anzeigen

    Gruß gmmg

  • Autoit Forum Browser

    • gmmg
    • 15. Dezember 2017 um 13:57

    Man kann das aber auch bei z.B. Firefox mit den Command Line Options machen

    Gruß gmmg

  • "Support Mail GUI"

    • gmmg
    • 22. August 2017 um 07:53

    Willst du das ganze in einem Firmennetzwerk mit Active Directory und Exchange betreiben?

    Wenn ja, kannst du auch den Usernamen und Email dynamisch auslesen.

    Gruß gmmg

  • Prozessliste mit Namen erstellen

    • gmmg
    • 2. August 2017 um 14:52

    Hier mal ein Beispiel, welches ich selbst ab und zu nutze.
    Hier werden die laufenden Prozesse in eine csv Datei geschrieben und ist auch im Netzwerk mit entsprechenden Rechten nutzbar.

    AutoIt
    #include <Array.au3>; Only for _ArrayDisplay()
    #include <File.au3>
    ; Install a custom error handler
    Local $oMyError = ObjEvent("AutoIt.Error","MyErrFunc"), $f_COMError = False
    
    
    ; Globals
    local $avRET, $iPID
    
    
    $Input = InputBox("Prozesse auslesen","Bitte den Clientnamen eingeben",@computername)
    If @error = 1 Then Exit
    
    
    ; Demonstrate listing all processes
    $avRET = _ProcessListProperties("", $Input)
    ;_ArrayDisplay($avRET, "All Processes")
    
    
    $Export = InputBox("Prozesse auslesen","Bitte den Export Pfad und Dateinamen eingeben",@HomeDrive & "\" & $Input & ".csv")
    ; Create a file in the users %TEMP% directory.
    Local $sFilePath = $Export
    
    
    ; Write array to a file by passing the file name.
    _FileWriteFromArray($sFilePath, $avRET, 1,Default,";")
    MsgBox(0,"","Fertig",2)
    
    
    ; This is my custom error handler
    Func MyErrFunc()
        Local $HexNumber=hex($oMyError.number,8)
        #CS Msgbox(0,"","We intercepted a COM Error !" & @CRLF & _
                    "Number is: " & $HexNumber & @CRLF & _
                    "WinDescription is: " & $oMyError.windescription & @CRLF & _
                    "Source is: " & $oMyError.source & @CRLF & _
                    "ScriptLine is: " & $oMyError.scriptline)
    	#CE
       ;$f_COMError = True; something to check for when this function returns
    Endfunc
    
    
    
    
    
    
    ;===============================================================================
    ; Function Name:    _ProcessListProperties()
    ; Description:   Get various properties of a process, or all processes
    ; Call With:       _ProcessListProperties( [$Process [, $sComputer]] )
    ; Parameter(s):  (optional) $Process - PID or name of a process, default is "" (all)
    ;          (optional) $sComputer - remote computer to get list from, default is local
    ; Requirement(s):   AutoIt v3.2.4.9+
    ; Return Value(s):  On Success - Returns a 2D array of processes, as in ProcessList()
    ;            with additional columns added:
    ;            [0][0] - Number of processes listed (can be 0 if no matches found)
    ;            [1][0] - 1st process name
    ;            [1][1] - 1st process PID
    ;            [1][2] - 1st process Parent PID
    ;            [1][3] - 1st process owner
    ;            [1][4] - 1st process priority (0 = low, 31 = high)
    ;            [1][5] - 1st process executable path
    ;            [1][6] - 1st process CPU usage
    ;            [1][7] - 1st process memory usage
    ;            [1][8] - 1st process creation date/time = "MM/DD/YYY hh:mm:ss" (hh = 00 to 23)
    ;            [1][9] - 1st process command line string
    ;            ...
    ;            [n][0] thru [n][9] - last process properties
    ; On Failure:      Returns array with [0][0] = 0 and sets @Error to non-zero (see code below)
    ; Author(s):        PsaltyDS at http://www.autoitscript.com/forum
    ; Date/Version:   12/01/2009  --  v2.0.4
    ; Notes:            If an integer PID or string process name is provided and no match is found,
    ;            then [0][0] = 0 and @error = 0 (not treated as an error, same as ProcessList)
    ;          This function requires admin permissions to the target computer.
    ;          All properties come from the Win32_Process class in WMI.
    ;            To get time-base properties (CPU and Memory usage), a 100ms SWbemRefresher is used.
    ;===============================================================================
    Func _ProcessListProperties($Process = "", $sComputer = ".")
        Local $sUserName, $sMsg, $sUserDomain, $avProcs, $dtmDate
        Local $avProcs[1][2] = [[0, ""]], $n = 1
    
    
        ; Convert PID if passed as string
        If StringIsInt($Process) Then $Process = Int($Process)
    
    
        ; Connect to WMI and get process objects
        $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate,authenticationLevel=pktPrivacy, (Debug)}!\\" & $sComputer & "\root\cimv2")
        If IsObj($oWMI) Then
            ; Get collection processes from Win32_Process
            If $Process == "" Then
                ; Get all
                $colProcs = $oWMI.ExecQuery("select * from win32_process")
            ElseIf IsInt($Process) Then
                ; Get by PID
                $colProcs = $oWMI.ExecQuery("select * from win32_process where ProcessId = " & $Process)
            Else
                ; Get by Name
                $colProcs = $oWMI.ExecQuery("select * from win32_process where Name = '" & $Process & "'")
            EndIf
    
    
            If IsObj($colProcs) Then
                ; Return for no matches
                If $colProcs.count = 0 Then Return $avProcs
    
    
                ; Size the array
                ReDim $avProcs[$colProcs.count + 1][10]
                $avProcs[0][0] = UBound($avProcs) - 1
    
    
                ; For each process...
                For $oProc In $colProcs
                    ; [n][0] = Process name
                    $avProcs[$n][0] = $oProc.name
                    ; [n][1] = Process PID
                    $avProcs[$n][1] = $oProc.ProcessId
                    ; [n][2] = Parent PID
                    $avProcs[$n][2] = $oProc.ParentProcessId
                    ; [n][3] = Owner
                    If $oProc.GetOwner($sUserName, $sUserDomain) = 0 Then $avProcs[$n][3] = $sUserDomain & "\" & $sUserName
                    ; [n][4] = Priority
                    $avProcs[$n][4] = $oProc.Priority
                    ; [n][5] = Executable path
                    $avProcs[$n][5] = $oProc.ExecutablePath
                    ; [n][8] = Creation date/time
                    $dtmDate = $oProc.CreationDate
                    If $dtmDate <> "" Then
                        ; Back referencing RegExp pattern from weaponx
                        Local $sRegExpPatt = "\A(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(?:.*)"
                        $dtmDate = StringRegExpReplace($dtmDate, $sRegExpPatt, "$2/$3/$1 $4:$5:$6")
                    EndIf
                    $avProcs[$n][8] = $dtmDate
                    ; [n][9] = Command line string
                    $avProcs[$n][9] = $oProc.CommandLine
    
    
                    ; increment index
                    $n += 1
                Next
            Else
                SetError(2); Error getting process collection from WMI
            EndIf
            ; release the collection object
            $colProcs = 0
    
    
            ; Get collection of all processes from Win32_PerfFormattedData_PerfProc_Process
            ; Have to use an SWbemRefresher to pull the collection, or all Perf data will be zeros
            Local $oRefresher = ObjCreate("WbemScripting.SWbemRefresher")
            $colProcs = $oRefresher.AddEnum($oWMI, "Win32_PerfFormattedData_PerfProc_Process" ).objectSet
            $oRefresher.Refresh
    
    
            ; Time delay before calling refresher
            Local $iTime = TimerInit()
            Do
                Sleep(20)
            Until TimerDiff($iTime) >= 100
            $oRefresher.Refresh
    
    
            ; Get PerfProc data
            For $oProc In $colProcs
                ; Find it in the array
                For $n = 1 To $avProcs[0][0]
                    If $avProcs[$n][1] = $oProc.IDProcess Then
                        ; [n][6] = CPU usage
                        $avProcs[$n][6] = $oProc.PercentProcessorTime
                        ; [n][7] = memory usage
                        $avProcs[$n][7] = $oProc.WorkingSet
                        ExitLoop
                    EndIf
                Next
            Next
        Else
            SetError(1); Error connecting to WMI
        EndIf
    
    
        ; Return array
        Return $avProcs
    EndFunc  ;==>_ProcessListProperties
    Alles anzeigen

    Gruß gmmg

  • Über Script Maustastendruck senden

    • gmmg
    • 1. August 2017 um 11:18

    so könnte das aussehen ....und auch ist nicht getestet

    Code
    #include <AutoItConstants.au3>
    
    
    start()
    
    
    Func start()
    
    
    	send({NUMPAD5})
    	sleep (1400)
    	send({NUMPAD0})
    	sleep (300)
    	MouseClick ("left")
    	sleep (300)
    	send({NUMPAD7})
    	sleep (300)
    	send({NUMPAD8})
    	sleep (300)
    	MouseDown($MOUSE_CLICK_RIGHT)
    	Sleep(50)
    	Send ("W")
    	MouseUp($MOUSE_CLICK_RIGHT)
    	Sleep(50)
    	MouseClick ("left")
    	sleep (150)
    	MouseClick ("left")
    	sleep (150)
    
    
    Endfunc()
    Alles anzeigen

    gruß gmmg

  • Über Script Maustastendruck senden

    • gmmg
    • 31. Juli 2017 um 11:46

    Für uns hier wäre es günstig, du würdest mal auflisten was das Makro bei dem jeweiligen Tastendruck 1-15 macht.

    Eventuell gibt es ja auch viel simplere Lösungen für das was du da machen möchtest :)

    gruß gmmg

  • Über Script Maustastendruck senden

    • gmmg
    • 28. Juli 2017 um 09:39

    Was für eingaben machst du denn sonst an dem PC über dein Maus Makro? Lässt sich das nicht über eine Task starten?
    Warum baust du nicht einfach dein Makro in Autoit nach? Die Software der Maus ja für Remotezugriffe nicht geeignet.

    Gruß gmmg

  • EXCEL _Excel_RangeFind ist zu langsam

    • gmmg
    • 15. Mai 2017 um 13:54

    Ich nehme an er das Script durchsucht alle möglichen Excel Zellen.

    Versuche doch mal die Suche mit dem Parameter $vRange einzuschränken. Beispiele sind in der Hilfe.

    Mögliche Ansätze sind auch UsedRange oder LastRow.

    Ein Ähnliches Thema wir hier behandelt Aus einer großen Exceltabelle was finden. _Excel_RangeFind zu langsam!

    Gruß gmmg

  • [Amfänger] - if FileExist, ich komme nicht weiter

    • gmmg
    • 19. April 2017 um 14:20

    Na da sollte das geänderte Skript von mir ja passen :)

    gruß gmmg

  • [Amfänger] - if FileExist, ich komme nicht weiter

    • gmmg
    • 19. April 2017 um 12:05

    Hallo mauric,

    in deinem Script sind paar kleine Fehler.

    Du fragst CSV Dateien ab, willst dann aber CVS Dateien verschieben. Was wäre jetzt richtig? Bitte entsprechend angleichen.
    Zum zweiten fragst du ab, ob eine Datei "A.csv" im Pfad C:\Temp\Looks\ existiert. Gibt es diese Datei auch wirklich oder willst du einfach abfragen ob irgendeine Datei Existiert.

    Ich habe dein Script mal angepasst.

    AutoIt
    #include <FileConstants.au3>
    
    
    Verschieben()
    
    
    Func Verschieben()
    ;; ----	From source CSV Files available, copy run
    
    
    	$DirFolder = "C:\Temp\Looks\"
    	$DirFolderBackup = "C:\Temp\Looks\Backup\"
    
    
    	If FileExists($DirFolder & "*.csv") Then
    		FileMove($DirFolder & "*.csv",$DirFolderBackup, 9)
    	Else
    		 MsgBox(1,"","Nothing todo",1);
    	EndIf
    EndFunc
    Alles anzeigen

    Gruß gmmg

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™