KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Auto Expanding Form

 
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic
View previous topic :: View next topic  
Author Message
hoopjunkie
KiXforms Novice
KiXforms Novice


Joined: 08 Mar 2006
Posts: 3

PostPosted: Sat Dec 29, 2007 3:21 am    Post subject: Auto Expanding Form Reply with quote

I am attempting to create an "application launcher". The idea is to read a directory of exe's and to dynamically create a form with buttons for each exe that when clicked will launch the executable. In addition, I would like to display the buttons in multiple columns, if necessary. The longterm goal will be to publish the kix script on a Citrix/Terminal Server.

My current "work in progress" code is below

Code:

;region Global Variables

$size = 0
$dir = "Place Directory Here"

;endregion

;region Forms
$System = CreateObject("Kixtart.System")

$ObjectName = $System.Form()
$ObjectName.Height = 400
$ObjectName.Left = 46
$ObjectName.Text = "Applicaton Launcher"
$ObjectName.Top = 24
$ObjectName.Width = 600

$start = 0

$FileName = Dir($dir)
While $FileName <> "" And @ERROR = 0
  If (Right($FileName,4) = ".exe") 
   $size = $size +1
   ? $FileName
  EndIf
  $FileName = Dir() ; retrieve next file
Loop

Dim $soft[$size]
$count = 1
$FileName = Dir($dir)
While $FileName <> "" And @ERROR = 0
  If (Right($FileName,4) = ".exe")
   $soft[$count] = $FileName
   $count = $count +1
   
  EndIf
  $FileName = Dir() ; retrieve next file
Loop

Dim $buttons[$size]

For $counter = 1 to $size
   $buttons[$counter] = $ObjectName.CommandButton($soft[$counter],10, $start, 100, 25)
$start = $start + 30
    $buttons[$counter].OnClick="Button_Click("$soft[$counter]")"
Next
$ObjectName.Show

While $ObjectName.Visible
   $=Execute($ObjectName.DoEvents())
Loop
Exit
;EndRegion
;endregion

:Functions
Function Button_Click($button)
  Run $dir + "\" + $button
   ? $dir + "\" + $button
EndFunction
;endregion
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Starters Code Clinic All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group