Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jaxstate

macrumors 6502a
Original poster
Apr 13, 2006
542
0
Hello, I'm trying to write my first applescript, and i'm already at a loss. Can anyone give the syntax to do a simple telnet. I have a IP address that I want to telnet into, but keep getting a "expect a " not a ." error. Any help will be useful.
 

Eraserhead

macrumors G4
Nov 3, 2005
10,434
12,250
UK
Wouldn't it be better to use SSH as it's secure? I don't have my Mac at the moment but
Code:
do shell script "telnet username@ip-address"
should work.
 

jaxstate

macrumors 6502a
Original poster
Apr 13, 2006
542
0
Once I telnet into the router, I'm going to issue terminal commands for a code upgrade for the router.
Eraserhead said:
Wouldn't it be better to use SSH as it's secure? I don't have my Mac at the moment but
Code:
do shell script "telnet username@ip-address"
should work.
 

jaxstate

macrumors 6502a
Original poster
Apr 13, 2006
542
0
Figured it out. Now on to another can of worms!! I'm really lovin applescript so far.
 

jaxstate

macrumors 6502a
Original poster
Apr 13, 2006
542
0
This is the simple code i'm using to telnet into my IAD router.

set telnet to "telnet 10.7.6.17"
set username to "router1"
set password to "macrumors"
tell application "Terminal"
run
do script telnet
delay 1
do script username in window 1
delay 1
do script password in window 1
end tell

now I have to get to find out how to do "cntrl -t" to get to the terminal menus in this router.
 

jaxstate

macrumors 6502a
Original poster
Apr 13, 2006
542
0
OK i'm at a lost again. Do anyone know how to send "\x14" using applescript. Everytime I try sending it, Script Editor sends me a "Expected " but found unknow token" syntax error.
 

jaxstate

macrumors 6502a
Original poster
Apr 13, 2006
542
0
Thanks, that worked. Off to the next problem.
HexMonkey said:
Try "\\x14" instead. '\' is a special character so you need to escape it to use it normally.
Do anyone, i mean anyone know the command for "Ctrl t" for applescript.:(
 

wala

macrumors member
Jun 3, 2005
46
0
It's in the documentation for System Events:

Code:
tell application "System Events"
    tell application "Terminal" to activate
    keystroke "t" using control down
end tell

Or something like that...
If you're looking for a signal like "^T" then I don't think one exists, and ctrl-t seems to do nothing in Terminal, and Command-t brings up the font selector.

EDIT: Control-t transposes characters when editing fields.
 

jaxstate

macrumors 6502a
Original poster
Apr 13, 2006
542
0
Thanks, I'll give it a try.

F.Y.I, I did a google search for "Ctrl T in applescript" and this thread was the top hit!
 

jaxstate

macrumors 6502a
Original poster
Apr 13, 2006
542
0
for anyone who would like to know it's

set CL to ASCII character 20

where CL is just some variable
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.