Page 2 of 3 <123>
Topic Options
#126448 - 2004-09-10 11:17 PM Re: Importing Environmental Variables
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

Starting not to feel so bad.

This is from the Kixtart 2001 v4.22 manual:

Code:
$Rc = Execute( ‘$$X = ’ + @USERID )


And it's causing the exact same error, when it is the only line in a brand new script!



That is because you have curly quotes. Are you sure the manual is for 4.22 cuz we banned the ‘curlies’?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#126449 - 2004-09-10 11:19 PM Re: Importing Environmental Variables
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Damn... Ruud promised no more curlies! Damn!
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#126450 - 2004-09-10 11:22 PM Re: Importing Environmental Variables
xpanmanx Offline
Starting to like KiXtart

Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
That snippet was a cut-and-paste from the manual. My testing code used apostophes.
Top
#126451 - 2004-09-10 11:23 PM Re: Importing Environmental Variables
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Code:
Break On

$rc=SetOption( "NoVarsInStrings", "ON" )
If Open(1,'c:\data\scripts\junk.txt') = 0
$raw_line = ReadLine(1)
While @ERROR = 0
$raw_line = Trim(SubStr(Lcase($raw_line),5))
$var_name = left($raw_line, instr($raw_line,"=")-1)
$var_value = substr($raw_line, instr($raw_line,"=")+1)
;? "$"+$var_name+"="+$var_value
$rc=execute ("$" + $var_name + "='" + $var_value + "'")

$raw_line = ReadLine(1)
Loop
$rc=Close(1)
EndIf
? '___________________________________________________________________'
?
? "Output:"
? "$autodeploy_process_type=" + $autodeploy_process_type
? "$timezone=" + $timezone
? "$days_to_retain_full_workstation_backup=" + $days_to_retain_full_workstation_backup
? "$distribution_medium=" + $distribution_medium
? "$serialnum=" + $serialnum
? "$machinetype=" + $machinetype
? "$comppath=" + $comppath





or
Code:
Break On

$rc=SetOption( "NoVarsInStrings", "ON" )
If Open(1,'c:\data\scripts\junk.txt') = 0
$raw_line = ReadLine(1)
While @ERROR = 0
$mod_line = Trim(Lcase(SubStr(left($raw_line, instr($raw_line,"=")),5) +
"'" + substr($raw_line, instr($raw_line,"=")+1) + "'"))
$rc=execute ("$" + $mod_line)
$raw_line = ReadLine(1)
Loop
$rc=Close(1)
EndIf
? '___________________________________________________________________'
?
? "Output:"
? "$autodeploy_process_type=" + $autodeploy_process_type
? "$timezone=" + $timezone
? "$days_to_retain_full_workstation_backup=" + $days_to_retain_full_workstation_backup
? "$distribution_medium=" + $distribution_medium
? "$serialnum=" + $serialnum
? "$machinetype=" + $machinetype
? "$comppath=" + $comppath



Edited by Howard Bullock (2004-09-10 11:34 PM)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#126452 - 2004-09-10 11:23 PM Re: Importing Environmental Variables
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
and I have it on record...
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Board=UBB4&Number=81097&Forum=UBB4&Words=curly&Match=And&Searchpage=0&Limit=25&Old=allposts&Main=81090&Search=true#Post81097
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#126453 - 2004-09-10 11:29 PM Re: Importing Environmental Variables
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Assuming that each line starts with 'set ' then this script should work just fine for you. Just try running this and see what you get (obviously change the file)

Code:

$ = open(1,"c:\blah.txt")
$curLine = substr(readline(1),5)
while @error = 0
$firstEqualPos = instr($curLine, '=')
$varName = substr($curLine,1,$firstEqualPos-1)
$val = '"' + substr($curLine,$firstEqualPos+1) + '"'
$ = execute("$$" + $varName + "=" + $val)
$curLine = substr(readline(1),5)
loop
$ = close(1)

? $AutoDeploy_Process_Type
? $TIMEZONE
? $DAYS_TO_RETAIN_FULL_WORKSTATION_BACKUP
? $DISTRIBUTION_MEDIUM
? $SERIALNUM
? $MACHINETYPE
? $CompPath



my blah.txt file looks like this

Code:

set AutoDeploy_Process_Type=Attended Network-based Migration
SET TIMEZONE=003
SET DAYS_TO_RETAIN_FULL_WORKSTATION_BACKUP=30
Set DISTRIBUTION_MEDIUM=Network
SET SERIALNUM=7GCXZ01
SET MACHINETYPE=COMPUTERS-XP
set CompPath=CN=7GCXZ01,OU=Outlook Mail Client,OU=Employees,OU=CORP,DC=CORP1,DC=CORP,DC=COM



And here's the output i get
Quote:


Attended Network-based Migration
003
30
Network
7GCXZ01
COMPUTERS-XP
CN=7GCXZ01,OU=Outlook Mail Client,OU=Employees,OU=CORP,DC=CORP1,DC=CORP,DC=COM





or howard's should work just fine too


Edited by maciep (2004-09-10 11:35 PM)
_________________________
Eric

Top
#126454 - 2004-09-13 04:53 PM Re: Importing Environmental Variables
xpanmanx Offline
Starting to like KiXtart

Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
I went with this:
Execute("$$" + $var_name + "='" + $var_value + "'")

It works MARVELOUSLY with one exception: values that contain $, such as: \\srv\c$\blah or \\srv\c$

I can't figure out how to handle the embedded $ . When one is encountered, the script beeps me out with an "Error in Expression" message.

The 2nd line of my script is SetOption('NoVarsInStrings','On') .

Help with this?

Thanks very very much.

Tim ==


Edited by xpanmanx (2004-09-13 05:33 PM)

Top
#126455 - 2004-09-13 09:43 PM Re: Importing Environmental Variables
xpanmanx Offline
Starting to like KiXtart

Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
Whoops, it seems that its not the embedded $ -- it's when a variable name contains a mathematical operator, ie:

BACKUP_LOCATION-REMOTE=\\srv01\cfg_backup$

I would think that I could apply two litte quotes and fix everything...
Execute("$$" + "$var_name" + "='" + $var_value + "'")
...but it doesn't work.

Thanks,

Tim ==

Top
#126456 - 2004-09-13 10:03 PM Re: Importing Environmental Variables
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
If you have SetOption('NoVarsInStrings','On') then you only need a single "$" in the line:
Execute("$$" + "$var_name" + "='" + $var_value + "'")
and no quotes around "$var_name" as this will be literal and no variable substitution performed.
Please see my posted code several replies above.


Edited by Howard Bullock (2004-09-13 10:04 PM)
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#126457 - 2004-09-13 10:22 PM Re: Importing Environmental Variables
xpanmanx Offline
Starting to like KiXtart

Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
Howard,

I've done a cut-and-paste on your code in post #125505, changing only the path and filename of the data file.

The first code example definitely chokes when it encounters the line...
Set BACKUP_LOCATION-REMOTE=\\srv01\cfg_backup$

The second code example beeps out in error without producing any visible output. I've tried this code two different ways: first by merging lines 6 & 7 into a single line by deleting the CR and spaces, and then using it exactly as posted.

Thanks,

Tim ==

Top
#126458 - 2004-09-13 10:26 PM Re: Importing Environmental Variables
xpanmanx Offline
Starting to like KiXtart

Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
maciep,

(Please forgive the "template" look of this reply )

I've done a cut-and-paste on your code in post #125507, changing only the path and filename of the data file.

The code example beeps out in error without producing any visible output.

Thanks,

Tim ==

Top
#126459 - 2004-09-13 10:32 PM Re: Importing Environmental Variables
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Well from the manual:

A variable name:
• Can't contain operator characters (+,-,*,/,&,<,>,=)
• Can’t contain a period
• Must be unique within the same scope, which is the range from which the variable can be referenced in a script, or script segment.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#126460 - 2004-09-13 10:43 PM Re: Importing Environmental Variables
xpanmanx Offline
Starting to like KiXtart

Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
Yup, I saw that earlier today. I was hoping that master magicians like yourself might know a way around that limitation, by using character codes or other tricks of which initiates like me are ignorant.
Top
#126461 - 2004-09-13 11:01 PM Re: Importing Environmental Variables
xpanmanx Offline
Starting to like KiXtart

Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
I guess I should cut my losses and move on. At this time I can't redesign the uplevel product to remove the operands from the variable names. Fortunately those names are acceptable in DOS batch. The next time I crack open that code I'll clean the variable names.

You'll see that I've added a trap to catch and ignore variable names which contain operands...my final code looks like this:

Code:
Break on

Color c+/n

$dummy = SetOption('novarsinstrings','on')
;$dummy = SetOption('explicit','on') -- can't use explicit without dimming each $var_name
$dummy = SetOption('wrapateol','on')

If Open(1,'c:\temp\envars.bat') = 0

$raw_line = Trim(SubStr(Lcase(ReadLine(1)),5))

While @error = 0

$var_name = ''
$var_value = ''
$dummy = ''

;provide special handling for ldap path
If InStr($raw_line,'comppath')
For Each $element in Split($raw_line,'comppath' + Chr(61))
$var_name = 'comppath'
$var_value = $element
Next
GoTo set_var
EndIf

For Each $element in Split($raw_line,Chr(61))
Select
Case $var_name = '' $var_name = $element
Case $var_value = '' $var_value = $element
EndSelect
Next

If InStr($var_name,'-')
? $var_name Color r+/n ' $var_name contains operand - skipped' Color c+/n
GoTo next_line
EndIf

:set_var
? '$' + $var_name + '=' + $var_value
If $var_value = ''
Color r+/n "null - skipped" Color c+/n
GoTo next_line
EndIf

$dummy = Execute ("$" + $var_name + "='" + $var_value + "'")

:next_line
$raw_line = Trim(SubStr(Lcase(ReadLine(1)),5))

Loop

Close(1)

EndIf


Thank you, everyone, for your help.

Best regards,

Tim ==

Top
#126462 - 2004-09-14 02:14 AM Re: Importing Environmental Variables
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
If it would be acceptable, we can substitute a different "valid" character for all the illegal characters that are encountered.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#126463 - 2004-09-14 10:06 AM Re: Importing Environmental Variables
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Tim,

What are you going to do with the variables? Does it matter if they are renamed as Howard suggests, replacing the illegall characters with (say) an underscore "_"?

If you need to preserve the variable names, you can use an intermediate format to store them, like an INI file.

You can also use a simple "hashed array" which comprises two parallel arrays, the first with the variable name and the second with the value.

The hashed array or INI file solution has a couple of useful side effects, such as the ability to iterate the variable collection using "For Each" type constructs.

Top
#126464 - 2004-09-14 08:57 PM Re: Importing Environmental Variables
xpanmanx Offline
Starting to like KiXtart

Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
No, I can sub the variable names if it become necessary.

However, I don't think I'll need to use those particular variables within this script, so I'm able to just ignore them for now.

Top
#126465 - 2004-09-14 10:16 PM Re: Importing Environmental Variables
xpanmanx Offline
Starting to like KiXtart

Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
Okay, now I'm in waay over my head.

One of the several things I'm trying to do with this code, is to grab a value from a text file, set it as a Kix variable, then mod @date against the variable using Jochen's DateCalc UDF.

Net/net is that I'm trying to obtain a calendar date X days in the future, where "X" is the numerical value taken from the 'set days_to_retain_full_workstation_backup=x' line in the text file, as $days_to_retain_full_workstation_backup in the KIX script.
Code:
;DateCalc=======================================================================================

Function DateCalc($date1, $DateOrMod, optional $SingleDigit)

Dim $_intDate1, $_intYear1, $_intMonth1, $_intDay1
Dim $_intDate2, $_intYear2, $_intMonth2, $_intDay2

$date1 = Split($date1,'/')
If Ubound($date1) <> 2
Exit 1
EndIf

$_intYear1 = Val($date1[0])
$_intMonth1 = Val($date1[1])
$_intDay1 = Val($date1[2])
If $_intMonth1 < 3
$_intMonth1 = $_intMonth1 + 12
$_intYear1 = $_intYear1 - 1
EndIf

$_intDate1 = $_intDay1 + ( 153 * $_intMonth1 - 457 ) / 5 + 365 * $_intYear1 +
$_intYear1 / 4 - $_intYear1 / 100 + $_intYear1 / 400 - 306

Select

Case VarType($DateOrMod) = 3

$_intDate2 = $_intDate1 + $DateOrMod
If InStr($_intDate2,'-') $_intDate2 = Val(SubStr($_intDate2,2,Len($_intDate2)-1)) EndIf

$_intYear2 = ( 100 * ( ( ( 100*($_intDate2+306)-25)/3652425)
- ( ((100*($_intDate2+306)-25)/3652425)/4)
) + (100*($_intDate2+306)-25)
) / 36525
$_intMonth2 = ( 5 * ( ( ( 100*($_intDate2+306)-25)/3652425)
- ( ((100*($_intDate2+306)-25)/3652425)/4)
+ ($_intDate2+306) - 365 * $_intYear2 - $_intYear2 / 4
) + 456
) / 153
$_intDay2 = ( ( ( 100*($_intDate2+306)-25)/3652425)
- ( ((100*($_intDate2+306)-25)/3652425)/4)
+ ($_intDate2+306) - 365 * $_intYear2 - $_intYear2 / 4
) - ( 153 * $_intMonth2 - 457
) / 5

If $_intMonth2 > 12 $_intYear2 = $_intYear2 + 1 $_intMonth2 = $_intMonth2 - 12 EndIf


If NOT $SingleDigit
If Len($_intYear2 ) < 4
$_ = Execute("for $i=1 to 4-len($$_intYear2) $$_intYear2 = '0' + $$_intYear2 next")
EndIf
$_intMonth2 = Right("0" + $_intMonth2,2)
$_intDay2 = Right("0" + $_intDay2,2)
EndIf

$DateCalc = '$_intYear2/$_intMonth2/$_intDay2'

Case VarType($DateOrMod) = 8

$DateOrMod = Split($DateOrMod,'/')
If Ubound($DateOrMod) <> 2
Exit 1
EndIf

$_intYear2 = Val($DateOrMod[0])
$_intMonth2 = Val($DateOrMod[1])
$_intDay2 = Val($DateOrMod[2])

If $_intMonth2 < 3
$_intMonth2 = $_intMonth2 + 12
$_intYear2 = $_intYear2 - 1
EndIf

$_intDate2 = $_intDay2 + ( 153 * $_intMonth2 - 457 ) / 5 + 365 * $_intYear2 +
$_intYear2 / 4 - $_intYear2 / 100 + $_intYear2 / 400 - 306

$DateCalc = $_intDate1 - $_intDate2
;comment the next line if you wish to return negative results also !!!
If InStr($DateCalc,'-') $DateCalc = Val(SubStr($DateCalc,2,Len($DateCalc)-1)) EndIf

Case 1

Exit 1

EndSelect

EndFunction
;===============================================================================================

Break on

Color c+/n

$dummy = SetOption('novarsinstrings','on')
;$dummy = SetOption('explicit','on') -- can't use explicit without dimming each $var_name
$dummy = SetOption('wrapateol','on')

If Open(1,'c:\temp\envars.bat') = 0

$raw_line = Trim(SubStr(Lcase(ReadLine(1)),5))

While @error = 0

$var_name = ''
$var_value = ''
$dummy = ''

;provide special handling for ldap path
If InStr($raw_line,'comppath')
For Each $element in Split($raw_line,'comppath' + Chr(61))
$var_name = 'comppath'
$var_value = $element
Next
GoTo set_var
EndIf

For Each $element in Split($raw_line,Chr(61))
Select
Case $var_name = '' $var_name = $element
Case $var_value = '' $var_value = $element
EndSelect
Next

If InStr($var_name,'-')
? $var_name Color r+/n ' $var_name contains operand - skipped' Color c+/n
GoTo next_line
EndIf

:set_var
? '$' + $var_name + '=' + $var_value
If $var_value = ''
Color r+/n "null - skipped" Color c+/n
GoTo next_line
EndIf

$dummy = Execute ("$" + $var_name + "='" + $var_value + "'")

:next_line
$raw_line = Trim(SubStr(Lcase(ReadLine(1)),5))

Loop

Close(1)

EndIf

;===============================================================================================

@CRLF + @CRLF

? '$days_to_retain_full_workstation_backup=' + $days_to_retain_full_workstation_backup

$begin_prompting_calc = DateCalc(@date, $days_to_retain_full_workstation_backup)

? '$begin_prompting_calc=' + $begin_prompting_calc

@CRLF + @CRLF

Get $

The problem is that $begin_prompting_calc is returning empty.

If I set NOVARSINSTRINGS to 'ON', $begin_prompting_calc appears as $_intYear2/$_intMonth2/$_intDay2 .

Any ideas?


Edited by xpanmanx (2004-09-14 11:11 PM)

Top
#126466 - 2004-09-15 10:52 AM Re: Importing Environmental Variables
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Quote:

Any ideas?




Yes, you need to cast the adjustment day value to an integer (it will be a string).

Here is a complete solution.

Note the following enhancements:
  • Imported variable names are prefixed with an underscore to avoid clashes with your own variables - this is documented in the script and you can change it if you wish.
  • Illegal characters in variable names are replaced with underscores.
  • The variable parse routine will handle values with embedded quotes (' and " characters)
  • Works with SetOption("Explicit","ON") - variables are declared with global scope.


Give it a go and let us know how you get on.

Code:
Break ON


$=SetOption("Explicit","ON")

Dim $sVarsPath,$fdVars
Dim $sLine,$s
Dim $sVarName,$sVarValue
Dim $sAllowed,$iIndex

$sAllowed="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_"

$fdVars=FreeFileHandle()
If Not $fdVars funFatal("Cannot get free file handle") EndIf

$sVarsPath="c:\temp\envvars.bat"
If Open($fdVars,$sVarsPath) funFatal("Cannot open file '"+$sVarsPath+"' for reading.") EndIf

; Load environment variables.
$sLine=ReadLine($fdVars)
While @ERROR=0
If Left($sLine,4)="SET "
$iIndex=InStr($sLine,"=")
If Not $iIndex $iIndex=Len($sLine)+1 EndIf
$s=SubStr($sLine,5,$iIndex-5)
$sVarName="_" ; Start variable name with "_" to avoid namespace clashes
; Remove any illegal characters from variable name
While $s <> ""
If InStr($sAllowed,Left($s,1))
$sVarName=CStr($sVarName)+Left($s,1)
Else
$sVarName=CStr($sVarName)+"_"
EndIf
$s=SubStr($s,2)
Loop
; Create global variable
$=Execute("Global $$"+$sVarName)
$sVarValue=SubStr($sLine,$iIndex+1)
; Remove any tricky quote marks from value and assign to KiXtart variable
$=Execute("$$"+$sVarName+"='"+Join(Split($sVarValue,"'"),"'+Chr("+Asc("'")+")+'")+"'")
EndIf
$sLine=ReadLine($fdVars)
Loop

$=Close($fdVars)

"Begin prompting at "+DateCalc(@DATE,Cint($_days_to_retain_full_workstation_backup)) ?

Function funFatal($s)
CStr($s)+@CRLF
If @ERROR "Reason: ["+@ERROR+"] "+@SERROR+@CRLF EndIf
Quit @ERROR
EndFunction

;DateCalc=======================================================================================
Function DateCalc($date1, $DateOrMod, optional $SingleDigit)

Dim $_intDate1, $_intYear1, $_intMonth1, $_intDay1
Dim $_intDate2, $_intYear2, $_intMonth2, $_intDay2

$date1 = Split($date1,'/')
If Ubound($date1) <> 2
Exit 1
EndIf

$_intYear1 = Val($date1[0])
$_intMonth1 = Val($date1[1])
$_intDay1 = Val($date1[2])
If $_intMonth1 < 3
$_intMonth1 = $_intMonth1 + 12
$_intYear1 = $_intYear1 - 1
EndIf

$_intDate1 = $_intDay1 + ( 153 * $_intMonth1 - 457 ) / 5 + 365 * $_intYear1 +
$_intYear1 / 4 - $_intYear1 / 100 + $_intYear1 / 400 - 306

Select

Case VarType($DateOrMod) = 3

$_intDate2 = $_intDate1 + $DateOrMod
If InStr($_intDate2,'-') $_intDate2 = Val(SubStr($_intDate2,2,Len($_intDate2)-1)) EndIf

$_intYear2 = ( 100 * ( ( ( 100*($_intDate2+306)-25)/3652425)
- ( ((100*($_intDate2+306)-25)/3652425)/4)
) + (100*($_intDate2+306)-25)
) / 36525
$_intMonth2 = ( 5 * ( ( ( 100*($_intDate2+306)-25)/3652425)
- ( ((100*($_intDate2+306)-25)/3652425)/4)
+ ($_intDate2+306) - 365 * $_intYear2 - $_intYear2 / 4
) + 456
) / 153
$_intDay2 = ( ( ( 100*($_intDate2+306)-25)/3652425)
- ( ((100*($_intDate2+306)-25)/3652425)/4)
+ ($_intDate2+306) - 365 * $_intYear2 - $_intYear2 / 4
) - ( 153 * $_intMonth2 - 457
) / 5

If $_intMonth2 > 12 $_intYear2 = $_intYear2 + 1 $_intMonth2 = $_intMonth2 - 12 EndIf


If NOT $SingleDigit
If Len($_intYear2 ) < 4
$_ = Execute("for $i=1 to 4-len($$_intYear2) $$_intYear2 = '0' + $$_intYear2 next")
EndIf
$_intMonth2 = Right("0" + $_intMonth2,2)
$_intDay2 = Right("0" + $_intDay2,2)
EndIf

$DateCalc = '$_intYear2/$_intMonth2/$_intDay2'

Case VarType($DateOrMod) = 8

$DateOrMod = Split($DateOrMod,'/')
If Ubound($DateOrMod) <> 2
Exit 1
EndIf

$_intYear2 = Val($DateOrMod[0])
$_intMonth2 = Val($DateOrMod[1])
$_intDay2 = Val($DateOrMod[2])

If $_intMonth2 < 3
$_intMonth2 = $_intMonth2 + 12
$_intYear2 = $_intYear2 - 1
EndIf

$_intDate2 = $_intDay2 + ( 153 * $_intMonth2 - 457 ) / 5 + 365 * $_intYear2 +
$_intYear2 / 4 - $_intYear2 / 100 + $_intYear2 / 400 - 306

$DateCalc = $_intDate1 - $_intDate2
;comment the next line if you wish to return negative results also !!!
If InStr($DateCalc,'-') $DateCalc = Val(SubStr($DateCalc,2,Len($DateCalc)-1)) EndIf

Case 1

Exit 1

EndSelect

EndFunction


Top
#126467 - 2004-09-15 05:35 PM Re: Importing Environmental Variables
xpanmanx Offline
Starting to like KiXtart

Registered: 2002-07-08
Posts: 108
Loc: St. Louis MO USA
Richard!! Thank you!! Works like a CHAMP.

That is the nicest thing anyone's done for me in quite some time. I really appreciate your work!!

Top
Page 2 of 3 <123>


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

Who's Online
0 registered and 476 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.078 seconds in which 0.028 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