This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Absolute path in Windrop?

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
henasraf
Voice
Posts: 4
Joined: Mon Nov 02, 2009 4:34 am
Location: Bat Yam, Israel
Contact:

Absolute path in Windrop?

Post by henasraf »

Yes, I know it's tricky. But I tried and I can't find the trick! What do I do to be able to refer to a file using an absolute path in Tcl used by Windrop? Please help D:
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

I tend to use the 'file join' command to add whatever separator is appropriate for the operating environment. This would work irrespective of the bot being an Eggdrop on a Linux shell or a Windrop on your Windows based PC.

For example you could enquire if the directory c:\windows and/or d:\windows exists using the following Tcl via the windrops partyline (providing of course partyline .tcl commands are activated on in the bot's .conf file) :-

[13:41] <arfer> .tcl set x [file isdirectory [file join c: windows]]
[13:41] <osmosis> Tcl: 1

[13:55] <arfer> .tcl set x [file isdirectory [file join d: windows]]
[13:55] <osmosis> Tcl: 0

If I was opening a file for reading with a path relative to the bots root directory, I could use something like the following for example :-

set id [open [file join scripts data whatever.txt] r]
I must have had nothing to do
Post Reply