Page 1 of 1 1
Topic Options
#84610 - 03/10/10 05:29 AM vbs2Kix() - automated VBScript to KiX-script conversion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 01/06/05
Posts: 20435
Loc: FI
;FUNCTION 
; vbs2Kix()
;
;AUTHOR
; Lonkero (Jooel_Nieminen@hotmail.com)
;
;ACTION
; Converts VBScript to kix
;
;VERSION
; 0.5
;
;VERSION HISTORY
; 0.5 10. October 2003 - First UDF version and improved logic
; 0.4 11. October 2002 - Last script-style version coded
; 0.3 11. October 2002 - First version found named on board
;
;SYNTAX
; vbs2KiX( SOURCE , DESTINATION )
;
;PARAMETERS
;
; SOURCE - The VBScript file to translate
; DESTINATION - Kix-script file where to save the code
;
;RETURNS
; nothing. check @error for success/failure.
;
;REMARKS
; you find something where this does not worky, please report
; I'm no VBS dude, so don't know what all need to be translated.
;
;DEPENDENCIES
; kixtart [Wink]
;
;EXAMPLE
; "Running logonscript..."
; vbs2KiX(@ldrive+"\logon.vbs","%temp%\logon.kxs")
; if not @error
; call "%temp%\logon.kxs"
; endif
;
;
;SOURCE
function vbs2KiX($src,$dst)
dim $file,$,$!,$_,$s,$t,$u,$c
$file=freefilehandle if not $file exit 1 endif $=open($file,$src) if @error exit @error endif
$=readline($file) redim $src while @error=0 $u=ubound($src)+1 redim preserve $src[$u] $src[$u]=$ $=readline($file) loop $=close($file)
$file=0+freefilehandle if not $file exit 1 endif if exist($dst) del $dst endif $=open($file,$dst,5) if @error exit @error endif
redim $dst[$u]

for $=0 to $u
$l=$src[$] $s="" $!=0 $_=len($l)
for $!=1 to $_
$c=substr($l,$!,1)
select
case $c='"' $s=$s+$c do if $!>=$_ $dst[$]=$s $=$+1 $l=$src[$] $s='' $!=0 $_=len($l) endif do $!=$!+1 $c=substr($l,$!,1) $s=$s+$c until $c='"' or $!=>$_ until $c='"' or $=$u
case $c='"' $s=$s+$c do if $!>=$_ $dst[$]=$s $=$+1 $l=$src[$] $s='' $!=0 $_=len($l) endif do $!=$!+1 $c=substr($l,$!,1) $s=$s+$c until $c="'" or $!=>$_ until $c="'" or $=$u
case $c=" " or $c=" " $s=$s+$c
case $c="&" $s=$s+"+"
case 1
$t="" do $t=$t+$c $!=$!+1 $c=substr($l,$!,1) until instr(" ",$c) $!=$!-1
select
case $t="_" or $t="then" or $t="wscript.echo"
case $t="const" do $!=$!+1 $c=substr($l,$!,1) until $c<>" " and $c<>" " $!=$!-1 $s=$s+"Global $$"
case $t="dim" do $!=$!+1 $c=substr($l,$!,1) until $c<>" " and $c<>" " $!=$!-1 $s=$s+"Dim $$"
case $t="set" do $!=$!+1 $c=substr($l,$!,1) until $c<>" " and $c<>" " $!=$!-1 $s=$s+"$$"
case $t="wscript.quit" $s=$s+"Quit"
case $t="true" $s=$s+"not 0"
case $t="false" $s=$s+"not 1"
case $t+substr($l,$!,3)="end if" $s=$s+"EndIf"
case 1 $s=$s+$t
endselect
endselect
next
$dst[$]=$s
next
for $=0 to $u $!=writeline($file,$dst[$]+@crlf) next
endfunction


[ 10. October 2003, 09:53: Message edited by: Lonkero ]

Top
#84611 - 04/08/31 02:11 PM Re: vbs2Kix() - automated VBScript to KiX-script conversion
solostyle Offline
Fresh Scripter

Registered: 04/07/20
Posts: 15
Loc: maryland, us
single quote is like the kix semicolon, everything after it is a comment.
_________________________
kickin it solo

Top
#84612 - 05/04/13 10:19 AM Re: vbs2Kix() - automated VBScript to KiX-script conversion
kid Offline
Fresh Scripter

Registered: 05/04/13
Posts: 5
Dear all,

I'm not a expert with vbs and KiXscripts.
I have a nice vbs script but I like to have it in KiX script.
How and what I have to do?
Please tell me step by step.

Nice regards
KiD

Top
#84613 - 05/04/13 10:20 AM Re: vbs2Kix() - automated VBScript to KiX-script conversion
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 01/06/05
Posts: 20435
Loc: FI
ask this question in starters with your script attached to it and you shall get a nice answer
Top
#84614 - 05/05/29 02:22 PM Re: vbs2Kix() - automated VBScript to KiX-script conversion
pashikhan2005 Offline
Lurker

Registered: 05/05/29
Posts: 1
my friend,

i have some abc.vbs file like VBscript

set wshNetwork = CreateObject ("WScript.Network")
wshNetwork.SetDefaultPrinter "\\intserver\hpcolor"

i m useing your Kix script but its not work

may be u have some solution if u have somethink plz send me

thanks

Pashi khan
KSA


Top
#84615 - 05/05/29 04:51 PM Re: vbs2Kix() - automated VBScript to KiX-script conversion
Les Offline
KiX Master
*****

Registered: 01/06/11
Posts: 12541
Loc: fortfrances.on.ca
Pashi,
Please post your question in the Starters forum and not here.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#180355 - 07/09/10 03:42 PM Re: vbs2Kix() - automated VBScript to KiX-script conversion [Re: Lonkero]
SlickRay Offline
Lurker

Registered: 07/09/10
Posts: 2
Hi,
I'm a new member.
I'm trying to attach a VBscript within Kixtart script, how can i do that?
Here's my vbscript,


please help


Attachments
SET_THERESERVE_ADMINS.txt (296 downloads)
Description:



Top
#180357 - 07/09/10 04:04 PM Re: vbs2Kix() - automated VBScript to KiX-script conversion [Re: SlickRay]
Mart Moderator Online   content
KiX Supporter
*****

Registered: 02/03/27
Posts: 3897
Loc: Rotterdam, The Netherlands
Like Les said to an earlier poster just above your post you should make a new post in basic or advanced scripting. Your question has nothing to do with converting a VBS script to a kix script. That is what this UDF does.

Edited by Mart (07/09/10 04:05 PM)
_________________________
Mart

- My drums, my drums, MY DRUMS!!
Animal Muppet - Wild thing

Top
Page 1 of 1 1


Moderator:  Jochen, Radimus, Sealeopard, Bryce, Kdyer, Howard Bullock, Chris S., Glenn Barnas, Allen, Benny69, Mart 
Hop to:
Shout Box

Who's Online
4 registered (tomcoleman, Rickard, Mart, Ask_IT) and 45 anonymous users online.

Generated in 0.094 seconds in which 0.023 seconds were spent on a total of 15 queries. Zlib compression enabled.

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