Hallo Community
Ich möchte euch hiermit meinen UDF_Builder vorstellen
Er ermöglicht das einfache und bequeme erstellen von UDF´s und sorgt dafür, dass man die Übersicht behält.
Funktionen:
- Start mit normalem Design oder AeroGlass
- Beschreibung von Autor, Name, ...
- VarCreator für das einfache erstellen von Variablen und Arrays
- Listen der Arrays und Funktionen, die ausgewählt und bearbeitet werden können
- "Minibild" der gesamten UDF
- weiter folgen
coming soon:
- ArrayEditor um den erstellten Arrays Werte zuzuweißen
- Bessers Design
- Laden vorhandener UDF´s
- ...
Bekannte Bugs:
- Beim abwechselten Editieren, löschen und erstellen der Variablen treten Fehler auf
- bei Variablen die aus Zahlen bestehen, werden die Anführungszeichen ' ' drangehängt (IsNumber/Int, ...) klappt nicht Bitte um Hilfe
Script
#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright=GE IXI TIM
#AutoIt3Wrapper_Res_Language=1031
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include "Vista-au3.au3"
#include <GuiListView.au3>
#include <Array.au3>
#include <Date.au3>
Opt("GUIOnEventMode", 1)
$yesno = MsgBox(4, "AeroGlass", "Do you want to run with AeroGlass?")
Global $aFunctions[50][3], $aVars[50][5], $iZaehler_Func = 1, $iZaehler_Vars = 1
Global $sHeader = ""
Global $sFuncs = ""
Global $sVars = ""
Global $sOldText = ""
Global $selected = -1, $oldSelected = ""
Global $oldState = ""
$hGui = GUICreate("UDF_Builder by GE IXI TIM (Autoit.de)", 851, 622, 192, 124)
GUISetBkColor(0xA0A0A0)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$menuFile = GUICtrlCreateMenu("File")
$menuFile_Save = GUICtrlCreateMenuItem("Save", $menuFile)
GUICtrlSetOnEvent(-1, "_SAVE")
$shortcut = GUICtrlCreateEdit("", 448, 96, 393, 497, BitOR($ES_AUTOVSCROLL, $ES_AUTOHSCROLL, $ES_READONLY, $ES_WANTRETURN, $WS_HSCROLL, $WS_VSCROLL))
GUICtrlSetFont(-1, 4, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Author:", 16, 32, 38, 17)
$author = GUICtrlCreateInput(@UserName, 56, 32, 137, 21)
$Label2 = GUICtrlCreateLabel("Date:", 16, 64, 30, 17)
$date = GUICtrlCreateInput(StringReplace(_NowDate(), "/", "."), 56, 64, 137, 21)
$Label3 = GUICtrlCreateLabel("UDF_Name:", 200, 64, 63, 17)
$name = GUICtrlCreateInput("", 272, 64, 545, 21)
$Label4 = GUICtrlCreateLabel("Description:", 200, 32, 60, 17)
$desk = GUICtrlCreateInput("", 272, 32, 545, 21)
$Group1 = GUICtrlCreateGroup("General thinks", 8, 8, 817, 81)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label5 = GUICtrlCreateLabel("Choose Var type:", 16, 118, 85, 17)
$VarType = GUICtrlCreateCombo("", 112, 112, 145, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Dim|Global|Local|Const|None")
$Label6 = GUICtrlCreateLabel("Value:", 16, 160, 34, 17)
$VarValue = GUICtrlCreateInput("", 112, 160, 145, 21)
$Label7 = GUICtrlCreateLabel("Name:", 16, 184, 35, 17)
$VarName = GUICtrlCreateInput("", 112, 184, 145, 21)
$Checkbox1 = GUICtrlCreateCheckbox("Array", 264, 114, 97, 17)
$Label8 = GUICtrlCreateLabel("Dimension:", 16, 136, 56, 17)
$VarDim1 = GUICtrlCreateInput("", 112, 136, 33, 21, BitOR($ES_AUTOHSCROLL, $ES_NUMBER))
GUICtrlSetState(-1, $GUI_DISABLE)
$VarDim2 = GUICtrlCreateInput("", 152, 136, 33, 21, BitOR($ES_AUTOHSCROLL, $ES_NUMBER))
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetLimit(-1, 1)
$bVarCreate = GUICtrlCreateButton("Var Create", 16, 208, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_Var_Create")
$ListView1 = GUICtrlCreateListView("Type|Name|Value", 264, 136, 170, 94)
GUICtrlSetOnEvent(-1, "_Click_Listview")
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 1, 50)
GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 2, 50)
$bVarDelete = GUICtrlCreateButton("Var Delete", 96, 208, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_Var_Delete")
$bVarEdit = GUICtrlCreateButton("Var Edit", 176, 208, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_Var_Edit")
$Group2 = GUICtrlCreateGroup("Variables", 8, 96, 433, 145)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Label9 = GUICtrlCreateLabel("FunctionName:", 16, 256, 76, 17)
$funcName = GUICtrlCreateInput("Name", 104, 256, 337, 21)
$Label10 = GUICtrlCreateLabel("Parameters:", 16, 280, 60, 17)
$funcSyntax = GUICtrlCreateInput("Name(Param1, Param2 = 5)", 104, 280, 337, 21)
$Label11 = GUICtrlCreateLabel("Function:", 16, 304, 48, 17)
$funcFunc = GUICtrlCreateEdit("", 16, 328, 425, 169)
GUICtrlSetData(-1, "Func" & @CRLF & @CRLF & "EndFunc")
$bFuncAdd = GUICtrlCreateButton("Add Func", 16, 504, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_Add_Func")
$bFuncDelete = GUICtrlCreateButton("Delete Func", 96, 504, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_Delete_Func")
$funcCombo = GUICtrlCreateCombo("", 256, 504, 185, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetOnEvent(-1, "_Combo_Click")
$bFuncEdit = GUICtrlCreateButton("Edit Func", 176, 504, 75, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_Edit_Func")
$SAVEUDF = GUICtrlCreateButton("Save UDF", 16, 536, 427, 57, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_SAVE")
GUICtrlSetFont(-1, 24, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
AdlibRegister("_check", 100)
AdlibRegister("_Click_Listview", 100)
If @OSVersion = "WIN_VISTA" And $yesno = 6 Then _Aero_ON()
While 1
Sleep(100)
WEnd
Func _Exit()
Exit
EndFunc ;==>_Exit
Func _check()
Global $state = _isArray()
If $oldState <> $state Then
If $state Then
GUICtrlSetState($VarValue, $GUI_DISABLE)
GUICtrlSetState($VarDim1, $GUI_ENABLE)
GUICtrlSetState($VarDim2, $GUI_ENABLE)
EndIf
If Not $state Then
GUICtrlSetState($VarValue, $GUI_ENABLE)
GUICtrlSetState($VarDim1, $GUI_DISABLE)
GUICtrlSetState($VarDim2, $GUI_DISABLE)
EndIf
EndIf
$oldState = $state
$sHeader = "#cs " & @CRLF & "This UDF is created by the UDF_Builder v1.0 by GE IXI TIM(AutoIt)" & @CRLF & _
"Author = " & GUICtrlRead($author) & @CRLF & _
"Date = " & GUICtrlRead($date) & @CRLF & _
"UDF_Name = " & GUICtrlRead($name) & @CRLF & _
"Describtion = " & GUICtrlRead($desk) & @CRLF & _
"Functions:" & @CRLF
For $i = 0 To 49
If $aFunctions[$i][0] <> "" Then $sHeader &= "- " & $aFunctions[$i][0] & @CRLF
Next
$sHeader &= "#ce" & @CRLF & ";===Vars==============================================================" & @CRLF
For $i = 0 To UBound($aVars, 0)
If $aVars[$i][0] <> "" Then
If $aVars[$i][1] = False Then
$sVars &= $aVars[$i][3] & " " & "$" & $aVars[$i][0] & " = " & $aVars[$i][4] & @CRLF
ContinueLoop
EndIf
If $aVars[$i][1] = True Then
$sVars &= $aVars[$i][3] & " " & "$" & $aVars[$i][0] & $aVars[$i][2] & @CRLF
ContinueLoop
EndIf
EndIf
Next
$sFuncs &= @CRLF & ";===FUNCTIONS============================================================" & @CRLF
For $i = 0 To 49
If $aFunctions[$i][0] <> "" Then
$sFuncs &= "; Name: " & $aFunctions[$i][0] & @CRLF
$sFuncs &= "; Syntax:" & $aFunctions[$i][1] & @CRLF
$sFuncs &= $aFunctions[$i][2] & @CRLF & @CRLF
EndIf
Next
$sALLText = $sHeader & $sVars & $sFuncs
If $sOldText <> $sALLText Then GUICtrlSetData($shortcut, $sALLText)
$sOldText = $sALLText
$sVars = ""
$sHeader = ""
$sFuncs = ""
EndFunc ;==>_check
Func _isArray()
If BitAND(GUICtrlRead($Checkbox1), 1) = 1 Then Return True
;MsgBox(0, "", GUICtrlRead($Checkbox1))
Return False
EndFunc ;==>_isArray
Func _SAVE()
Local $path = FileSaveDialog("Choose a path", @DesktopDir, "AutoIt-Scripts(*.au3)", "", GUICtrlRead($name))
If StringRight($path, 4) <> ".au3" Then $path &= ".au3"
FileWrite($path, GUICtrlRead($shortcut))
EndFunc ;==>_SAVE
Func _Var_Create()
If StringInStr(GUICtrlRead($shortcut), "$" & GUICtrlRead($VarName)) Then Return MsgBox(0, "Error!", "There already is a var " & GUICtrlRead($VarName))
If GUICtrlRead($VarType) = "" Then Return MsgBox(0, "Error!", "No var type choosen")
If GUICtrlRead($VarName) = "" Then Return MsgBox(0, "Error!", "No var name choosen")
Local $iArray, $sDim = "", $sValue
If _isArray() Then $iArray = 1
If GUICtrlRead($VarDim1) = "" And _isArray() Then Return MsgBox(0, "Error!", "No dimension choosen, if you are creating an array you have to set at least one dim.")
If _isArray() Then $sValue = "/"
If _isArray() Then $sDim &= "[" & GUICtrlRead($VarDim1) & "]"
If _isArray() And GUICtrlRead($VarDim2) <> "" Then $sDim &= "[" & GUICtrlRead($VarDim2) & "]"
If IsString(GUICtrlRead($VarValue)) And Not _isArray() Then $sValue = "'" & GUICtrlRead($VarValue) & "'"
If IsFloat(GUICtrlRead($VarValue)) Or IsInt(GUICtrlRead($VarValue)) Or IsNumber(GUICtrlRead($VarValue)) Then $sValue = GUICtrlRead($VarValue)
If Not _isArray() Then $iArray = 0
$aVars[$iZaehler_Vars][0] = GUICtrlRead($VarName)
$aVars[$iZaehler_Vars][1] = $iArray
$aVars[$iZaehler_Vars][2] = $sDim
$aVars[$iZaehler_Vars][3] = GUICtrlRead($VarType)
$aVars[$iZaehler_Vars][4] = $sValue
GUICtrlCreateListViewItem($aVars[$iZaehler_Vars][3] & "|" & "$" & $aVars[$iZaehler_Vars][0] & $aVars[$iZaehler_Vars][2] & "|" & _
$aVars[$iZaehler_Vars][4], $ListView1)
$iZaehler_Vars += 1
$oldSelected = -1
EndFunc ;==>_Var_Create
Func _Var_Delete()
$index = _GetItemSelected()
_ArrayDelete($aVars, $index)
$ersatzArray = $aVars
Global $aVars[50][5]
For $i = 0 To 48
$aVars[$i][0] = $ersatzArray[$i][0]
$aVars[$i][1] = $ersatzArray[$i][1]
$aVars[$i][2] = $ersatzArray[$i][2]
$aVars[$i][3] = $ersatzArray[$i][3]
$aVars[$i][4] = $ersatzArray[$i][4]
Next
$ersatzArray = ""
_GUICtrlListView_DeleteItem($ListView1, $index - 1)
$state = 2
$oldSelected = -1
EndFunc ;==>_Var_Delete
Func _Var_Edit()
If $selected <> -1 Then
If GUICtrlRead($VarType) = "" Then Return MsgBox(0, "Error!", "No var type choosen")
If GUICtrlRead($VarName) = "" Then Return MsgBox(0, "Error!", "No var name choosen")
Local $iArray, $sDim = "", $sValue
If _isArray() Then $iArray = 1
If GUICtrlRead($VarDim1) = "" And _isArray() Then Return MsgBox(0, "Error!", "No dimension choosen, if you are creating an array you have to set at least one dim.")
If _isArray() Then $sValue = "/"
If _isArray() Then $sDim &= "[" & GUICtrlRead($VarDim1) & "]"
If _isArray() And GUICtrlRead($VarDim2) <> "" Then $sDim &= "[" & GUICtrlRead($VarDim2) & "]"
If IsString(GUICtrlRead($VarValue)) And Not _isArray() Then $sValue = "'" & GUICtrlRead($VarValue) & "'"
If IsNumber(GUICtrlRead($VarValue)) Then $sValue = GUICtrlRead($VarValue)
If Not _isArray() Then $iArray = 0
$aVars[$selected][0] = GUICtrlRead($VarName)
$aVars[$selected][1] = $iArray
$aVars[$selected][2] = $sDim
$aVars[$selected][3] = GUICtrlRead($VarType)
$aVars[$selected][4] = $sValue
_GUICtrlListView_DeleteItem($ListView1, $selected - 1)
GUICtrlCreateListViewItem($aVars[$selected][3] & "|" & "$" & $aVars[$selected][0] & $aVars[$selected][2] & "|" & _
$aVars[$selected][4], $ListView1)
EndIf
$selected = -1
$oldSelected = -1
EndFunc ;==>_Var_Edit
Func _Click_Listview()
Local $dim_1 = "", $dim_2 = ""
$selected = _GetItemSelected()
If $selected <> $oldSelected Then
If $selected <> -1 Then
If $aVars[$selected][1] = 1 Then
GUICtrlSetState($VarValue, $GUI_DISABLE)
GUICtrlSetState($VarDim1, $GUI_ENABLE)
GUICtrlSetState($VarDim2, $GUI_ENABLE)
GUICtrlSetState($Checkbox1, 1)
$dim = $aVars[$selected][2]
$dim = StringReplace($dim, "]", "")
$dim = StringReplace($dim, "[", "")
$aDim = StringSplit($dim, "")
If $aDim[0] = 3 Then
$dim_2 = $aDim[3]
$dim_1 = $aDim[1] & $aDim[2]
EndIf
If $aDim[0] = 2 Then
$dim_2 = $aDim[2]
$dim_1 = $aDim[1]
EndIf
If $aDim[0] = 1 Then
$dim_2 = ""
$dim_1 = $aDim[1]
EndIf
EndIf
If $aVars[$selected][1] = 0 Then
$dim_1 = ""
$dim_2 = ""
GUICtrlSetState($VarValue, $GUI_ENABLE)
GUICtrlSetState($VarDim1, $GUI_DISABLE)
GUICtrlSetState($VarDim2, $GUI_DISABLE)
GUICtrlSetState($Checkbox1, 4)
EndIf
$txt = $aVars[$selected][4]
$txt = StringReplace($txt, "'", "")
$txt = StringReplace($txt, "/", "")
$txt = StringReplace($txt, '"', "")
GUICtrlSetData($VarDim1, $dim_1)
GUICtrlSetData($VarDim2, $dim_2)
GUICtrlSetData($VarName, $aVars[$selected][0])
GUICtrlSetData($VarType, $aVars[$selected][3])
GUICtrlSetData($VarValue, $txt)
$oldSelected = $selected
EndIf
EndIf
EndFunc ;==>_Click_Listview
[/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]Func _GetItemSelected()
Local $selectedItem = 0
$count = _GUICtrlListView_GetItemCount($ListView1)
For $i = 0 To $count - 1
$selectedItem = _GUICtrlListView_GetItemSelected($ListView1, $i)
If $selectedItem Then Return $i + 1
Next
Return -1
EndFunc ;==>_GetItemSelected
Func _Add_Func()
If StringInStr(GUICtrlRead($shortcut), GUICtrlRead($funcSyntax)) Then Return MsgBox(0, "Error!", "There already is a function " & GUICtrlRead($funcSyntax))
If GUICtrlRead($funcName) = "" Then Return MsgBox(0, "Error!", "No function name.")
If GUICtrlRead($funcSyntax) = "" Then Return MsgBox(0, "Error!", "No function syntax.")
If GUICtrlRead($funcFunc) = "" Then Return MsgBox(0, "Error!", "No function.")
$aFunctions[$iZaehler_Func][0] = GUICtrlRead($funcName)
$aFunctions[$iZaehler_Func][1] = GUICtrlRead($funcSyntax)
$aFunctions[$iZaehler_Func][2] = GUICtrlRead($funcFunc)
_SetComboFunctions()
$iZaehler_Func += 1
GUICtrlSetData($funcFunc, "Func " & @CRLF & @CRLF & "EndFunc")
GUICtrlSetData($funcName, "")
GUICtrlSetData($funcSyntax, "")
EndFunc ;==>_Add_Func
Func _SetComboFunctions()
Local $sCombo = ""
For $i = 0 To 49
If $aFunctions[$i][0] <> "" Then $sCombo &= "|" & $aFunctions[$i][0]
Next
GUICtrlSetData($funcCombo, $sCombo)
EndFunc ;==>_SetComboFunctions
Func _Delete_Func()
$index = _ArraySearch($aFunctions, GUICtrlRead($funcCombo))
_ArrayDelete($aFunctions, $index)
$ersatzArray = $aFunctions
Global $aFunctions[50][5]
For $i = 0 To 48
$aFunctions[$i][0] = $ersatzArray[$i][0]
$aFunctions[$i][1] = $ersatzArray[$i][1]
$aFunctions[$i][2] = $ersatzArray[$i][2]
Next
$ersatzArray = ""
_SetComboFunctions()
EndFunc ;==>_Delete_Func
Func _Combo_Click()
Global $FuncSelected = _ArraySearch($aFunctions, GUICtrlRead($funcCombo))
If $aFunctions[$FuncSelected][0] <> "" Then
GUICtrlSetData($funcName, $aFunctions[$FuncSelected][0])
GUICtrlSetData($funcSyntax, $aFunctions[$FuncSelected][1])
GUICtrlSetData($funcFunc, $aFunctions[$FuncSelected][2])
EndIf
EndFunc ;==>_Combo_Click
Func _Edit_Func()
If GUICtrlRead($funcName) = "" Then Return MsgBox(0, "Error!", "No function name.")
If GUICtrlRead($funcSyntax) = "" Then Return MsgBox(0, "Error!", "No function syntax.")
If GUICtrlRead($funcFunc) = "" Then Return MsgBox(0, "Error!", "No function.")
$aFunctions[$FuncSelected][0] = GUICtrlRead($funcName)
$aFunctions[$FuncSelected][1] = GUICtrlRead($funcSyntax)
$aFunctions[$FuncSelected][2] = GUICtrlRead($funcFunc)
_SetComboFunctions()
EndFunc ;==>_Edit_Func
Func _Aero_ON()
GUICtrlSetFont($Label1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label2, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label3, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label4, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label5, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label6, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label7, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label8, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label9, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label10, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Label11, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Checkbox1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Group1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetFont($Group2, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor($Label1, 0xFF0000)
GUICtrlSetColor($Label2, 0xFF0000)
GUICtrlSetColor($Label3, 0xFF0000)
GUICtrlSetColor($Label4, 0xFF0000)
GUICtrlSetColor($Label5, 0xFF0000)
GUICtrlSetColor($Label6, 0xFF0000)
GUICtrlSetColor($Label7, 0xFF0000)
GUICtrlSetColor($Label8, 0xFF0000)
GUICtrlSetColor($Label9, 0xFF0000)
GUICtrlSetColor($Label10, 0xFF0000)
GUICtrlSetColor($Label11, 0xFF0000)
GUICtrlSetColor($Checkbox1, 0xFF0000)
GUICtrlSetColor($Group1, 0xFF0000)
GUICtrlSetColor($Group2, 0xFF0000)
GUICtrlSetColor($shortcut, 0xFF0000)
_Vista_ApplyGlass($hGui)
EndFunc ;==>_Aero_ON
Download: autoit.de/wcf/attachment/9014/