Page 1 of 1 1
Topic Options
#140993 - 2005-06-05 08:09 AM Need help creating an application with kixtart and kixforms.
chewbaccabenz Offline
Fresh Scripter

Registered: 2005-06-03
Posts: 6
Loc: Waco, TX USA
Hello,

I am trying to create an application with kixforms and kixtart. The application is supposed to give the user options to print a customer survey on the register, and if so, print it every 10 minutes, or 15 minutes, etc. I have come a pretty long way with it, but cannot figure out how to get it to run all the secondary print scripts at the same time. I am using a WAIT.exe command in DOS to time the printing of the surveys, and it works fine if only one register is selected to print. I just cannot get them all to print. I have it set so if a user selects a certain radio button, it writes a true or false value into an .ini file. The when the user clicks the Start Printing button, I used the CALL command to call the secondary kix scripts. The secondary kix scripts read values from the .ini file, and then changes the $time and $path variable and prints. The secondary scripts need to run in a loop (ex. print one survey every 10 min.) until the user closes it. I have tried using the CALL command to open all four secondary scripts, but it will only execute the first. I also cannot figure out how to close the secondary scripts once they start running. All I can do is close the first form, which says it is not responding in windows, and then click end now.

I am new to kixtart, so any help would be greatly appreciated. If what I am trying to do is to complex for kixtart, is there another programming language that could accomplish what I am trying to do???

Here is part of the main script:
Code:
Break On
$System = CreateObject("Kixtart.System")


;KD START

;************* Form **************
$Form = $System.Form()
$Form.BackColor = 212,208,200
$Form.Height = 492
$Form.Left = 43
$Form.MaximizeBox = "False"
$Form.Text = "PrintSurvey"
$Form.Top = 13
$Form.Width = 662
;**************************************

;************* Button1 **************
$Button1 = $Form.Controls.Button()
$Button1.FontBold = "True"
$Button1.FontSize = 12
$Button1.Height = 39
$Button1.Left = 200
$Button1.Text = "Start Printing"
$Button1.Top = 330
$Button1.Width = 254
$Button1.OnClick = "OnButtonClick()"
;**************************************

Function OnButtonClick

CALL Print1.kix
CALL Print2.kix
CALL Print3.kix
CALL Print4.kix

EndFunction

;************* Label1 **************
$Label1 = $Form.Controls.Label()
$Label1.BackColor = 212,208,200
$Label1.FontBold = "True"
$Label1.FontSize = 12
$Label1.Height = 90
$Label1.Left = 30
$Label1.Text = "Choose the register"
$Label1.Top = 15
$Label1.Width = 585
;**************************************

;************* Label3 **************
$Label3 = $Form.Controls.Label()
$Label3.BackColor = 212,208,200
$Label3.FontBold = "True"
$Label3.FontSize = 12
$Label3.Height = 50
$Label3.Left = 200
$Label3.Text = "To Stop Printing Click The X To Close This Window"
$Label3.Top = 380
$Label3.Width = 254
;**************************************

;************* GroupBox1 **************
$GroupBox1 = $Form.Controls.GroupBox()
$GroupBox1.BackColor = 212,208,200
$GroupBox1.FontSize = 10
$GroupBox1.Height = 192
$GroupBox1.Left = 30
$GroupBox1.Text = "Register 1"
$GroupBox1.Top = 120
$GroupBox1.Width = 136
;**************************************

;************* GroupBox2 **************
$GroupBox2 = $Form.Controls.GroupBox()
$GroupBox2.BackColor = 212,208,200
$GroupBox2.FontSize = 10
$GroupBox2.Height = 192
$GroupBox2.Left = 180
$GroupBox2.Text = "Register 2"
$GroupBox2.Top = 120
$GroupBox2.Width = 135
;**************************************

;************* GroupBox3 **************
$GroupBox3 = $Form.Controls.GroupBox()
$GroupBox3.BackColor = 212,208,200
$GroupBox3.FontSize = 10
$GroupBox3.Height = 192
$GroupBox3.Left = 330
$GroupBox3.Text = "Register 3"
$GroupBox3.Top = 120
$GroupBox3.Width = 136
;**************************************

;************* RadioButton22 **************
$RadioButton22 = $GroupBox1.Controls.RadioButton()
$RadioButton22.BackColor = 212,208,200
$RadioButton22.Checked = "False"
$RadioButton22.Height = 24
$RadioButton22.FontBold = "True"
$RadioButton22.FontSize = 10
$RadioButton22.Left = 15
$RadioButton22.TabStop = "False"
$RadioButton22.Text = "Print None"
$RadioButton22.Top = 30
$RadioButton22.Width = 104
$RadioButton22.OnClick = "OnRadioClick22()"
;**************************************

;************* RadioButton23 **************
$RadioButton23 = $GroupBox1.Controls.RadioButton()
$RadioButton23.BackColor = 212,208,200
$RadioButton23.Checked = "False"
$RadioButton23.Height = 24
$RadioButton23.FontSize = 10
$RadioButton23.Left = 15
$RadioButton23.TabStop = "False"
$RadioButton23.Text = "Every 10 Min."
$RadioButton23.Top = 60
$RadioButton23.Width = 104
$RadioButton23.OnClick = "OnRadioClick23()"
;**************************************



Function OnRadioClick22()
$IniFile=C:\Print.ini
$rc=writeprofilestring($IniFile,'Term1','RadioButton22Checked','True')
$rc=writeprofilestring($IniFile,'Term1','RadioButton23Checked','False')
$rc=writeprofilestring($IniFile,'Term1','RadioButton24Checked','False')
$rc=writeprofilestring($IniFile,'Term1','RadioButton25Checked','False')
$rc=writeprofilestring($IniFile,'Term1','RadioButton26Checked','False')
EndFunction

Function OnRadioClick23()
$IniFile=C:\Print.ini
$rc=writeprofilestring($IniFile,'Term1','RadioButton22Checked','False')
$rc=writeprofilestring($IniFile,'Term1','RadioButton23Checked','True')
$rc=writeprofilestring($IniFile,'Term1','RadioButton24Checked','False')
$rc=writeprofilestring($IniFile,'Term1','RadioButton25Checked','False')
$rc=writeprofilestring($IniFile,'Term1','RadioButton26Checked','False')
EndFunction




The part of the .ini file:
Code:
[Term1]
RadioButton22Checked=
RadioButton23Checked=
RadioButton24Checked=
RadioButton25Checked=
RadioButton26Checked=




Here is one of the secondary scripts:
Code:
:PRINT

$RadioButton22Checked = ReadProfileString("C:\Print.ini", "Term1", "RadioButton22Checked")
$RadioButton23Checked = ReadProfileString("C:\Print.ini", "Term1", "RadioButton23Checked")
$RadioButton24Checked = ReadProfileString("C:\Print.ini", "Term1", "RadioButton24Checked")
$RadioButton25Checked = ReadProfileString("C:\Print.ini", "Term1", "RadioButton25Checked")
$RadioButton26Checked = ReadProfileString("C:\Print.ini", "Term1", "RadioButton26Checked")

SELECT
CASE $RadioButton22Checked = "True"
$Time1 = 0
$Path1 = none
CASE $RadioButton23Checked = "True"
$Time1 = 600
$Path1 = wichitafalls
CASE $RadioButton24Checked = "True"
$Time1 = 900
$Path1 = wichitafalls
CASE $RadioButton25Checked = "True"
$Time1 = 1800
$Path1 = wichitafalls
CASE $RadioButton26Checked = "True"
$Time1 = 3600
$Path1 = wichitafalls
ENDSELECT

$rc = shellcmd('%WINDIR%\system32\PRINT.EXE /D:\\$Path1\epsontm C:\TMLOGO.TMB')
$rc = shellcmd('ECHO . \\$Path1\epsontm')
$rc = shellcmd('ECHO . \\$Path1\epsontm')
$rc = shellcmd('TIME /T > \\$Path1\epsontm')
$rc = shellcmd('DATE /T > \\$Path1\epsontm')
$rc = shellcmd('%WINDIR%\system32\PRINT.EXE /D:\\$Path1\epsontm C:\survey.txt')
SHELL "C:\WAIT.EXE $Time1"
RETURN
GOTO "PRINT"


function shellcmd($commandstring, optional $forcewait)
Dim $rc

if val($forcewait)
$forcewait='start /min /wait '
else
$forcewait=''
endif
if $commandstring<>''
$commandstring='%COMSPEC% /c '+$forcewait+$commandstring
shell $commandstring
$shellcmd=@ERROR
else
exit 87
endif

endfunction



Thanks again for your help,

-Michael


Edited by chewbaccabenz (2005-06-06 01:30 AM)

Top
#140994 - 2005-06-05 11:48 AM Re: Need help creating an application with kixtart and kixforms.
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Hello Michael and welcome to the board.

Rather large chunk of code to digest in one sitting. If I get time I'll try to review it for you if no one else comes along to help you out.

I'm sure KiX can do the job.
 

Top
#140995 - 2005-06-05 12:41 PM Re: Need help creating an application with kixtart and kixforms.
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you need to remove the calling.
as you have seen, it hangs the kixforms script.
you need to think parallel.
that is, use RUN to execute another kixtart thread with the printing script.
it will read the printing times and sleep for some seconds and read again.

the main script can control the ini as much as it wants and when exited, removes it.
then the sub script with it's own kix thread, will exit too.
_________________________
!

download KiXnet

Top
#140996 - 2005-06-05 04:50 PM Re: Need help creating an application with kixtart and kixforms.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Chewy,
Please go back, edit your post, and break the long line.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#140997 - 2005-06-05 09:45 PM Re: Need help creating an application with kixtart and kixforms.
chewbaccabenz Offline
Fresh Scripter

Registered: 2005-06-03
Posts: 6
Loc: Waco, TX USA
Hey Thanks Lonkero, your idea using RUN worked great!

-Michael
_________________________
Help Computa!

Top
#140998 - 2005-06-06 01:20 AM Re: Need help creating an application with kixtart and kixforms.
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Michael,
I got your email. What I meant was to shorten the long line that causes the sideways scrolling.
Code:

$Label1.Text = "Choose the frequency you would like a survey to print on each register."
+" One survey will print every X minutes."
+" You must select one option for each register"

_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.068 seconds in which 0.038 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org