Hallo allerseits,
ich bin neu in Autoit. Ich habe versucht eine GUI zum Aufruf diverser Scripte zu erstellen, so weit steht sie schon, aber aus irgend einem Grund gelingt es mit nicht den Button Aktionen zuzuweisen (Abschnitt durch ;;;; markiert, er findet angeblich die ButtonIDs nicht, aber die sind doch da? Vielleihct seh ich den Baum vor lauter Bäümen nicht. Kann mir einer auf die Sprünge helfen? Das wäre super nett
C
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.5
Author: myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinApi.au3>
FileInstall( "C:\Users\Riegert\Pictures\DSC04006.JPG", "C:\Windows\Temp\hg.jpg", 1 )
Global $RBOX_EVENT_CLOSE = 1
Global $ROUNDES = 20, $LastHwnd = 0
Global $GUIBKCOLOR = 0x3D96F6
Global $ARRAY_COLOR_TOP_MIN[3] = [36 ,65 ,142] , $ARRAY_COLOR_TOP_MAX[3] = [11 ,42 ,122]
_SQL()
Local $hGui = RBoxCreate("PC INTEGRATOR Version 4.0",800,600)
Local $idButton_1 = GUICtrlCreateButton("Customize PC", 10, 55, 100, 20)
Local $idButton_2 = GUICtrlCreateButton("Image-Prepare", 130, 55, 100, 20)
Local $idButton_3 = GUICtrlCreateButton("DL aktualisieren", 250, 55, 100, 20)
Local $idButton_4 = GUICtrlCreateButton("RegSettings", 370, 55, 100, 20)
Local $idButton_5 = GUICtrlCreateButton("Customize PC", 490, 55, 85, 20)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Local $iPID = 0
; Loop until the user exits.
While 1
Case $idButton_1
Run Notepad with the window maximized.
$iPID = Run("C:\Users\Administrator\Downloads\PC-Einrichtung\PCSETTING_listv2.cmd", "", 10)
Case $idButton_2
$iPID = SoundPlay ( "C:\Users\xyz\Music\AUDIO\sampler\abc.wav")
Else
; $prog = ShellExecute("C:\Server\bin\Apache24\conf\httpd.conf")
; EndIf
EndSwitch
WEnd
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
While 1
CheckX($hGui,$RBOX_EVENT_CLOSE,"GuiCtrlSetColor("&$RBOX_EVENT_CLOSE&",0xA3A3A3)","GuiCtrlSetColor("&$RBOX_EVENT_CLOSE&",0x555555)")
$gMsg = GUIGetMsg()
Switch $gMsg
Case $RBOX_EVENT_CLOSE, $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func RBoxCreate($Title,$width, $height ,$left=-1 ,$top=-1 ,$show=1)
Local $GUI = GUICreate($Title,$width,$height,$left,$top,$WS_POPUP)
GUISetBkColor($GUIBKCOLOR,$GUI)
;GUISetFont(9, 100, italic)
GUISetFont (-1,9, 900); bold
GUICtrlCreatePic('C:\Windows\Temp\hg.jpg', 0, 25, 920, 660)
;GUICtrlCreatePic('C:\Users\Riegert\Pictures\DSC04006.JPG', 0, 25, 920, 660)
$RBOX_EVENT_CLOSE = GUICtrlCreateLabel('X',$width-20,3,25,25)
GUICtrlSetCursor($RBOX_EVENT_CLOSE,0)
GUICtrlSetBkColor($RBOX_EVENT_CLOSE,-2)
GUICtrlSetFont($RBOX_EVENT_CLOSE,15,800)
GUICtrlSetColor($RBOX_EVENT_CLOSE,0xFFFFFF)
$Title &= " "
;LABELS
GUICtrlCreateLabel ("CUSTOMIZING Local DB-Server: &$st",10,35,980,20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont (-1,9, 800); bold
GUICtrlCreateLabel ("Einzelmodule",10,120,780,20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont (-1,9, 900); bold
GUICtrlCreateLabel ("System-Wartung und Checks",10,220,780,20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont (-1,9, 900); bold
GUICtrlCreateLabel ("Datenbank",10,420,780,20)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetFont (-1,9, 900); bold
GUICtrlCreateLabel("_____________________________________________________________________________________________________________________________________ ", 0, 95, 900)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateLabel("_____________________________________________________________________________________________________________________________________ ", 0, 200, 900)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateLabel("_____________________________________________________________________________________________________________________________________ ", 0, 400, 900)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateLabel("_____________________________________________________________________________________________________________________________________", 0, 530, 900)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlCreateLabel("_____________________________________________________________________________________________________________________________________", 0, 555, 900)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
;guictrlcreatelabel("You've completed " & $st & "runs.",100,25,100,25,$SS_CENTER)
Local $hTitle = GUICtrlCreateLabel($Title,0,0,$width-20,26,$SS_CENTER,$GUI_WS_EX_PARENTDRAG)
GUICtrlSetFont($hTitle,17,400,0,"Consolas")
GUICtrlSetBkColor($hTitle,-2)
Local $Graphic = GUICtrlCreateGraphic (0,0, $width, 25)
GUICtrlSetState($Graphic,$Gui_DISABLE)
If $show = 1 Then GUISetState(@SW_SHOW,$GUI)
Return $GUI
EndFunc
Func CheckX($hGui, $CtrlID, $sCMD, $eCMD)
Local $cGui = GUIGetCursorInfo($hGui)
If Not IsArray($cGui) Then Return 0
if $LastHwnd <> $cGui[4] And $cGui[4] = $CtrlID Then Return Execute($sCMD) + Assign("LastHwnd",$cGui[4])
if $LastHwnd <> $cGui[4] Then Return Execute($eCMD) + Assign("LastHwnd",$cGui[4])
EndFunc
Func _SQL()
$SeviceName = "SQL Server (AUGIAS)" ;name of the service to test
RunWait(@ComSpec & " /c net start > c:\temp\services.txt", "", @SW_HIDE);send a list of the services that are running to a file
$FileText = FileRead("c:\temp\services.txt", FileGetSize("c:\temp\services.txt"));read that file
If StringInStr($FileText, $SeviceName) Then;check for the service name
$st = "RUNNING"
Else
$st = "OFF"
EndIf
EndFunc ;==>_test
Alles anzeigen
LG Chris