TinTin++ Mud Client The TinTin++ message board

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
TinTin++ Mud Client

#system and character ^M

 
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help
View previous topic :: View next topic  
Author Message
Meh



Joined: 07 Apr 2012
Posts: 3

PostPosted: Sat Apr 07, 2012 2:45 pm    Post subject: #system and character ^M Reply with quote

Hi,

I've been trying to use #system to send shell commands to different screens. Here is an example where I'm sending the string stuff to the screen testScreen:

Code:
#system {screen -S testScreen -X stuff "ls^M"}


This line is written in a class alias I read from a file. I had to edit that file using VIM which allows me to enter the ^M character by pressing ctrl-v and then ctrl-m. I cannot enter the ^M character that way in tt++.

The problem I'm having is that when I read the file the character ^M for carriage return is ignored. That way, it will just paste "ls" into the screen terminal when I use my alias. I want it to paste "ls" into the screen terminal and then add the carriage return to execute the command.

Does anyone have an idea on how I could solve this?
Back to top
View user's profile Send private message
Meh



Joined: 07 Apr 2012
Posts: 3

PostPosted: Sat Apr 07, 2012 3:41 pm    Post subject: Reply with quote

I fixed this by creating a bash function in my .bash_profile file:
Code:
function testScreen() {
    screen -S testScreen -X stuff "$@^M"
}


Then, in my tt++ script I have an alias that goes like this:
Code:
ALIAS {ts} {
    #VAR {ts}{%0};
    #SYSTEM {testScreen $ts};
}


If anyone has a better way to fix this without using the bash function, I would appreciate!
Back to top
View user's profile Send private message
Scandum
Site Admin


Joined: 03 Dec 2004
Posts: 3770

PostPosted: Sat Apr 07, 2012 10:53 pm    Post subject: Reply with quote

You could try:
Code:

#line substitute escapes #system {screen -S testScreen -X stuff "ls\n"}

or

#line substitute escapes #system {screen -S testScreen -X stuff "ls\r"}
Back to top
View user's profile Send private message Send e-mail
Meh



Joined: 07 Apr 2012
Posts: 3

PostPosted: Sun Apr 08, 2012 2:18 pm    Post subject: Reply with quote

Exactly what I was looking for.

Thanks!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The TinTin++ message board Forum Index -> Script Help All times are GMT - 5 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
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
TinTin++ Homepage

Powered by phpBB © 2001, 2002 phpBB Group