Ответы пользователя по тегу *nix-подобные системы
  • Как правильно сделать telnet сессию через Automator?

    iStyx
    @iStyx
    Вам нужен обычный AppleScript:

    set statusCommand to "show adsl"
    tell application "Terminal"
    	do script "telnet 192.168.1.1"
    	set wID to id of front window
    	delay 1
    	do script "admin" in front window
    	delay 1
    	do script "admin" in front window
    	delay 1
    	do script statusCommand in front window
    	delay 1
    	set startLine to 1
    	set answer to every paragraph of (contents of window id wID as text)
    	do script "exit" in front window
    	repeat with lineNumber from 2 to count of answer
    		tell item lineNumber of answer
    			if it contains statusCommand then
    				set startLine to lineNumber
    			end if
    			if it starts with "Connection closed" then
    				exit repeat
    			end if
    		end tell
    	end repeat
    	set status to items (startLine + 1) thru (lineNumber - 1) of answer
    end tell
    set od to AppleScript's text item delimiters
    set AppleScript's text item delimiters to ASCII character 13
    display dialog status as text buttons {"OK"}
    set AppleScript's text item delimiters to od
    
    Ответ написан
    Комментировать