Re: How to wrap a tcl file to .exe on windows?

CJL <[email protected]> Sun, 6 Apr 2014 13:19:45 -0700 (PDT)
Newsgroups gmane.comp.lang.tcl.starkit
Message-ID <[email protected]>
------=_Part_2286_32920501.1396815585588
Content-Type: text/plain; charset=UTF-8

On Wednesday, 2 April 2014 18:30:48 UTC+1, neutrino wrote:

> there is a file chess.tcl in C:\source , this file works well when 
> executed 
> on wish with the command source . in chess.tcl , i use some png files and 
> a 
> txt. these files are also in  C:\source. now i want to wrap these files 
> into 
> an exe . i follow the steps on wiki . but it does't show how to include 
> these extra png files and txt files. is there anyone who knows the detail 
> steps to do this ? 
> thanks for your help


You need a copy of sdx.kit (from http://equi4.com/starkit/sdx.html), and a 
tclkit.exe.

If you don't already have a tclkit.exe, some relatively old tclkits are 
available here : http://equi4.com/tclkit/download.html, some slightly more 
recent ones here : http://rkeene.org/projects/info/wiki/Tclkits

If you want/need 8.6.x, I'm not sure which the current/preferred tclkit 
build system is, but I've had good results with kitcreator 
(http://kitcreator.rkeene.org/fossil/index)

To match these instructions, put tclkit.exe and sdx.kit in c:\Source

Now, in a command prompt:

> c:
> cd \source

# We need a copy of tclkit.exe to use for the final executable
> copy tclkit.exe runtime.exe

# Wrap the script into a .kit
> tclkit sdx.kit qwrap chess.tcl

# Unwrap the .kit into a vfs directory structure
> tclkit sdx.kit unwrap chess.kit

# Your chess.tcl now exists as chess.vfs/lib/app-chess/chess.tcl
# so delete the original (or move it if you prefer)
> del chess.tcl

# The .kit was a temporary step, so remove it too
> del chess.kit

# Move the PNGs inside the vfs
> mkdir chess.vfs\images
> move *.png chess.vfs\images

# You should now be able to wrap into an executable
# NOTE: the value for '-runtime' must refer to a COPY of tclkit.exe
#       It cannot be the same executable that you are running
> tclkit sdx.kit wrap chess -runtime runtime.exe

You should now have a chess.exe, but it won't know where to find the PNG 
files.

Edit chess.vfs\lib\app-chess\chess.tcl along these lines:

Before :
    set img [image create photo -file king.png]

After :
    set kingFile [file join $starkit::topdir images king.png]
    set img [image create photo -file $kingFile]

NOTE : You do not have to wrap every time you make a change. You can run 
the contents of the VFS in unwrapped form:

> tclkit.exe chess.vfs\main.tcl

Then, when you are happy with your app, perform the final wrap step again 
to make an executable:
> tclkit sdx.kit wrap chess -runtime runtime.exe


NOTE : The above is all written from memory and by a Mac user, so you may 
have to make some slight changes to suit your system.

If your code never does a 'cd', you can get away with just specifying 
relative paths starting with chess.vfs :

% set pathToFile [file join chess.vfs images whatever.png]

But, it's safer and hardly any extra typing to use starkit::topdir, from 
which you can build paths:

% set pathToFile [file join $::starkit::topdir images whatever.png]

There is also a variable, starkit::mode, that tells you whether you are 
running wrapped or unwrapped, but it is unlikely that you will need to make 
the distinction.

Chris

-- 
-- 
You received this message because you are subscribed to the "starkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/starkit?hl=en
--- 
You received this message because you are subscribed to the Google Groups "starkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

------=_Part_2286_32920501.1396815585588
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, 2 April 2014 18:30:48 UTC+1, neutrino  wrote=
:<br><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;">there is a file chess.tcl=
 in C:\source , this file works well when executed
<br>on wish with the command source . in chess.tcl , i use some png files a=
nd a
<br>txt. these files are also in &nbsp;C:\source. now i want to wrap these =
files into
<br>an exe . i follow the steps on wiki . but it does't show how to include
<br>these extra png files and txt files. is there anyone who knows the deta=
il
<br>steps to do this ?
<br>thanks for your help</blockquote><div><br></div><div>You need a copy of=
 sdx.kit (from http://equi4.com/starkit/sdx.html), and a tclkit.exe.</div><=
div><br></div><div>If you don't already have a tclkit.exe, some relatively =
old tclkits are available here :&nbsp;http://equi4.com/tclkit/download.html=
, some slightly more recent ones here :&nbsp;http://rkeene.org/projects/inf=
o/wiki/Tclkits</div><div><br></div><div>If you want/need 8.6.x, I'm not sur=
e which the current/preferred tclkit build system is, but I've had good res=
ults with kitcreator (http://kitcreator.rkeene.org/fossil/index)</div><div>=
<br></div><div>To match these instructions, put tclkit.exe and sdx.kit in c=
:\Source</div><div><br></div><div>Now, in a command prompt:</div><div><br><=
/div><div>&gt; c:</div><div>&gt; cd \source</div><div><br></div><div># We n=
eed a copy of tclkit.exe to use for the final executable</div><div>&gt; cop=
y tclkit.exe runtime.exe</div><div><br></div><div># Wrap the script into a =
.kit</div><div>&gt; tclkit sdx.kit qwrap chess.tcl</div><div><br></div><div=
># Unwrap the .kit into a vfs directory structure</div><div>&gt; tclkit sdx=
.kit unwrap chess.kit</div><div><br></div><div># Your chess.tcl now exists =
as chess.vfs/lib/app-chess/chess.tcl</div><div># so delete the original (or=
 move it if you prefer)</div><div>&gt; del chess.tcl</div><div><br></div><d=
iv># The .kit was a temporary step, so remove it too</div><div>&gt; del che=
ss.kit</div><div><br></div><div># Move the PNGs inside the vfs</div><div>&g=
t; mkdir chess.vfs\images</div><div>&gt; move *.png chess.vfs\images</div><=
div><br></div><div># You should now be able to wrap into an executable</div=
><div># NOTE: the value for '-runtime' must refer to a COPY of tclkit.exe</=
div><div># &nbsp; &nbsp; &nbsp; It cannot be the same executable that you a=
re running</div><div>&gt; tclkit sdx.kit wrap chess -runtime runtime.exe</d=
iv><div><br></div><div>You should now have a chess.exe, but it won't know w=
here to find the PNG files.</div><div><br></div><div>Edit chess.vfs\lib\app=
-chess\chess.tcl along these lines:</div><div><br></div><div>Before :</div>=
<div>&nbsp; &nbsp; set img [image create photo -file king.png]</div><div><b=
r></div><div>After :</div><div>&nbsp; &nbsp; set kingFile [file join $stark=
it::topdir images king.png]</div><div>&nbsp; &nbsp; set img [image create p=
hoto -file $kingFile]</div><div><br></div><div>NOTE : You do not have to wr=
ap every time you make a change. You can run the contents of the VFS in unw=
rapped form:</div><div><br></div><div>&gt; tclkit.exe chess.vfs\main.tcl</d=
iv><div><br></div><div>Then, when you are happy with your app, perform the =
final wrap step again to make an executable:</div><div><div>&gt; tclkit sdx=
.kit wrap chess -runtime runtime.exe</div></div><div><br></div><div><br></d=
iv><div>NOTE : The above is all written from memory and by a Mac user, so y=
ou may have to make some slight changes to suit your system.</div><div><br>=
</div><div><div>If your code never does a 'cd', you can get away with just =
specifying relative paths starting with chess.vfs :</div><div><br></div><di=
v>% set pathToFile [file join chess.vfs images whatever.png]</div></div><di=
v><br></div><div>But, it's safer and hardly any extra typing to use starkit=
::topdir, from which you can build paths:</div><div><br></div><div>% set pa=
thToFile [file join $::starkit::topdir images whatever.png]</div><div><br><=
/div><div>There is also a variable, starkit::mode, that tells you whether y=
ou are running wrapped or unwrapped, but it is unlikely that you will need =
to make the distinction.</div><div><br></div><div>Chris</div><div><br></div=
></div>

<p></p>

-- <br />
-- <br />
You received this message because you are subscribed to the &quot;starkit&q=
uot; group.<br />
To post to this group, send email to [email protected]<br />
To unsubscribe from this group, send email to starkit-unsubscribe@googlegro=
ups.com<br />
For more options, visit this group at <a href=3D"http://groups.google.com/g=
roup/starkit?hl=3Den">http://groups.google.com/group/starkit?hl=3Den</a><br=
 />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;starkit&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">starkit+uns=
[email protected]</a>.<br />
For more options, visit <a href=3D"https://groups.google.com/d/optout">http=
s://groups.google.com/d/optout</a>.<br />

------=_Part_2286_32920501.1396815585588--