What is exactly "link macro" ?
Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: What is exactly "link macro" ?
PostPosted: Tue Dec 26, 2006 3:43 pm 
Offline
Newbie

Joined: Tue Dec 26, 2006 3:09 pm
Posts: 5
Hello. I write a macro to connect to a remote equipment. When I run it from LogmeTT, It runs OK. But when I have tried to execute it from ttpmacro, I got a message error "Link Macro First". When I press Continue Button, macro executes Ok.

How can I prevent (or Skip) that error? I need to execute macro from VBasic, to periodically connect to a remote server, so I need to do it automatically, ignoring this error message, but better trying to correct it.

Best regards.

_________________
Leonardo Q.
Bogotá, Colombia


Top
 Profile  
 
 Post subject:
PostPosted: Tue Dec 26, 2006 3:53 pm 
Offline
Moderator, LogMeTT developer
User avatar

Joined: Sat Jan 08, 2005 7:52 am
Posts: 1143
Location: Seattle, WA, USA
Hi Leonardo,

Link macro first error means that your macro is missing command connect. Command connect should appear prior any other commands communicating with your remote host. Check this topic for more information about command connect.

_________________
Thanks.
Best regards,
// Boris


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Wed Dec 27, 2006 3:06 pm 
Offline
Newbie

Joined: Tue Dec 26, 2006 3:09 pm
Posts: 5
:o Thank you, the problem is fixed, the solution is exactly as you explained.

_________________
Leonardo Q.
Bogotá, Colombia


Top
 Profile  
 
 Post subject: Link Macro First
PostPosted: Wed Jan 03, 2007 3:08 am 
Offline
Newbie

Joined: Tue Jan 02, 2007 5:48 am
Posts: 1
Location: Czech republic
Hello,

I wrote this simple ttl code for connection to the server, but when I want to execute it - appeared "Link Macro First"
Can you check it, please :?:

;passwd: adm
getpassword 'passwd.dat' 'adm' adm
;passwd: server_root
getpassword 'passwd.dat' 'server_root' server_root
settitle 'server_root'
connect 'xxx.xxx.xxx.xxx'
PasswordPrompt = "Password:"
PasswordPrompt2 = "login:"
wait PasswordPrompt2
sendln 'adm'
wait PasswordPrompt
sendln adm
sendln 'su -'
wait PasswordPrompt
sendln sever_root


thanks for help.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 03, 2007 9:31 am 
Offline
Moderator, LogMeTT developer
User avatar

Joined: Sat Jan 08, 2005 7:52 am
Posts: 1143
Location: Seattle, WA, USA
Hi,

There can be 2 reasons why your macro is not able to connect, assuming that remote host is reachable and listens on port 23.
- connect string does not work
- login information is not correct.

You are using the shortest syntax of connect string trying to establish telnet connection. Depending on connection configuration in teraterm.ini file it might not work in some cases. For example if the last connection saved in teraterm.ini was either SSH or via COM port the connect command with such syntax will fail. I would recommend to use the following line instead:
connect 'xxx.xxx.xxx.xxx:23 /nossh'
This format will force TeraTerm to use telnet connection through port 23.

Now about login information. Your macro sends 'adm' as user name and the password from passwd.dat file. Make sure the password you stored in passwd.dat file is correct. You can temporarily add line
delpassword 'passwd.dat' 'adm'
at the top of your script to erase saved password and re-enter it.


Few more comments:

You are introducing PasswordPrompt and PasswordPrompt2 variables. Try to name your variables the way that they won't confuse you when you look into your code few months later. I'd rename PasswordPrompt2 into LoginPrompt. As for the strings assigned to these 2 variables, the better practice is to drop the first letter in words Password and login while using them as parameters of wait command. This will make your script independent of whether the first letter in these prompts sent to you by remote host is in upper or lower case.

I would also add another wait command before
sendln 'su -'
and
setsync 1
right after connect

_________________
Thanks.
Best regards,
// Boris


Top
 Profile E-mail  
 
 Post subject:
PostPosted: Wed Jan 03, 2007 1:54 pm 
Offline
Guru

Joined: Wed Jan 25, 2006 7:28 pm
Posts: 532
Location: Denver, Colorado, USA
Always check for error conditions as well. For example, right after connect you should have something like this:


connect 'xxx.xxx.xxx.xxx:23 /nossh'
if result<>2 then
   messagebox 'Could not connect to host' 'ERROR'
   closett
   end
endif


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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 post attachments in this forum

Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group