Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Chael
Beginner


Joined: 23 Jun 2003
Posts: 17

PostPosted: Fri Jul 25, 2003 4:08 am   

excel and zmud
 
need to be able to send info captured from a trigger into excel anyone got some advice. I have done it with msword.
Reply with quote
Posideon
Beginner


Joined: 06 Feb 2005
Posts: 26

PostPosted: Fri Jun 02, 2006 12:14 am   
 
I also would like to know how to capture info and send it into Microsoft Excel. I have my triggers set up to capture what I want and store it as variables, I just need to know how to put the variables into the specific places I want them. I have tried useing %ddepoke, but can't quite figure out how to get it to work. Any help would be greatly appriciated.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Fri Jun 02, 2006 9:17 am   
 
You probably want to use the COM interface. Unfortunately I'm no expert there but the followng tutorial should provide some insight. http://www.zuggsoft.com/zmud/com.htm

http://msdn2.microsoft.com/en-us/library/f27xe9xb.aspx
_________________
Asati di tempari!
Reply with quote
Glorida
Newbie


Joined: 10 Mar 2006
Posts: 7

PostPosted: Sat Jun 03, 2006 9:16 pm   Alternative
 
Depending upon how you want your data to show up in the excel worksheet, you can do two separate things.

First, if you're not worried about columns, then you can simply:
#file 1 file.xls
#write 1 stuff
#close 1
This will create an excell file.
Now, excel normally uses tab delimiter for columns, so if there's a way in zmud to write tabs, then use this option. Tab is between columns, carriage return is between rows.

If you need columns and there isn't a way to write tabs using Zmud, another simple option is available.
Write your columns delimited by commas, and carriage returns for rows, and save it as a text file as normal. Then open excel, select the data menu, and select import external data, and select importa data. You will select text files, and the file you created and hit next, when it asks you what the delimiter type is, you select comma.

Voila, your excel file is complete.


Now if you're going to be reading from the excel files to do your triggers, it's a different story. You won't be able to read the second option's file, because excel created, however, the first option, if tab works, or you don't need columns, will not be changed by excel, and you'll be able to read it just as if you created it.

Glorida
Reply with quote
Glorida
Newbie


Joined: 10 Mar 2006
Posts: 7

PostPosted: Sat Jun 03, 2006 9:27 pm   
 
I did some quick research, and the first option is the best, because you can send a tab character using the %char(9) function.
Here's an example of an Excel file:
#file 1 test.xls
#write 1 this%char(9)is%char(9)a%char(9)test
#write 1 This will be in one box, next line
#write 1 Third line
#close 1

Then open this file, it'll show as an excel type file, and you're done.

Glorida
Reply with quote
Posideon
Beginner


Joined: 06 Feb 2005
Posts: 26

PostPosted: Thu Jun 08, 2006 4:16 am   
 
The thing is, I have a current Excel file and I need to put the numbers/variables into certain cells in order for all the math commands in excel to go off, so I think I have to use COM but I can't figure it out at all.
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Thu Jun 08, 2006 9:45 am   
 
For illustration, MYMUD.xls is used for the Excel file, Sheet1 will be the worksheet to put information in.

B12 will be assigned a value of '2'
B13 will be assigned a value of '16'
B14 will be assigned a function to multiply the above two cells
Finally, the Value of B14 will be returned to zMUD.

If Excel is open use
Code:
#VAR Excel %comactive("Excel.Application")

If Excel is closed use:
Code:
#VAR Excel %comcreate("Excel.Application")


Then
Quote:
#VAR Workbook @Excel.Workbooks("MYMUD.xls")
#VAR Worksheet @Workbook.Worksheets("Sheet1")
#VAR First_cell @Worksheet.Range("B12")
#VAR Second_cell @Worksheet.Range("B13")
#VAR Third_cell @Worksheet.Range("B14")
First_cell.Value = 2
Second_cell.Value = 16
Third_cell.Value = ~=B12*B13
#VAR Result @Third_cell.Value
#SHOW @Result


Tested with zMUD 7.21 and Excel 2002 (XP). For some reason, the first time I did this, @Result returned the formula rather than the result. I then tried

Quote:
Third_cell.Value2 = Range("B12").Value2 * Range("B13").Value2


But that didn't work, so I switched it back and finally the result was returned as expected. Hope this helps.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
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

© 2009 Zugg Software. Hosted by Wolfpaw.net