Danke, nun habe ich das Problem gelöst. ![]()
Beiträge von Nestos
-
-
Weil StringSplit normalerweiße ein Array zurückgibt und meine Variable schon ein Array ist.
Wenn du in Zeile 11
[autoit]_ArrayDisplay($Files_Split_Split[0])
[/autoit]
einfügst, wird auch aus dem 2D Array rausgelesen.Und zu dem $i, dass kam von der For Next Schleife. Ich hab das mal schnell ausgebessert.
-
Hallo alle zusammen, ich bins wiedermal.

Ich habe folgendes Problem:
Ich habe einen String, den ich mit StringSplit in 2 und dann beide in 6 Teile spliten will. Das klappt ja auch ganz gut, nur wenn ich mit GUICtrlSetData versuche das letzte (6) Element des 1 Splits in ein Edit einzufügen, bekomm ich immer einen Error.Hier das Script:
[autoit]
[/autoit][autoit][/autoit][autoit]
Global $Files = "x\xx\xxx\xxxx\xxxxx\xxxxxxx" _
& "&" _
& "x\xx\xxx\xxxx\xxxxx\xxxxxxx"Global $Files_Split = StringSplit($Files, "&")
[/autoit][autoit][/autoit][autoit]
Global $Files_Split_Split[$Files_Split[0]]For $t = 1 To $Files_Split[0] Step +1
[/autoit][autoit][/autoit][autoit]
$Files_Split_Split[$t - 1] = StringSplit($Files_Split[$t], "\")
Next$hGUI = GUICreate("xxx", 500, 500, -1, -1)
[/autoit][autoit][/autoit][autoit]$Edit1_Saison5 = GUICtrlCreateEdit("", 0, 0, 500, 500)
[/autoit][autoit][/autoit][autoit]GUISetState(@SW_SHOW, $hGUI)
[/autoit][autoit][/autoit][autoit]For $i = 1 To $Files_Split[0] Step +1
[/autoit][autoit][/autoit][autoit]
GUICtrlSetData($Edit1_Saison5, $Files_Split_Split[$i - 1][$Files_Split_Split[$i - 1][0]])
NextWhile 1
[/autoit]
Sleep(100)
WEndWo liegt hier der Fehler?
Danke schonmal für die Antworten.
MfG
H2112Edit: Thema hat sich erledigt!
-
Soweit ich das verstanden habe, könntest du das so lösen:
[autoit]$CheckboxR = GUICtrlCreateCheckbox("", 32, 64, 17, 17)
[/autoit][autoit][/autoit][autoit]
GUICtrlSetOnEvent($CheckboxR, "_CheckBoxen")
$CheckboxS = GUICtrlCreateCheckbox("", 32, 88, 17, 17)
GUICtrlSetOnEvent($CheckboxR, "_CheckBoxen")
$CheckboxT = GUICtrlCreateCheckbox("", 32, 112, 17, 17)
GUICtrlSetOnEvent($CheckboxR, "_CheckBoxen")Func _CheckBoxen()
[/autoit]
Select
Case @GUI_CtrlId = $CheckboxR
GUICtrlSetState($CheckBoxS, $GUI_UNCHECKED)
GUICtrlSetState($CheckBoxT, $GUI_UNCHECKED)
Case @GUI_CtrlId = $CheckboxS
GUICtrlSetState($CheckBoxT, $GUI_UNCHECKED)
GUICtrlSetState($CheckBoxR, $GUI_UNCHECKED)
Case @GUI_CtrlId = $CheckboxT
GUICtrlSetState($CheckBoxR, $GUI_UNCHECKED)
GUICtrlSetState($CheckBoxS, $GUI_UNCHECKED)
EndSelect
EndFuncIs nur mal schnell geschrieben.

-
Dein Editor ist echt super gewordenn! Top.

-
Danke für die schnelle Antwort!
Das hat mir sehr weitergeholfen.
-
Da bin ich wieder.

Ich habe folgendes problem:
Ich will alle Ordner (Keine Unterordner) aus dem Pfad(C:\Dokumente und Einstellungen\UserName\Startmenü\Programme) auslesen und dann deren Pfade wiedergeben.Nur ich bekomm das irgendwie nicht hin und bitte euch daher um Hilfe.
Danke schonmal für die Antworten.
MfG
H2112Edit: Hat sich gelöst!
-
Ah Danke, dass geht soweit gut.

Thema hat sich erledigt!
-
Das hab ich auch schon versucht
[autoit]GUISetIcon("schell32.dll", -50)
[/autoit]
Aber da bleibt so ein Abstand, den ich eben weg haben will.
-
Morgen alle zusammen.

Ich hätte mal eine kleine Frage:
Wie bekomm ich hin, dass die GUI kein Icon hat?Mit
[autoit]GUISetIcon("")
[/autoit]
geht es nicht.
Danke schonmal für die Antworten..

-
Ich kann dein Script kaum lesen, aber ich sag dir mal wies geht:
Am Ende der GUI
[autoit]GUICtrlCreatePic(@ScriptDir & "\test.bmp", 0, 0, xxx, xxx, $SS_NOTIFY) ; xxx einfach durch länge und breite des Bildes ersetzen
[/autoit] -
[autoit]
#include <ButtonConstants.au3>
[/autoit][autoit][/autoit][autoit][/autoit][autoit]
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>$Form1 = GUICreate("Form1", 633, 447, 192, 124)
[/autoit][autoit][/autoit][autoit]
$Input1 = GUICtrlCreateInput("" , 24, 24, 121, 21)
$Edit1 = GUICtrlCreateEdit("", 24, 112, 569, 305)
$Button1 = GUICtrlCreateButton("Schreiben", 168, 24, 75, 25, 0)
GUISetState(@SW_SHOW)While 1
[/autoit]
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
GUICtrlSetData($Edit1 ,GUICtrlRead($Input1), 1)
EndSwitch
WEnd
Befehl der fehlte:
[autoit]GUICtrlRead($input1)
[/autoit]Edit: Sry, korregiert

-
Eine Frage:
Wie hast du das TrayMenu eigentlich so hinbekommen?
Und zu deiner Frage:
Ja das reicht vollkommen aus.Edit:
Thx
-
Wirklich ein super Programm!

ich bin einfach nur begeistert!Nur einen klinen Rechtschreibfehler hab ich gefunden ;P
favouriten = favoriten
-
Ich hab mal eine ganz simple Oberfläche für ein Rechenprogramm geschrieben.

Das wäre nur einmal ein Grundgerüst und könnte noch mit Bildern und anderen Sachen verschönert werden.Spoiler anzeigen
[autoit]#include <GUIConstantsEx.au3>
[/autoit] [autoit][/autoit] [autoit]
#include <StaticConstants.au3>
#include <WindowsConstants.au3>Opt("GUIOnEventMode", 1)
[/autoit] [autoit][/autoit] [autoit]Global $Addition[5]
[/autoit] [autoit][/autoit] [autoit]
Global $Subtraktion[5]
Global $Multiplikation[5]
Global $Division[5]#Region ### START MainGUI section ###
[/autoit] [autoit][/autoit] [autoit]
$Rechenprogramm = GUICreate("Rechenprogramm", 350, 470, -1, -1)
GUISetBkColor(0x800080, $Rechenprogramm)
GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents")
$Willkommen = GUICtrlCreateLabel("Willkommen", 50, 20, 250, 50, $SS_CENTER)
GUICtrlSetFont($Willkommen, 32, 400, 0, "Arial")
$Waehle = GUICtrlCreateLabel("Wähle bitte ein Verfahren aus", 50, 80, 250, 25, $SS_CENTER)
GUICtrlSetFont($Waehle, 14, 400, 0, "Arial")$Auswahl = GUICtrlCreateGroup("", 25, 125, 300, 330)
[/autoit] [autoit][/autoit] [autoit]
$Addition[0] = GUICtrlCreateLabel("Addition", 50, 165, 250, 50, $SS_CENTER)
GUICtrlSetFont($Addition[0], 30, 400, 0, "Arial")
GUICtrlSetCursor($Addition[0], 0)
$Addition[1] = GUICtrlCreateLabel("", 50, 165, 250, 2)
GUICtrlSetBkColor($Addition[1], 0x000000)
$Addition[2] = GUICtrlCreateLabel("", 50, 165, 2, 50)
GUICtrlSetBkColor($Addition[2], 0x000000)
$Addition[3] = GUICtrlCreateLabel("", 50, 213, 250, 2)
GUICtrlSetBkColor($Addition[3], 0x000000)
$Addition[4] = GUICtrlCreateLabel("",298, 165, 2, 50)
GUICtrlSetBkColor($Addition[4], 0x000000)
$Subtraktion[0] = GUICtrlCreateLabel("Subtraktion", 50, 235, 250, 50, $SS_CENTER)
GUICtrlSetFont($Subtraktion[0], 30, 400, 0, "Arial")
GUICtrlSetCursor($Subtraktion[0], 0)
$Subtraktion[1] = GUICtrlCreateLabel("", 50, 235, 250, 2)
GUICtrlSetBkColor($Subtraktion[1], 0x000000)
$Subtraktion[2] = GUICtrlCreateLabel("", 50, 235, 2, 50)
GUICtrlSetBkColor($Subtraktion[2], 0x000000)
$Subtraktion[3] = GUICtrlCreateLabel("", 50, 283, 250, 2)
GUICtrlSetBkColor($Subtraktion[3], 0x000000)
$Subtraktion[4] = GUICtrlCreateLabel("",298, 235, 2, 50)
GUICtrlSetBkColor($Subtraktion[4], 0x000000)
$Multiplikation[0] = GUICtrlCreateLabel("Multiplikation", 50, 305, 250, 50, $SS_CENTER)
GUICtrlSetFont($Multiplikation[0], 30, 400, 0, "Arial")
GUICtrlSetCursor($Multiplikation[0], 0)
$Multiplikation[1] = GUICtrlCreateLabel("", 50, 305, 250, 2)
GUICtrlSetBkColor($Multiplikation[1], 0x000000)
$Multiplikation[2] = GUICtrlCreateLabel("", 50, 305, 2, 50)
GUICtrlSetBkColor($Multiplikation[2], 0x000000)
$Multiplikation[3] = GUICtrlCreateLabel("", 50, 353, 250, 2)
GUICtrlSetBkColor($Multiplikation[3], 0x000000)
$Multiplikation[4] = GUICtrlCreateLabel("",298, 305, 2, 50)
GUICtrlSetBkColor($Multiplikation[4], 0x000000)
$Division[0] = GUICtrlCreateLabel("Division", 50, 375, 250, 50, $SS_CENTER)
GUICtrlSetFont($Division[0], 30, 400, 0, "Arial")
GUICtrlSetCursor($Division[0], 0)
$Division[1] = GUICtrlCreateLabel("", 50, 375, 250, 2)
GUICtrlSetBkColor($Division[1], 0x000000)
$Division[2] = GUICtrlCreateLabel("", 50, 375, 2, 50)
GUICtrlSetBkColor($Division[2], 0x000000)
$Division[3] = GUICtrlCreateLabel("", 50, 423, 250, 2)
GUICtrlSetBkColor($Division[3], 0x000000)
$Division[4] = GUICtrlCreateLabel("",298, 375, 2, 50)
GUICtrlSetBkColor($Division[4], 0x000000)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END MainGUI section ###While 1
[/autoit] [autoit][/autoit] [autoit]
_mouseover($Rechenprogramm, $Addition[0], 50, 192, 250, 50)
_mouseover($Rechenprogramm, $Subtraktion[0], 50, 262, 250, 50)
_mouseover($Rechenprogramm, $Multiplikation[0], 50, 332, 250, 50)
_mouseover($Rechenprogramm, $Division[0], 50, 402, 250, 50)
Sleep(100)
WEndFunc SpecialEvents()
[/autoit] [autoit][/autoit] [autoit]
Select
Case @GUI_CtrlId = $GUI_EVENT_CLOSE
Exit
EndSelect
EndFuncFunc _mouseover($hWin, $hLabel, $x, $y, $w, $h)
[/autoit]
$aMousePos = MouseGetPos()
$aWinPos = WinGetPos(WinGetTitle($hWin))
IF $aMousePos[0] > $aWinPos[0]+$x AND $aMousePos[0] < $aWinPos[0]+$x+$w AND $aMousePos[1] > $aWinPos[1]+$y AND $aMousePos[1] < $aWinPos[1]+$y+$h Then
GUICtrlSetColor($hLabel, 0xFFFFFF)
Else
GUICtrlSetColor($hLabel, 0x000000)
EndIf
EndFunc -
-
Ich hab das Script nur ein bisscehn an meinem Computer angepasst und es dann hiergepostet.

Ich will es nicht klauen oder sonstwas, wollte nur eine Möglichkeit vorstellen, wie man das mit Passwort machen könnte.
Und wegen dem TrayMenu:
Ich hab es nur auskommentiert, da ich selber wenig mit TrayMenu anfangen kann (War aber sehr schön gemacht, hab jetzt auch verstanden, wie man GUIOnEventMode im TrayMenu verwendet). -
Also bei mir funktioniert eigentlich alles.

Edit: Beim starten des Programms wäre es gut, wenn du den USB-Stick stecken hast. Dann kann er den Registryeintrag lesen.

-
Danke für die Antwort.

Ich habs jetzt so versucht, funktioniert aber irgendwie nicht.
[autoit]
RegWrite("HKEY_CURRENT_USER\ Software\ Microsoft\ Windows\ CurrentVersion\ Policies\ Explorer", "NoChangeStartMenu", "REG_DWORD", 1)
[/autoit]ich bin leider in dem Gebiet ein Anfänger, also bitte nicht aufregen.
-
So ich hab mal ein InputFeld für ein Passwort hinzugefügt, falls man mal den USB-Stick nicht findet:
Spoiler anzeigen
[autoit];~ #RequireAdmin
[/autoit] [autoit][/autoit] [autoit]
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=Desktopsperre.ico
#AutoIt3Wrapper_outfile=Desktopsperre.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Fileversion=1.2.0.0
#AutoIt3Wrapper_Res_LegalCopyright=Oscar
#AutoIt3Wrapper_Res_Language=1031
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#NoTrayIcon
#include <StaticConstants.au3>
#include <GUIConstantsEx.au3>
#include <MenuConstants.au3>
#include <SendMessage.au3>
#include <WindowsConstants.au3>
#include <Misc.au3>Opt('GUIOnEventMode', 1)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Global $sTitle = 'Desktopsperre v1.2'
[/autoit] [autoit][/autoit] [autoit]
If _Singleton($sTitle, 1) = 0 Then
MsgBox(48, "Error " & $sTitle, 'Das Programm läuft bereits!')
Exit
EndIf
Global $Password = "Password"
Global $sIni = @ScriptDir & '\Desktopsperre.ini'
If Not IsDeclared('WM_DEVICECHANGE') Then Global Const $WM_DEVICECHANGE = 0x0219
Global Const $Off = 2, $On = -1
Global $hMonitor = WinGetHandle('classname=Progman')
Global $startmenu = WinGetHandle("[class:DV2ControlHost]")
$taskbar_pos = WinGetPos("[class:Shell_TrayWnd]")
Global $bLock = False
Global $usbstor = 'HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbstor\Enum'
RegRead($usbstor, 'count')
If @error Then Exit MsgBox(48, "Error " & $sTitle, 'Konnte Registryeintrag nicht lesen!')Global $sID = IniRead($sIni, 'ID', '1', '')
[/autoit] [autoit][/autoit] [autoit]
If $sID = '' Then _RegID()
;~ TraySetIcon(@ScriptDir & '\Desktopsperre.ico')
;~ TrayCreateItem('USB-Stick registrieren')
;~ TrayItemSetOnEvent(-1, '_RegID')
;~ TrayCreateItem('')
;~ TrayCreateItem('Programm beenden')
;~ TrayItemSetOnEvent(-1, '_End')$hGui = GUICreate($sTitle, 0, 0, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW)
[/autoit] [autoit][/autoit] [autoit]
GUISetBkColor(0x000000, $hGui)
$Label1 = GUICtrlCreateLabel('GESPERRT', @DesktopWidth/2-160, @DesktopHeight/2-110, 320, 60, $SS_CENTER)
GUICtrlSetFont($Label1, 42, 600, 0, 'Arial')
GUICtrlSetColor($Label1, 0xEE4444)
GUICtrlSetBkColor($Label1, $GUI_BKCOLOR_TRANSPARENT)
$Label2 = GUICtrlCreateLabel("Bitte stecken sie den registrierten USB-Stick oder geben Sie ein gültiges Passwort ein, um die Sperre aufzuheben", @DesktopWidth/2-160, @DesktopHeight/2-40, 320, 60, $SS_CENTER)
GUICtrlSetFont($Label2, 12, 600, 0, 'Arial')
GUICtrlSetColor($Label2, 0xEE4444)
GUICtrlSetBkColor($Label2, $GUI_BKCOLOR_TRANSPARENT)
$PasswordInput = GUICtrlCreateInput("", @DesktopWidth/2-170, @DesktopHeight/2+30, 340, 60, 0x0020)
GUICtrlSetFont($PasswordInput, 36, 600, 0, 'Arial')
GUICtrlSetColor($PasswordInput, 0xEE4444)
GUICtrlSetCursor($PasswordInput, 5)
$ExitButton = GUICtrlCreateButton("Beenden", 50, 32, 100, 22)
GUICtrlSetOnEvent($ExitButton, "_End")
GUICtrlSetState($ExitButton, $GUI_HIDE)$RestoreButton = GUICtrlCreateButton("Wiederherstellen", 50, 62, 100, 22)
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]
GUICtrlSetOnEvent($RestoreButton, "_Restore")GUISetState(@SW_SHOW, $hGui)
[/autoit] [autoit][/autoit] [autoit]WinSetTrans($hGui, '', 245)
[/autoit] [autoit][/autoit] [autoit]
GUIRegisterMsg($WM_DEVICECHANGE, 'MY_WM_DEVICECHANGE')While 1
[/autoit] [autoit][/autoit] [autoit]
sleep(10)
If $bLock() Then
;~ _ToggleMonitor($hMonitor, $Off)
GUICtrlSetState($RestoreButton, $GUI_HIDE)
GUICtrlSetState($ExitButton, $GUI_HIDE); Exit Button ausblenden
WinMove($sTitle, "", 0, 0, @DesktopWidth, @DesktopHeight); Fenster über den ganzen Bildschirm ausbreiten
_MouseTrap(@DesktopWidth/2-170, @DesktopHeight/2+30, @DesktopWidth/2-170+340, @DesktopHeight/2+30+60); Maus über der Inputbox einfrieren
WinKill("Windows Task-Manager"); TaskManager schließen
WinSetOnTop("Desktopsperre v1.2", "", 1); Fenster über alles andere legen
WinSetState("[class:Shell_TrayWnd]", "", @SW_HIDE); TasBar ausblenden
WinKill("[class:DV2ControlHost]"); Startmenü unter dem Fenser zeigen
If GUICtrlRead($PasswordInput) = $Password Then; $PasswordInput überprüfen
GUICtrlSetState($RestoreButton, $GUI_SHOW); Wiederherstellen Button einblenden
$bLock = False
EndIf
Else
;~ _ToggleMonitor($hMonitor, $On)
_MouseTrap(); Maus wieder freigeben
WinSetOnTop("Desktopsperre v1.2", "", 0); Fenster legt sich nichtmehr über alles andere
GUICtrlSetState($ExitButton, $GUI_SHOW); Exit Button einblenden
GUICtrlSetData($PasswordInput, ""); $PasswordInput leeren
WinMove($sTitle, "", @DesktopWidth/1.2, @DesktopHeight/1.5 + 200, @DesktopWidth, @DesktopHeight); Fenster an ins untere rechte Eck verschieben
WinSetState("[class:Shell_TrayWnd]", "", @SW_SHOW); TasBar einblenden
EndIf
Wend; Schleife fortsetzenFunc MY_WM_DEVICECHANGE($hWnd, $Msg, $wParam, $lParam)
[/autoit] [autoit][/autoit] [autoit]
$bLock = True
For $count = 0 To RegRead($usbstor, 'count') - 1; Schleife für alle USB-Wechseldatenträger
If $sID = RegRead($usbstor, $count) Then $bLock = False
Next
EndFuncFunc _RegID()
[/autoit] [autoit][/autoit] [autoit]
Local $count
MsgBox(0, $sTitle, 'Falls der USB-Stick momentan eingesteckt ist,' & @CRLF & 'bitte entfernen und dann auf [Ok] klicken!')
$count = RegRead($usbstor, 'count')
MsgBox(0, $sTitle, 'Bitte jetzt den USB-Stick einstecken!' & @CRLF & 'Er wird automatisch erkannt.', 5)
While RegRead($usbstor, 'count') = $count
Sleep(100)
WEnd
$count = RegRead($usbstor, 'count')
$sID = RegRead($usbstor, $count - 1)
IniWrite($sIni, 'ID', '1', $sID)
MsgBox(0, $sTitle, 'Dieser USB-Stick ist nun zum ent-/sperren des Desktop registriert!', 5)
EndFuncFunc _End()
[/autoit] [autoit][/autoit] [autoit]
$ExitMessage = MsgBox(36, "Meldung " & $sTitle, 'Programm beenden?')
If $ExitMessage = 6 Then
Exit
EndIf
EndFuncFunc _ToggleMonitor($hwnd, $OnOff)
[/autoit] [autoit][/autoit] [autoit]
Local Const $WM_SYSCOMMAND = 0x0112
Local Const $SC_MONITORPOWER = 0xF170
_SendMessage($hWnd, $WM_SYSCOMMAND, $SC_MONITORPOWER, $OnOff)
If @error Then Exit MsgBox(0, $sTitle, '_SendMessage Error: ' & @error)
EndFuncFunc _Restore()
[/autoit]
$bLock = True
EndFuncNur stört mich, wenn man nun START drückt, blinkt das Startmenü kurz über der GUi auf. Habe bis jetzt noch keine Lösung dafür gefunden.
