- Offizieller Beitrag
Hi,
Kleines Skript, um GUI-Elemente schnell zu bewegen. Nützlich, wenn Koda nicht funktioniert, weil es zu dynamisch ist oder so :).
Nicht besonders getestet, aber vielleicht hilft es jemandem ;).
[autoit]#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <Misc.au3>
Opt("GUIOnEventMode", 1)
Opt("ExpandVarStrings", 1)
#Region ### START Koda GUI section ### Form=D:\Dokumente und Einstellungen\Temp\koda.kxf
$Form1 = GUICreate("Handicraft", 470, 517, 192, 114)
$Edit1 = GUICtrlCreateEdit("", 8, 8, 449, 169)
$Button1 = GUICtrlCreateButton("Edit to Edit", 8, 272, 225, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_convEdit")
$Button2 = GUICtrlCreateButton("Clip to Clip", 240, 272, 217, 25, $WS_GROUP)
GUICtrlSetOnEvent(-1, "_convClip")
$Edit2 = GUICtrlCreateEdit("", 8, 304, 449, 201)
$Input1 = GUICtrlCreateInput("", 176, 192, 41, 21)
$Input2 = GUICtrlCreateInput("", 176, 224, 41, 21)
$Input3 = GUICtrlCreateInput("", 288, 192, 41, 21)
$Input4 = GUICtrlCreateInput("", 288, 224, 41, 21)
$Label1 = GUICtrlCreateLabel("Left:", 138, 195, 26, 17)
$Label2 = GUICtrlCreateLabel("Width:", 137, 227, 35, 17)
$Label3 = GUICtrlCreateLabel("Top:", 230, 194, 38, 17)
$Label4 = GUICtrlCreateLabel("Height:", 230, 226, 38, 17)
GUISetOnEvent(-3, "_Exit")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
Sleep(1000000)
WEnd
Func _Exit()
Exit
EndFunc ;==>_Exit
Func _convEdit()
GUICtrlSetData($Edit2, _conv(GUICtrlRead($Edit1)))
EndFunc ;==>_convEdit
Func _convClip()
ClipPut(_conv(ClipGet()))
EndFunc ;==>_convClip
Func _conv($string)
$left = _Iif(GUICtrlRead($Input1) = "", 0, GUICtrlRead($Input1))
$top = _Iif(GUICtrlRead($Input3) = "", 0, GUICtrlRead($Input3))
$width = _Iif(GUICtrlRead($Input2) = "", 0, GUICtrlRead($Input2))
$height = _Iif(GUICtrlRead($Input4) = "", 0, GUICtrlRead($Input4))
$lines = StringSplit($string, @CRLF, 1)
For $i = 1 To UBound($lines) - 1
$return = StringRegExp($lines[$i], "(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)", 1)
if UBound($return) = 0 Then ContinueLoop
; Werte berechnen
$nleft = $return[0] + $left
$ntop = $return[1] + $top
$nwidth = $return[2] + $width
$nheight = $return[3] + $height
$lines[$i] = StringRegExpReplace($lines[$i], "(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)", "$nleft$, $ntop$, $nwidth$, $nheight$")
Next
Return _ArrayToString($lines, @CRLF, 1)
EndFunc ;==>_conv
Johannes