egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Absolute path in Windrop?

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
henasraf
Voice


Joined: 02 Nov 2009
Posts: 4
Location: Bat Yam, Israel

PostPosted: Mon Dec 14, 2009 3:24 am    Post subject: Absolute path in Windrop? Reply with quote

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:
Back to top
View user's profile Send private message Visit poster's website
arfer
Master


Joined: 26 Nov 2004
Posts: 436
Location: Manchester, UK

PostPosted: Mon Dec 14, 2009 9:53 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber