Hi,
gewöhn dir bitte an gleich zu Beginn ein bißchen mehr Informationen zu geben!
IP ändern kommt auf statisch oder dynamisch drauf an. DCHP ist eigentlich Standard.
Mega
Hi,
gewöhn dir bitte an gleich zu Beginn ein bißchen mehr Informationen zu geben!
IP ändern kommt auf statisch oder dynamisch drauf an. DCHP ist eigentlich Standard.
Mega
Hi,
schau dir doch mal _FileWriteLog an oder IniWrite
Mega
Hi,
vertrauend auf die Funktion könnte es so aussehen:
#include <String.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $inp, $out, $old
GUICreate(" My GUI", 320, 120)
$inp = GUICtrlCreateInput("", 10, 5, 300, 20, BitOR($ES_AUTOHSCROLL, $ES_RIGHT))
$inp1 = GUICtrlCreateInput("", 10, 35, 300, 20, BitOR($ES_AUTOHSCROLL, $ES_RIGHT))
$inp1 = GUICtrlCreateInput("", 10, 65, 300, 20, BitOR($ES_AUTOHSCROLL, $ES_RIGHT))
GUISetState()
GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND")
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
Local $controlID = _LoWord($wParam)
Local $string = GUICtrlRead($controlID)
If $string <> $old Then
$string = StringRegExpReplace($string, '[^0123456789,]', '')
$pos = StringInStr($string, ',', 0, -1)
$stringR = StringMid($string, $pos)
$stringL = $string
If $pos Then $stringL = StringLeft($string, $pos - 1)
$string = ''
$len = StringLen($stringL) - 1
$count = Int($len / 3)
$rest = Mod($len, 3)
If $count > 0 Then
For $i = 0 To $count - 1
$stringL = _StringInsert($stringL, '.', $i * 4 + $rest + 1)
Next
EndIf
GUICtrlSetData($controlID, $stringL & $stringR)
$old = $stringL & $stringR
EndIf
EndFunc ;==>MY_WM_COMMAND
Func _HiWord($x)
Return BitShift($x, 16)
EndFunc ;==>_HiWord
Func _LoWord($x)
Return BitAND($x, 0xFFFF)
EndFunc ;==>_LoWord
Mega
Hi,
ich habe auch noch eine kleine Änderung an einer Funktion gemacht, weil es mich gestört hat bei DBs, dass die Spaltenüberschriften nicht zu sehen waren.
; #FUNCTION# ====================================================================================================================
; Name...........: _ArrayDisplay
; Description ...: Displays given 1D or 2D array array in a listview.
; Syntax.........: _ArrayDisplay(Const ByRef $avArray[, $sTitle = "Array: ListView Display"[, $iItemLimit = -1[, $iTranspose = 0[, $sSeparator = ""[, $sReplace = "|"]]]]])
; Parameters ....: $avArray - Array to display
; $sTitle - [optional] Title to use for window
; $iItemLimit - [optional] Maximum number of listview items (rows) to show
; $iTranspose - [optional] If set differently than default, will transpose the array if 2D
; $sSeparator - [optional] Change Opt("GUIDataSeparatorChar") on-the-fly
; $sReplace - [optional] String to replace any occurrence of $sSeparator with in each array element
; Return values .: Success - 1
; Failure - 0, sets @error:
; |1 - $avArray is not an array
; |2 - $avArray has too many dimensions (only up to 2D supported)
; |3 - $header_A is not an array
; Author ........: randallc, Ultima
; Modified.......: Gary Frost (gafrost) / Ultima: modified to be self-contained (no longer depends on "GUIListView.au3") / Xenobiologist header
; Remarks .......:
; Related .......:
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================
Global $database_A[2][2] = [['www.Autoitscript.com', 'English forum'],['www.autoit.de', 'German forum']]
Global $header_A[2] = ['URL', 'Description']
Global $digtis_A[5] = [1, 2, 3, 4, 5]
Global $header1_A[1] = ['Digits']
_ArrayDisplay_WithHeader($database_A, $header_A)
;~ _ArrayDisplay_WithHeader($digtis_A, $header1_A)
_ArrayDisplay_WithHeader($digtis_A, -1, "Titel")
Func _ArrayDisplay_WithHeader(Const ByRef $avArray, $header_A = -1, $sTitle = "Array: ListView Display", $iItemLimit = -1, $iTranspose = 0, $sSeparator = "", $sReplace = "|")
If Not IsArray($avArray) Then Return SetError(1, 0, 0)
; Dimension checking
Local $iDimension = UBound($avArray, 0), $iUBound = UBound($avArray, 1) - 1, $iSubMax = UBound($avArray, 2) - 1
If $iDimension > 2 Then Return SetError(2, 0, 0)
; Separator handling
;~ If $sSeparator = "" Then $sSeparator = Chr(1)
If $sSeparator = "" Then $sSeparator = Chr(124)
; Declare variables
Local $i, $j, $vTmp, $aItem, $avArrayText, $sHeader = "Row", $iBuffer = 64
Local $iColLimit = 250, $iLVIAddUDFThreshold = 4000, $iWidth = 640, $iHeight = 480
Local $iOnEventMode = Opt("GUIOnEventMode", 0), $sDataSeparatorChar = Opt("GUIDataSeparatorChar", $sSeparator)
; Swap dimensions if transposing
If $iSubMax < 0 Then $iSubMax = 0
If $iTranspose Then
$vTmp = $iUBound
$iUBound = $iSubMax
$iSubMax = $vTmp
EndIf
; Set limits for dimensions
If $iSubMax > $iColLimit Then $iSubMax = $iColLimit
If $iItemLimit = 1 Then $iItemLimit = $iLVIAddUDFThreshold
If $iItemLimit < 1 Then $iItemLimit = $iUBound
If $iUBound > $iItemLimit Then $iUBound = $iItemLimit
If $iLVIAddUDFThreshold > $iUBound Then $iLVIAddUDFThreshold = $iUBound
If Not IsArray($header_A) Or $header_A = -1 Then
; Set header up
For $i = 0 To $iSubMax
$sHeader &= $sSeparator & "Col " & $i
Next
Else
; Set header up
For $i = 0 To UBound($header_A) - 1
$sHeader &= $sSeparator & $header_A[$i]
Next
EndIf
; Convert array into text for listview
Local $avArrayText[$iUBound + 1]
For $i = 0 To $iUBound
$avArrayText[$i] = "[" & $i & "]"
For $j = 0 To $iSubMax
; Get current item
If $iDimension = 1 Then
If $iTranspose Then
$vTmp = $avArray[$j]
Else
$vTmp = $avArray[$i]
EndIf
Else
If $iTranspose Then
$vTmp = $avArray[$j][$i]
Else
$vTmp = $avArray[$i][$j]
EndIf
EndIf
; Add to text array
$vTmp = StringReplace($vTmp, $sSeparator, $sReplace, 0, 1)
$avArrayText[$i] &= $sSeparator & $vTmp
; Set max buffer size
$vTmp = StringLen($vTmp)
If $vTmp > $iBuffer Then $iBuffer = $vTmp
Next
Next
$iBuffer += 1
; GUI Constants
Local Const $_ARRAYCONSTANT_GUI_DOCKBORDERS = 0x66
Local Const $_ARRAYCONSTANT_GUI_DOCKBOTTOM = 0x40
Local Const $_ARRAYCONSTANT_GUI_DOCKHEIGHT = 0x0200
Local Const $_ARRAYCONSTANT_GUI_DOCKLEFT = 0x2
Local Const $_ARRAYCONSTANT_GUI_DOCKRIGHT = 0x4
Local Const $_ARRAYCONSTANT_GUI_EVENT_CLOSE = -3
Local Const $_ARRAYCONSTANT_LVIF_PARAM = 0x4
Local Const $_ARRAYCONSTANT_LVIF_TEXT = 0x1
Local Const $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH = (0x1000 + 29)
Local Const $_ARRAYCONSTANT_LVM_GETITEMCOUNT = (0x1000 + 4)
Local Const $_ARRAYCONSTANT_LVM_GETITEMSTATE = (0x1000 + 44)
Local Const $_ARRAYCONSTANT_LVM_INSERTITEMA = (0x1000 + 7)
Local Const $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE = (0x1000 + 54)
Local Const $_ARRAYCONSTANT_LVM_SETITEMA = (0x1000 + 6)
Local Const $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT = 0x20
Local Const $_ARRAYCONSTANT_LVS_EX_GRIDLINES = 0x1
Local Const $_ARRAYCONSTANT_LVS_SHOWSELALWAYS = 0x8
Local Const $_ARRAYCONSTANT_WS_EX_CLIENTEDGE = 0x0200
Local Const $_ARRAYCONSTANT_WS_MAXIMIZEBOX = 0x00010000
Local Const $_ARRAYCONSTANT_WS_MINIMIZEBOX = 0x00020000
Local Const $_ARRAYCONSTANT_WS_SIZEBOX = 0x00040000
Local Const $_ARRAYCONSTANT_tagLVITEM = "int Mask;int Item;int SubItem;int State;int StateMask;ptr Text;int TextMax;int Image;int Param;int Indent;int GroupID;int Columns;ptr pColumns"
Local $iAddMask = BitOR($_ARRAYCONSTANT_LVIF_TEXT, $_ARRAYCONSTANT_LVIF_PARAM)
Local $tBuffer = DllStructCreate("char Text[" & $iBuffer & "]"), $pBuffer = DllStructGetPtr($tBuffer)
Local $tItem = DllStructCreate($_ARRAYCONSTANT_tagLVITEM), $pItem = DllStructGetPtr($tItem)
DllStructSetData($tItem, "Param", 0)
DllStructSetData($tItem, "Text", $pBuffer)
DllStructSetData($tItem, "TextMax", $iBuffer)
; Set interface up
Local $hGUI = GUICreate($sTitle, $iWidth, $iHeight, 10, 10, BitOR($_ARRAYCONSTANT_WS_SIZEBOX, $_ARRAYCONSTANT_WS_MINIMIZEBOX, $_ARRAYCONSTANT_WS_MAXIMIZEBOX))
Local $aiGUISize = WinGetClientSize($hGUI)
Local $hListView = GUICtrlCreateListView($sHeader, 0, 0, $aiGUISize[0], $aiGUISize[1] - 26, $_ARRAYCONSTANT_LVS_SHOWSELALWAYS)
Local $hCopy = GUICtrlCreateButton("Copy Selected", 3, $aiGUISize[1] - 23, $aiGUISize[0] - 6, 20)
GUICtrlSetResizing($hListView, $_ARRAYCONSTANT_GUI_DOCKBORDERS)
GUICtrlSetResizing($hCopy, $_ARRAYCONSTANT_GUI_DOCKLEFT + $_ARRAYCONSTANT_GUI_DOCKRIGHT + $_ARRAYCONSTANT_GUI_DOCKBOTTOM + $_ARRAYCONSTANT_GUI_DOCKHEIGHT)
GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_LVS_EX_GRIDLINES, $_ARRAYCONSTANT_LVS_EX_GRIDLINES)
GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT, $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_WS_EX_CLIENTEDGE, $_ARRAYCONSTANT_WS_EX_CLIENTEDGE)
; Fill listview
For $i = 0 To $iLVIAddUDFThreshold
GUICtrlCreateListViewItem($avArrayText[$i], $hListView)
Next
For $i = ($iLVIAddUDFThreshold + 1) To $iUBound
$aItem = StringSplit($avArrayText[$i], $sSeparator)
DllStructSetData($tBuffer, "Text", $aItem[1])
; Add listview item
DllStructSetData($tItem, "Item", $i)
DllStructSetData($tItem, "SubItem", 0)
DllStructSetData($tItem, "Mask", $iAddMask)
GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_INSERTITEMA, 0, $pItem)
; Set listview subitem text
DllStructSetData($tItem, "Mask", $_ARRAYCONSTANT_LVIF_TEXT)
For $j = 2 To $aItem[0]
DllStructSetData($tBuffer, "Text", $aItem[$j])
DllStructSetData($tItem, "SubItem", $j - 1)
GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_SETITEMA, 0, $pItem)
Next
Next
; ajust window width
$iWidth = 0
For $i = 0 To $iSubMax + 1
$iWidth += GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH, $i, 0)
Next
If $iWidth < 250 Then $iWidth = 230
WinMove($hGUI, "", Default, Default, $iWidth + 20)
; Show dialog
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $_ARRAYCONSTANT_GUI_EVENT_CLOSE
ExitLoop
Case $hCopy
Local $sClip = ""
; Get selected indices [ _GUICtrlListView_GetSelectedIndices($hListView, True) ]
Local $aiCurItems[1] = [0]
For $i = 0 To GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_GETITEMCOUNT, 0, 0)
If GUICtrlSendMsg($hListView, $_ARRAYCONSTANT_LVM_GETITEMSTATE, $i, 0x2) Then
$aiCurItems[0] += 1
ReDim $aiCurItems[$aiCurItems[0] + 1]
$aiCurItems[$aiCurItems[0]] = $i
EndIf
Next
; Generate clipboard text
If Not $aiCurItems[0] Then
For $sItem In $avArrayText
$sClip &= $sItem & @CRLF
Next
Else
For $i = 1 To UBound($aiCurItems) - 1
$sClip &= $avArrayText[$aiCurItems[$i]] & @CRLF
Next
EndIf
ClipPut($sClip)
EndSwitch
WEnd
GUIDelete($hGUI)
Opt("GUIOnEventMode", $iOnEventMode)
Opt("GUIDataSeparatorChar", $sDataSeparatorChar)
Return 1
EndFunc ;==>_ArrayDisplay_WithHeader
Mega
Genau, es nutzt | als Trennzeichen
[autoit]Global $re = StringRegExp ('22 146 2 "Belgica"', '(\d+)\s*(\d+)\s*(\d+)?\s*"(.+)"',3)
Global $re1 = StringRegExp ('18 58 1 "|KS|^EDETHAWK"', '(\d+)\s*(\d+)\s*(\d+)?\s*"(.+)"',3)
For $i = 0 To UBound($re) - 1
ConsoleWrite($i & ": " & $re[$i] & @CRLF)
ConsoleWrite($i & ": " & $re1[$i] & @CRLF)
Next
Mega
Hi,
das Problem liegt im ArrayDisplay nicht im RegExp!
Mega
auch nicht schön, aber evtl. hilft es.
#include <GUIConstants.au3>
[/autoit] [autoit][/autoit] [autoit]$gui = GUICreate("Beispiel", 410, 410) ; erstellt ein GUI-Fenster welches mittig ausgerichtet wird
$tab = GUICtrlCreateTab(5, 105, 400, 300)
$anAus_B = GUICtrlCreateButton("an", 50, 50, 50, 50)
Global $status = False
; Tab 1
$tab0 = GUICtrlCreateTabItem("Grund 1")
GUICtrlSetState(-1, $GUI_SHOW); Dieser Tab wird beim Programmstart aufgerufen
; Tab 2
$tab1 = GUICtrlCreateTabItem("Grund 2")
$label1_1 = GUICtrlCreateLabel("Darf nur bei Grund 2 erscheinen", 150, 150, 150, 150)
GUISetFont(9, 300)
GUICtrlCreateTabItem("")
GUISetState()
; die GUI läuft bis sie geschlossen wird
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $anAus_B
If $status = False Then
$tab2 = GUICtrlCreateTabItem("Grund 3")
$label2_1 = GUICtrlCreateLabel("Darf nur bei Grund 3 erscheinen", 150, 150, 150, 150)
GUICtrlSetBkColor(-1, 0xFCFCFE) ; Grün
GUISetFont(9, 300)
GUICtrlSetState($tab2, $GUI_SHOW)
GUICtrlSetData($anAus_B, 'Aus')
Else
GUICtrlDelete($tab2)
GUICtrlDelete($label2_1)
GUICtrlSetData($anAus_B, 'An')
EndIf
$status = Not $status
EndSelect
WEnd
Mega
Hi,
meinst du wirklich Label und nicht Input?
Außerdem guck dir mal GuiCtrlRead an.
Mega
Hi,
wenn du schon Code postet, dann bitte auch lauffähigen damit man testen kann!
Mega
Ich sag nur: Wer recht hat muss auch Streit anfangen! ![]()
Hi,
hier ein Bsp:
#include <GuiListView.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Opt('MustDeclareVars', 1)
[/autoit] [autoit][/autoit] [autoit]$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work
[/autoit] [autoit][/autoit] [autoit]_Main()
[/autoit] [autoit][/autoit] [autoit]Func _Main()
Local $hListView, $check_B = 0, $msg = 0
GUICreate("ListView Get Item Checked State", 400, 300)
$hListView = GUICtrlCreateListView("", 2, 2, 394, 168)
$check_B = GUICtrlCreateButton('CHECK STATE', 5, 200, 390, 21)
_GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES))
GUISetState()
; Add columns
_GUICtrlListView_AddColumn($hListView, "Column 1", 100)
_GUICtrlListView_AddColumn($hListView, "Column 2", 100)
_GUICtrlListView_AddColumn($hListView, "Column 3", 100)
; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)
; Check item 2
;~ _GUICtrlListView_SetItemChecked($hListView, 1)
;~ MsgBox(4160, "Information", "Item 2 Checked: " & _GUICtrlListView_GetItemChecked($hListView, 1))
; Loop until user exits
Do
$msg = GUIGetMsg()
If $msg = $check_B Then
For $i = 0 To _GUICtrlListView_GetItemCount($hListView)
If _GUICtrlListView_GetItemChecked($hListView, $i) Then
ConsoleWrite(_GUICtrlListView_GetItemText($hListView, $i) & " is checked!" & @CRLF)
EndIf
Next
ConsoleWrite('!--------------------------------------------------------' & @CRLF)
EndIf
Until $msg = $GUI_EVENT_CLOSE
GUIDelete()
EndFunc ;==>_Main
Mega
HI,
[autoit]#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
Global $GUI = GUICreate("GUI", 413, 305, 303, 219)
Global $bild = GUICtrlCreatePic(@SystemDir & "\oobe\images\merlin.gif", 32, 16, 195, 177, $SS_NOTIFY, $WS_EX_LAYERED)
GUISetState(@SW_SHOW)
Do
$msg = GUIGetMsg()
If $msg = $bild Then ShellExecute('http://autoit.de/index.php?page=User&userID=173')
Until $msg = $GUI_EVENT_CLOSE
Mega
Hi,
guck dir die Beispiele in der Hilfe an und dann versuch sie zu verändern.
Mega
#include <GDIPlus.au3>
#include <WinAPI.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>
_GDIPlus_Startup()
$image = _GDIPlus_ImageLoadFromFile("c:\Dokumente und Einstellungen\All Users\Anwendungsdaten\Skype\Pictures\Angel Skype.png")
$hwnd = GUICreate("test", 300, 300)
$pic = GUICtrlCreatePic("", 10, 10, 280, 280, $SS_NOTIFY)
GUISetState()
$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
_GDIPlus_GraphicsDrawImageRect($graphics, $image, 10, 10, 280, 280)
Do
$msg = GUIGetMsg()
If $msg = $pic Then
GUICtrlDelete($pic)
ConsoleWrite("Delete" & @CRLF)
EndIf
Until $msg = -3
_WinAPI_DeleteObject($image)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()
Mega
Nutz doch einfach Organize Includes ![]()
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ListViewConstants.au3>
Opt('MustDeclareVars', 1)
[/autoit] [autoit][/autoit] [autoit]Example()
[/autoit] [autoit][/autoit] [autoit]Func Example()
Local $listview, $button, $item1, $item2, $item3, $input1, $msg
GUICreate("listview items", 220, 250, 100, 200, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00E0FFFF) ; will change background color
$listview = GUICtrlCreateListView("col1 |col2|col3 ", 10, 10, 200, 150, -1 ,$LVS_EX_CHECKBOXES);,$LVS_SORTDESCENDING)
$button = GUICtrlCreateButton("Value?", 75, 170, 70, 20)
$item1 = GUICtrlCreateListViewItem("item2|col22|col23", $listview)
$item2 = GUICtrlCreateListViewItem("item1|col12|col13", $listview)
$item3 = GUICtrlCreateListViewItem("item3|col32|col33", $listview)
$input1 = GUICtrlCreateInput("", 20, 200, 150)
GUICtrlSetState(-1, $GUI_DROPACCEPTED) ; to allow drag and dropping
GUISetState()
GUICtrlSetData($item2, "ITEM1")
GUICtrlSetData($item3, "||COL33")
GUICtrlDelete($item1)
Do
$msg = GUIGetMsg()
Select
Case $msg = $button
MsgBox(0, "listview item", GUICtrlRead(GUICtrlRead($listview)), 2)
Case $msg = $listview
MsgBox(0, "listview", "clicked=" & GUICtrlGetState($listview), 2)
EndSelect
Until $msg = $GUI_EVENT_CLOSE
EndFunc ;==>Example
Hi,
ich teste das morgen mal. Wenn du es mit _FilePrint oder Shellexecute an einen Farblaser schickst, dann sollte das klappen.
Mal sehen ![]()
Mega
Hi,
du musst die ListView auch mit dem nötigen Style versehen.
Mega
Na siehste. Mühsam ernährt sich ... ![]()