[Release]Code´s für AutoIt V3, Visual Basic und CMD

05/29/2010 19:14 _S4_Player_#1
Tutorial
@Bei falscher Sektion ..sry

Auto IT V3

Was es ist : _Date_Time_FileTimeToLocalFileTime

Code:
#include <GuiConstantsEx.au3>
#include <Date.au3>
#include <WindowsConstants.au3>

Global $iMemo

_Main()

Func _Main()
	Local $hGUI, $tFile, $tLocal

	; Create GUI
	$hGUI = GUICreate("Time", 400, 300)
	$iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL)
	GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
	GUISetState()

	; Get system time
	$tSystem = _Date_Time_GetSystemTime()
	$tFile = _Date_Time_SystemTimeToFileTime(DllStructGetPtr($tSystem))
	;	--------------------------------------
	$tLocal = _Date_Time_FileTimeToLocalFileTime(DllStructGetPtr($tFile))
	MemoWrite("Local file time .: " & _Date_Time_FileTimeToStr($tLocal))

	; Loop until user exits
	Do
	Until GUIGetMsg() = $GUI_EVENT_CLOSE

EndFunc   ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
	GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

Was es ist : _GUICtrlComboBoxEx_GetItem

Code:
#include <GuiComboBoxEx.au3>
#include <GuiImageList.au3>
#include <GuiConstantsEx.au3>

Opt('MustDeclareVars', 1)

$Debug_CB = False ; Check ClassName being passed to ComboBox/ComboBoxEx functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
	Local $hGUI, $hImage, $aItem, $hCombo
	
	; Create GUI
	$hGUI = GUICreate("ComboBoxEx Get Item", 400, 300)
	$hCombo = _GUICtrlComboBoxEx_Create ($hGUI, "", 2, 2, 394, 100)
	$iMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0)
	GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
	GUISetState()

	$hImage = _GUIImageList_Create (16, 16, 5, 3)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 110)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 131)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 165)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 168)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 137)
	_GUIImageList_AddIcon ($hImage, @SystemDir & "\shell32.dll", 146)
	_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0xFF0000, 16, 16))
	_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x00FF00, 16, 16))
	_GUIImageList_Add ($hImage, _GUICtrlComboBoxEx_CreateSolidBitMap ($hCombo, 0x0000FF, 16, 16))
	_GUICtrlComboBoxEx_SetImageList ($hCombo, $hImage)

	For $x = 0 To 8
		_GUICtrlComboBoxEx_AddString ($hCombo, StringFormat("%03d : Random string", Random(1, 100, 1)), $x, $x)
	Next

	;Set Item indent
	_GUICtrlComboBoxEx_SetItemIndent ($hCombo, 1, 1)

	$aItem = _GUICtrlComboBoxEx_GetItem ($hCombo, 1)
	MemoWrite("Item Text : " & $aItem[0])
	MemoWrite("Item Len ..........................: " & $aItem[1])
	MemoWrite("# image widths to indent ..........: " & $aItem[2])
	MemoWrite("Zero based item image index .......: " & $aItem[3])
	MemoWrite("Zero based item state image index .: " & $aItem[4])
	MemoWrite("Zero based item image overlay index: " & $aItem[5])
	MemoWrite("Item application defined value ....: " & $aItem[6])
	
	Do
	Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
	GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite
Was es ist : counter with msgbox(e)

Code:
;
; AutoIt Version: 3.0
; Language:       English
; Platform:       Win9x/NT
; Author:         Jonathan Bennett (jon at hiddensoft com)
;
; Script Function:
;   Counts to 5 using a "for" loop


; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)
$answer = MsgBox(4, "AutoIt Example", "This script will count to 5 using a 'For' loop.  Run?")


; Check the user's answer to the prompt (see the help file for MsgBox return values)
; If "No" was clicked (7) then exit the script
If $answer = 7 Then
	MsgBox(0, "AutoIt Example", "OK.  Bye!")
	Exit
EndIf


; Execute the loop 5 times
For $count = 1 To 5
	; Print the count
	MsgBox(0, "AutoIt Example", "Count is: " & $count)
Next
 
 
; Finished!
MsgBox(0, "AutoIt Example", "Finished!")
Was es ist : Tooltip (oben)

Code:
; AutoIt 3.1.1.x beta version
;
; COM Test file
;
; Test usage of AutoItX from within AutoItCOM

$oAutoIt = ObjCreate("AutoItX3.Control")
if @error then
	Msgbox(0,"AutoItX Test","Failed to open AutoItX. Error code: " & hex(@error,8))
	exit
endif


$oAutoIt.ClipPut("I am copied to the clipboard")

$text = $oAutoIt.ClipGet()

Msgbox(0,"Clipboard test","Clipboard contains: " & $text)

; This will create a tooltip in the upper left of the screen

Msgbox(0,"Tooltip test","Press OK to create a tooltip in the upper left corner.")

$oAutoIt.ToolTip("This is a tooltip", 0, 0)
$oAutoIt.Sleep(1000)     ; Sleep to give tooltip time to display

$var = $oAutoIt.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir")

Msgbox(0,"RegRead Test","Program files are in:" & $var)

Was es ist : BMPToJPG /BMP Datei in JPG Datei (Bild)

Code:
#include <GDIPlus.au3>

Opt("MustDeclareVars", 1)

; ===============================================================================================================================
; Description ...: Shows how to convert a BMP file to JPG
; Author ........: Paul Campbell (PaulIA)
; Notes .........:
; ===============================================================================================================================

; ===============================================================================================================================
; Global variables
; ===============================================================================================================================
Global $sImage, $hImage, $sCLSID

; Get BMP file to convert
$sImage = InputBox("BMP to JPG", "Enter File Name:", @MyDocumentsDir & "\Image.bmp", "", 200, 130)
if @Error or not FileExists($sImage) then Exit

; Initialize GDI+ library
_GDIPlus_StartUp()

; Load image
$hImage = _GDIPlus_ImageLoadFromFile($sImage)

; Get JPG encoder CLSID
$sCLSID = _GDIPlus_EncodersGetCLSID("JPG")

; Save image as JPG
_GDIPlus_ImageSaveToFileEx($hImage, @MyDocumentsDir & "\AutoItImage.jpg", $sCLSID)

; Shut down GDI+ library
_GDIPlus_ShutDown()
Was es macht : encrypt/decrypt
Hilfe (von) : AutoIt

Code:
;====================================================
;============= Encryption Tool With GUI =============
;====================================================
; AutoIt version: 3.0.103
; Language:       English
; Author:         "Wolvereness"
;
; ----------------------------------------------------------------------------
; Script Start
; ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>
#include <String.au3>
;#include files for encryption and GUI constants

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
	Local $WinMain, $EditText, $InputLevel, $InputPass, $UpDownLevel
	Local $EncryptButton, $DecryptButton, $string
	#forceref $UpDownLevel
;~~
	$WinMain = GUICreate('Encryption tool', 400, 400)
	; Creates window
;~~
	$EditText = GUICtrlCreateEdit('', 5, 5, 380, 350)
	; Creates main edit
;~~
	$InputPass = GUICtrlCreateInput('', 5, 360, 100, 20, 0x21)
	; Creates the password box with blured/centered input
;~~
	$InputLevel = GUICtrlCreateInput(1, 110, 360, 50, 20, 0x2001)
	$UpDownLevel = GUICtrlSetLimit(GUICtrlCreateUpdown($InputLevel), 10, 1)
	; These two make the level input with the Up|Down ability
;~~
	$EncryptButton = GUICtrlCreateButton('Encrypt', 170, 360, 105, 35)
	$DecryptButton = GUICtrlCreateButton('Decrypt', 285, 360, 105, 35)
	; Encryption/Decryption buttons
;~~
	GUICtrlCreateLabel('Password', 5, 385)
	GUICtrlCreateLabel('Level', 110, 385)
	; Simple text labels so you know what is what
;~~
	GUISetState()
	; Shows window
;~~

	While 1
		Switch GUIGetMsg()
			Case $GUI_EVENT_CLOSE
				ExitLoop
			Case $EncryptButton
				; When you press Encrypt
;~~
				GUISetState(@SW_DISABLE, $WinMain)
				; Stops you from changing anything
;~~
				$string = GUICtrlRead($EditText)
				; Saves the editbox for later
;~~
				GUICtrlSetData($EditText, 'Please wait while the text is Encrypted/Decrypted.')
				; Friendly message
;~~
				GUICtrlSetData($EditText, _StringEncrypt(1, $string, GUICtrlRead($InputPass), GUICtrlRead($InputLevel)))
				; Calls the encryption. Sets the data of editbox with the encrypted string
;~~
				GUISetState(@SW_ENABLE, $WinMain)
				; This turns the window back on
;~~
			Case $DecryptButton
				; When you press Decrypt
;~~
				GUISetState(@SW_DISABLE, $WinMain)
				; Stops you from changing anything
;~~
				$string = GUICtrlRead($EditText)
				; Saves the editbox for later
;~~
				GUICtrlSetData($EditText, 'Please wait while the text is Encrypted/Decrypted.')
				; Friendly message
;~~
				GUICtrlSetData($EditText, _StringEncrypt(0, $string, GUICtrlRead($InputPass), GUICtrlRead($InputLevel)))
				; Calls the encryption. Sets the data of editbox with the encrypted string
;~~
				GUISetState(@SW_ENABLE, $WinMain)
				; This turns the window back on
;~~
		EndSwitch
	WEnd
EndFunc   ;==>_Main
Das wars erstmal für AutoIt

Weiter geht´s mit Visual Basic..

Visual Basic

Was es macht : Progressbar ohne Timer laden lassen

Code:
For i As Integer = 1 To 100
            ProgressBar1.Value += 1
            System.Threading.Thread.Sleep(250)

            If ProgressBar1.Value = 100 Then
                MsgBox("Download abgeschlossen", MsgBoxStyle.Exclamation, "Info")
                ProgressBar1.Value = 0


            End If

        Next
Was es macht : Internet(URL)-seiten ,Programme(exe) oder Dateipfad öffnen

Code:
Dim x As New Process
        x.StartInfo.FileName = (TextBox1.Text)
        Try
            x.Start()

        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Critical, "Error")
        End Try
Was es macht : Wenn Textbox1 .text richtig geschrieben ist Label´s Text ändern (automatisch)
-> Quelltext für Automatisch bei / in Textbox eingeben (Quelltext Textbox)

Code:
 If TextBox1.Text = ("Elitepvpers*Coders") Then
            Label2.Text = ("Benutzername ist richtig..")
        Else
            Label2.Text = ("Der Benutzername ist falsch..")
        End If
Was es macht : Linklabel1´s text = Webbrowsers URL..(Seite)

Code:
LinkLabel1.Text = WebBrowser1.DocumentTitle
Das gleiche nochmal mit Form .text

Code:
Me.Text = WebBrowser1.DocumentTitle
Was es macht : Eine Internetseite (im Webbrowser) anzeigen ..(sofort hinführen)

Code:
WebBrowser1.Navigate("www.youtube.com")
Was es macht : WebBrowser soll zur Startseite (z.B Google)

Code:
WebBrowser1.GoHome()
Nun eine Seite zurück

Code:
WebBrowser1.GoBack
Eine Seite vor

Code:
WebBrowser1.GoForward()
Was es macht : Textbox´s text(z.B [Only registered and activated users can see links. Click Here To Register...]) suchen und beim WebBrowser anzeigen

Code:
 WebBrowser1.Navigate(TextBox1.Text)
Was es macht : Quelltext einer Seite zeigen (im Msgbox)

Code:
 MsgBox(WebBrowser1.DocumentText)

Was es macht : Ausgewählte Dateipfad in der Textbox anzeigen

Code:
Using Fb As New FolderBrowserDialog
            With Fb
                If .ShowDialog() = Windows.Forms.DialogResult.OK Then
                    TextBox1.Text = .SelectedPath
                End If
            End With
        End Using

Ich glaub die Code´s die nun kommen weiss jeder^^

Textbox1 text in Listbox´s Items einfügen

Code:
ListBox1.Items.Add(TextBox1.Text)
Listbox´s Items leeren

Code:
ListBox1.Items.Clear()
Textbox´s leeren

Code:
TextBox1.Clear()
Programm beenden xDD

Code:
End
oder einzelnde Forme schließen

Code:
Close
oder ...
Code:
Me.Close
Label5 soll die Items von Listbox zählen

Code:
Label5.Text = ListBox1.Items.Count
Label7 soll Datum (mit Zeit) zeigen

Code:
Label7.Text = DateTimePicker1.Value
Form Farbe ändern

Code:
Me.BackColor = Color.Yellow
oder

Code:
Me.BackColor = Color.BlueViolet
oder

Code:
Me.BackColor = Color.OrangeRed
oder mehrere ..
Einfach wo Color.OrangeRed steht ändern in z.B
Color.Blue

Nächste Form öffnen

Code:
Form2.show()
Msgbox zeigen

Code:
Msgbox("Halluu")
Msgbox zeigen + Style

Code:
 MsgBox("Hallu", MsgBoxStyle.Exclamation)
Msgbox zeigen + Style + Msgbox Name

Code:
 MsgBox("Hallu", MsgBoxStyle.Exclamation, "Hallu??")
Windows Status (Minimiert)

Code:
 Me.WindowState = FormWindowState.Minimized
Windows Status (Normal)

Code:
Me.WindowState = FormWindowState.Normal
Windows Status (Maximal)

Code:
Me.WindowState = FormWindowState.Maximized
Checkbox´s Farbe ändern

Code:
CheckBox1.ForeColor = Color.Black
Das müssen nicht alle können xDDD :

Task Manager (in Programm)

Code:
' Liste aller Prozesse ermitteln
    Private Sub Button1_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles Button1.Click

        Dim oItem As ListViewItem

        With ListView1
            ' ListView-Inhalt löschen
            .Items.Clear()


            ' alle Prozesse durchlaufen
            For Each oProcess As Process In Process.GetProcesses
                ' Prozess-Infos ermitteln und im ListView anzeigen
                oItem = .Items.Add(oProcess.ProcessName)
                Try
                    oItem.SubItems.Add(oProcess.MainModule.FileName)
                Catch
                    oItem.SubItems.Add("")
                End Try
                oItem.SubItems.Add(oProcess.Id.ToString)
            Next
        End With
        Button1.Text = "Aktuallisieren"

       

    End Sub
Prozess beenden

Code:
' Prozess beenden
    Private Sub Button8_Click(ByVal sender As System.Object, _
      ByVal e As System.EventArgs) Handles Button6.Click

        With ListView1
            If .SelectedItems.Count > 0 Then
                If MsgBox("Aktuellen Prozess wirklich beenden?", _
                  MsgBoxStyle.Question Or MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then

                    ' Prozess-Objekt anhand Prozess-ID erstellen
                    Dim oProccess As Process = Process.GetProcessById( _
                      Val(.SelectedItems(0).SubItems(2).Text))
                    Try
                        ' Prozess beenden/zerstören
                        oProccess.Kill()
                    Catch ex As Exception
                        ' Fehlermeldung...
                        MsgBox("Fehler beim Beenden des Prozess." & vbCrLf & ex.Message.ToString, MsgBoxStyle.Critical)
                    End Try
                End If
            End If
        End With
        Dim oItem As ListViewItem
        With ListView1
            ' ListView-Inhalt löschen
            .Items.Clear()


            ' alle Prozesse durchlaufen
            For Each oProcess As Process In Process.GetProcesses
                ' Prozess-Infos ermitteln und im ListView anzeigen
                oItem = .Items.Add(oProcess.ProcessName)
                Try
                    oItem.SubItems.Add(oProcess.MainModule.FileName)
                Catch
                    oItem.SubItems.Add("")
                End Try
                oItem.SubItems.Add(oProcess.Id.ToString)
            Next
        End With
        Button1.Text = "Aktuallisieren"

Passwort eingeben..
Ist es aber 3 mal falsch dann Programm beenden ;D

Code:
 Private x As Integer
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

        If TextBox1.Text = "55122" Then



            MsgBox("Richtiges Passwort", MsgBoxStyle.Information, "Richtiges Passwort")
            MsgBox("Willkommen :D!", MsgBoxStyle.Information, "Viel Spaß!")


            Form9.Show()





        Else
            MsgBox("Falsches Passwort", MsgBoxStyle.Critical, "Falsches Passwort!")
            MsgBox("Falsches Passwort!", MsgBoxStyle.Exclamation, "Falsches Passwort!")
            MsgBox("Nur noch ..Versuche", MsgBoxStyle.Critical, "Fehler")

            x += 1
            If x = 3 Then
                End

            End If

        End If



WARNUNG :
Das funktioniert NICHT immer

Standby (Bildschirm = aus)


Code:
#Region "StandBy"
    ' Timer-Objekt für das Einschalten des Monitors
    Dim WithEvents oTimer As Timer

    ''' <summary>
    ''' Klasse für Zugriff auf API-Funktion "SendMessage"
    ''' </summary>
    Public Class Monitor
        ''' <summary>
        ''' DLL-Deklaration der SendMessage-API
        ''' </summary>
        <DllImport("user32.dll", EntryPoint:="SendMessageA")> _
        Private Shared Sub SendMessage( _
          ByVal hWnd As IntPtr, _
          ByVal uMsg As Int32, _
          ByVal wParam As Int32, _
          ByVal lParam As Int32)
        End Sub

        ''' <summary>
        ''' Benötigte Konstanten für die SendMessage API-Funktion
        ''' </summary>
        Private Enum Params As Int32
            SC_MONITORPOWER = &HF170    ' wParam
            WM_SYSCOMMAND = &H112       ' uMsg
            TURN_MONITOR_OFF = 2        ' Monitor ausschalten
            TURN_MONITOR_ON = -1        ' Monitor einschalten
        End Enum

        ''' <summary>
        ''' Schaltet den Monitor entweder ein- oder aus
        ''' </summary>
        ''' <param name="Index">off = ausschalten / on = einschalten</param>
        ''' <param name="Handle">Handle der aufrufenden Anwendung</param>
        Public Shared Sub SetMonitorState(ByVal Index As String, ByVal Handle As IntPtr)
            Select Case Index
                Case "off"
                    ' Schaltet den Monitor aus
                    SendMessage(Handle, Params.WM_SYSCOMMAND, Params.SC_MONITORPOWER, _
                      Params.TURN_MONITOR_OFF)
                Case "on"
                    ' Schaltet den Monitor wieder ein
                    SendMessage(Handle, Params.WM_SYSCOMMAND, Params.SC_MONITORPOWER, _
                      Params.TURN_MONITOR_ON)
            End Select
        End Sub
    End Class

#End Region
Code:
Monitor.SetMonitorState("off", Me.Handle)

CMD
Passwort ändern (ohne den alten zu wissen)
Code:
net user
Code:
net user EUER BENUTZER *
Das * muss dabei sein!

Hilfe
Code:
help
Mehr ..
Code:
net



@Release...
Next :
Mehr über AutoIt
@Edit
Sorry hab viele Rechtschreib-und Grammatikfehler
Schnell gemacht^^

Für Hilfe ,Fehler (QuellText/Code (s)) korregieren /bescheid sagen..


Viel Spaß!
05/29/2010 20:07 omer36#2
1. ist das kein tutorial.. gehöhrt eher zu den [Only registered and activated users can see links. Click Here To Register...] (?!)
und 2. hast du die sachen doch nur aus dem install. -order gefunden und rauskopiert...(zumindest die von autoit) ....
05/29/2010 20:51 Jay Niize#3
kann meine mVorposter zustimmen, und wozu braucht man das? wenn man eine sprache lernen will, guckt man sich ein ganzes Tutorial an und nicht einfach solche Fetzen, die aus 1-2 Sätzen bestehn! Nicht gut

#closerequest
06/11/2010 20:55 warstar14#4
kriegst thx weil es mir geholfen hat nice^^