;region ScriptForm Designer
;region Constructor
Break On
$System = CreateObject("KiXtart.System")
;endregion
;region Post-Constructor Custom Code
Dim $Ret
$Ret = SetOption("Explicit", "on")
Dim $
;endregion
;region Form Creation
;Warning: It is recommended that changes inside this region be handled using the ScriptForm Designer.
;When working with the ScriptForm designer this region and any changes within may be overwritten.
;~~< Form1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Global $Form1
$Form1 = $System.Form()
$Form1.Text = "Just a simple test"
;~~< TextBox1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Global $TextBox1
$TextBox1 = $Form1.Controls.TextBox()
$TextBox1.Size = 183, 20
$TextBox1.Location = 89, 93
;~~< Label1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Global $Label1
$Label1 = $Form1.Controls.Label()
$Label1.Text = "My Box:"
$Label1.Size = 70, 23
$Label1.Location = 13, 96
;~~< Button1 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Global $Button1
$Button1 = $Form1.Controls.Button()
$Button1.Text = "Resize"
$Button1.Size = 75, 23
$Button1.Location = 61, 184
$Button1.OnClick = "Resize( $$Button1 )"
;~~< Label2 >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Global $Label2
$Label2 = $Form1.Controls.Label()
$Label2.Text = "Enter some text and press "+Chr(34)+"Resize"+Chr(34)+" to resize the width of the textbox"
$Label2.Size = 259, 46
$Label2.Location = 13, 24
;endregion
;region Custom Code
$TextBox1.text = "123.25GB"
;endregion
;region Event Loop
$Form1.Show
While $Form1.Visible
$=Execute($System.Application.DoEvents)
Loop
;endregion
;endregion
;region Event Handlers
Function Resize( $object )
$TextBox1.width = PixelStrSize($TextBox1.text)
EndFunction
;endregion
;region Script Settings
;<ScriptSettings xmlns="http://tempuri.org/ScriptSettings.xsd">
; <ScriptPackager>
; <process>kix32.exe</process>
; <arguments />
; <extractdir>%TEMP%</extractdir>
; <files />
; <usedefaulticon>true</usedefaulticon>
; <showinsystray>false</showinsystray>
; <altcreds>false</altcreds>
; <efs>true</efs>
; <ntfs>true</ntfs>
; <local>false</local>
; <abortonfail>true</abortonfail>
; <product />
; <version>1.0.0.1</version>
; <versionstring />
; <comments />
; <company />
; <includeinterpreter>false</includeinterpreter>
; <forcecomregistration>false</forcecomregistration>
; <consolemode>false</consolemode>
; <EnableChangelog>false</EnableChangelog>
; <AutoBackup>false</AutoBackup>
; <snapinforce>false</snapinforce>
; <snapinshowprogress>false</snapinshowprogress>
; <snapinautoadd>2</snapinautoadd>
; <snapinpermanentpath />
; <cpumode>1</cpumode>
; <hidepsconsole>false</hidepsconsole>
; </ScriptPackager>
;</ScriptSettings>
;endregion
Break on
$ret = SetOption("explicit", "on")
Function PixelStrSize($sInput)
Dim $, $i, $c
$ = SetOption("CaseSensitivity", "On")
For $i = 1 to Len($sInput)
$c = SubStr($sInput, $i, 1)
Select
Case $c = "'"
$PixelStrSize = CDbl($PixelStrSize) + 2
Case InStr('fjt !,.:;-/\()"Jr', $c)
$PixelStrSize = CDbl($PixelStrSize) + 3
Case InStr("szkvxy?cL", $c)
$PixelStrSize = CDbl($PixelStrSize) + 5
Case InStr("ughdeK0123456789$BEFYZabnopqP", $c)
$PixelStrSize = CDbl($PixelStrSize) + 6
Case InStr("UVRSTNACDGH*+X<=>&#OQ", $c)
$PixelStrSize = CDbl($PixelStrSize) + 8
Case InStr("Mwm", $c)
$PixelStrSize = CDbl($PixelStrSize) + 9
Case InStr("@%W", $c)
$PixelStrSize = CDbl($PixelStrSize) + 12
Case 1
$PixelStrSize = CDbl($PixelStrSize) + 10
EndSelect
Next
$ = SetOption("CaseSensitivity", $)
EndFunction