Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jul 6, 2006, 08:13 AM   #1
jaxstate
Banned
 
Join Date: Apr 2006
AppleScript telnet command

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.
jaxstate is offline   0 Reply With Quote
Old Jul 6, 2006, 08:31 AM   #2
Eraserhead
macrumors G4
 
Eraserhead's Avatar
 
Join Date: Nov 2005
Location: 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.
__________________
If they have to tell you every day they are fair you can bet they arent, if they tell you they are balanced then you should know they are not - Don't Hurt me
Eraserhead is offline   0 Reply With Quote
Old Jul 6, 2006, 08:52 AM   #3
jaxstate
Thread Starter
Banned
 
Join Date: Apr 2006
Once I telnet into the router, I'm going to issue terminal commands for a code upgrade for the router.
Quote:
Originally Posted by Eraserhead
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 is offline   0 Reply With Quote
Old Jul 6, 2006, 10:44 AM   #4
jaxstate
Thread Starter
Banned
 
Join Date: Apr 2006
Figured it out. Now on to another can of worms!! I'm really lovin applescript so far.
jaxstate is offline   0 Reply With Quote
Old Jul 6, 2006, 10:46 AM   #5
yellow
Moderator
 
yellow's Avatar
 
Join Date: Oct 2003
Location: Portland, OR
Quote:
Originally Posted by jaxstate
Figured it out.
Can you please detail the "fix" in case other people have the same question and come across this thread?
yellow is offline   0 Reply With Quote
Old Jul 6, 2006, 11:59 AM   #6
jaxstate
Thread Starter
Banned
 
Join Date: Apr 2006
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.

Last edited by jaxstate; Jul 6, 2006 at 12:14 PM.
jaxstate is offline   0 Reply With Quote
Old Jul 6, 2006, 03:24 PM   #7
jaxstate
Thread Starter
Banned
 
Join Date: Apr 2006
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 is offline   0 Reply With Quote
Old Jul 6, 2006, 04:43 PM   #8
HexMonkey
Administrator
 
HexMonkey's Avatar
 
Join Date: Feb 2004
Location: New Zealand
Try "\\x14" instead. '\' is a special character so you need to escape it to use it normally.
HexMonkey is offline   0 Reply With Quote
Old Jul 6, 2006, 04:49 PM   #9
jaxstate
Thread Starter
Banned
 
Join Date: Apr 2006
Thanks, that worked. Off to the next problem.
Quote:
Originally Posted by HexMonkey
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.

Last edited by jaxstate; Jul 6, 2006 at 09:02 PM.
jaxstate is offline   0 Reply With Quote
Old Jul 6, 2006, 10:03 PM   #10
wala
macrumors member
 
Join Date: Jun 2005
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.

Last edited by wala; Jul 10, 2006 at 02:04 PM.
wala is offline   0 Reply With Quote
Old Jul 14, 2006, 03:58 PM   #11
jaxstate
Thread Starter
Banned
 
Join Date: Apr 2006
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 is offline   0 Reply With Quote
Old Jul 14, 2006, 04:36 PM   #12
jaxstate
Thread Starter
Banned
 
Join Date: Apr 2006
for anyone who would like to know it's

set CL to ASCII character 20

where CL is just some variable
jaxstate is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Applescript, shell commands, pauses! BileGhost Mac Programming 17 Oct 28, 2013 03:23 PM
Sending Email Using Telnet - STARTTLS first rebello95 Mac Programming 5 Nov 7, 2011 05:52 PM
AppleScript Terminal Commands michaelzz Mac Programming 4 Jun 27, 2011 07:18 PM
(applescript) is there a "vardump" command? vrillusions Mac Programming 1 Jan 26, 2011 04:48 PM
applescript network command yippy Mac Applications and Mac App Store 1 May 9, 2004 06:35 PM


All times are GMT -5. The time now is 06:08 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC