Trying to output to a text file, and have it read it to me.

Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!

Moderator: MacroQuest Developers

Zazoot
a hill giant
a hill giant
Posts: 163
Joined: Sat Feb 07, 2004 11:02 am

Trying to output to a text file, and have it read it to me.

Post by Zazoot » Wed Feb 25, 2004 6:16 pm

Ok I have a little problem with something i am trying

basically i want this program
to save the tell to a text file that i specify, overwriting whatever is in it
then run the batch file

seems i can get it to run the batch file np
and theoretically if i was to type "echo whatever amount of stuff > d:\readit.txt" in the command line, that would work, but MQ is not liking my syntax using the /exec command, i tried passing parameters to batch file, that only took the first word though, i gotta run, just pasting this for now maybe someone can help. when i get it working ill add a link to the program i used for converting to wav

the bolded line is the line in question.

Code: Select all

#chat tell 

#turbo 50

Sub Main 
:Mainloop 
   /delay 1s
   /doevents 
   /goto :mainloop 


Sub Event_Chat(ChatType,Sender,ChatText) 
   /if "@ChatText"~~"wakeup" { 
[b]   /exec echo @ChatText > d:\readit.txt [/b]
   /exec d:\t2s
} 

/return

with this batch file :
that calls the text2wave program then opens the newly created wave file (this part works)

Code: Select all

d:\TextSound\TSC.exe d:\readit.txt d:\readit.wav mary
d:\readit.wav

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Wed Feb 25, 2004 6:45 pm

Looks like you need to put quotes around it. Don't know how the exec plugin works but you probably want the quotes around the entire command like this:
/exec "echo @chattext > dfjksf"

If that doesn't work try putting the quotes around @chattext.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Wed Feb 25, 2004 7:03 pm

Doing /exec is like typing in the Run box, not at a command prompt.

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Wed Feb 25, 2004 7:22 pm

Oh yeah, forgot about that.. Guess you'd have to exec cmd.exe or command.exe depending on if you use nt/2k/xp or one of the others (hint, use /c)..

/exec "cmd /c echo @chattext > file.txt"

Zazoot
a hill giant
a hill giant
Posts: 163
Joined: Sat Feb 07, 2004 11:02 am

Post by Zazoot » Wed Feb 25, 2004 11:05 pm

seems like big problem here is that its not letting me run a statement from the command line

it only lets me run specific commands???

i found i had to put fg on the end to make it run in foreground, making it bg (background?) didnt work, and i guess it doesnt want command with arguments?? :(

t2s.mac :

Code: Select all

#chat tell 

#turbo 50

Sub Main 
:Mainloop 
   /delay 1s
   /doevents 
   /goto :mainloop 


Sub Event_Chat(ChatType,Sender,ChatText) 
   /if "@ChatText"~~"wakeup" { 
   /exec "cmd /c d:\readit.bat @ChatText" fg
   /delay 1s
   /exec "d:\t2s.bat" fg
} 

/return
readit.bat :

Code: Select all

echo %* > d:\readit.txt
this works fine it self from the commandline but mq2 isnt running the
readit.bat @ChatText

it runs the t2s.bat tho

ive tried with and withotu the cmd.. hmmm

ill test more

Zazoot
a hill giant
a hill giant
Posts: 163
Joined: Sat Feb 07, 2004 11:02 am

Post by Zazoot » Wed Feb 25, 2004 11:30 pm

ok

ts2.mac like this

doesnt run the first /exec command

Code: Select all

#chat tell 

#turbo 50

Sub Main 
:Mainloop 
   /delay 1s
   /doevents 
   /goto :mainloop 


Sub Event_Chat(ChatType,Sender,ChatText) 
   /if "@ChatText"~~"wakeup" { 
   /exec "d:\readit.bat @ChatText" fg
   /delay 1s
   /exec "d:\t2s.bat" fg
} 

/return

if i take out the @ChatText
it works, but with no command line argument so it just plops "ECHO is on." in the text file, which is pretty useless.

is there some way of passing that variable into the command line argument??????? i really want to be able to do this hah. ill dig around and see what i can come up with. im rather new to all this , if and hwen i do get this working, ill post a working model, with contents of all files, and a link to download the text2speech command line engine

Code: Select all

#chat tell 

#turbo 50

Sub Main 
:Mainloop 
   /delay 1s
   /doevents 
   /goto :mainloop 


Sub Event_Chat(ChatType,Sender,ChatText) 
   /if "@ChatText"~~"wakeup" { 
[b]   /exec "d:\readit.bat" fg[/b]
   /delay 1s
   /exec "d:\t2s.bat" fg
} 

/return

Zazoot
a hill giant
a hill giant
Posts: 163
Joined: Sat Feb 07, 2004 11:02 am

Post by Zazoot » Sat Feb 28, 2004 3:30 pm

haha ok
what i did was use the /mqlog @ChatText

and i changed the code in mqcommands.cpp so that it doesnt make the logs with a time stamp, much easier than trying to figure out grep to strip the time stamps out (im retarded)

that works
its slow and the text to speech engine i use sucks, but it works ! haha

when i get home from work ill check what program im using for that and post all the stuff i did, its really simple.