( modified 20180517 for win10 4K )
copy telnet.exe to C:\windows\sytem32 ( if not exist )
https://technet.microsoft.com/pt-pt/lib ... s.10).aspx
http://telehack.com/telehack.html
http://en.wikipedia.org/wiki/Joseph_Weizenbaum
Eliza, Morse , Cow , Basic
Code: Select all
;modified=20180517 win10 4K
;------- Send to DOS telehack MORSE ELIZA BASIC etc ----
;=================================================
;- telnet.exe in folder C:\Windows\system32
;- https://technet.microsoft.com/pt-pt/library/cc787407(v=ws.10).aspx
;- http://telehack.com/telehack.html
;- telnet telehack.com
;- ELIZA /BASIC
;- help /all
SetKeyDelay,20,20
wa:=A_screenwidth
ha:=A_screenHeight
GW :=(wa*50)/100 ;- width
GH :=(ha*95)/100 ;- height
;- telnet is in C:\windows\sytem32
telnet1a=%a_windir%\system32\telnet.exe
;- or
;Telnet1=%A_ScriptDir%\..\..\Programs_SA\telnet\telnet.exe
;loop,%Telnet1% ;- create shortpath
; telnet1a= %A_loopFileShortPath%
DosCommand=%telnet1a% telehack.com
e4x=
(Ltrim Join&
mode con lines=4096 cols=180
color 0A
%doscommand%
)
Run, %COMSPEC% /k %e4x%,,,pid1 ;- start DOS and send commands
WinWait, ahk_pid %pid1% ;
WinWaitActive, ahk_pid %PID1% ;
WinMove,ahk_pid %PID1%,,1,1,%gw%,%gh% ;- DOS at left
sleep,500
gosub,telehack
return
;--------------------
;--------------------
telehack:
sleep,1000
controlsend,,cowsay /cow /joke Hello %a_username% (use ESC-button to quit or CTR+C to break)`r,ahk_pid %pid1%
sleep,4000
controlsend,,morse SOS Hello %a_username%`r,ahk_pid %pid1%
sleep,2000
controlsend,,ELIZA`r,ahk_pid %pid1%
sleep,4000
controlsend,,Hi my name is %a_username%`r,ahk_pid %pid1%
sleep,5000
controlsend,,My problem is I like autohotkey`r,ahk_pid %pid1%
sleep,5000
controlsend,,^c`r,ahk_pid %pid1%
sleep,2000
controlsend,,basic`r,ahk_pid %pid1%
sleep,2000
controlsend,,a=100:c=(a*3):print "Result=";c`r,ahk_pid %pid1%
sleep,2000
controlsend,,print"Use button ESC to quit"`r,ahk_pid %pid1%
return
;---------------------
esc::
controlsend,,q`r,ahk_pid %pid1%
sleep,1000
controlsend,,cowsay /cow /dead Good bye %a_username% now you quit Telnet & DOS`r,ahk_pid %pid1%
sleep,4000
controlsend,,quit`n,ahk_pid %pid1%
sleep,500
controlsend,,%a_space%exit`n,ahk_pid %pid1%
sleep,500
Process, Close, %pid1%
Process, WaitClose, %pid1%
process,close,telnet.exe
ExitApp
;========= END script ==================
Code: Select all
;- telnet telehack.com
;- read news example from 1985
;- help /all
;- towel.blinkenlights.nl only for starwars ascii-game
SetKeyDelay,20,20
wa:=A_screenwidth
ha:=A_screenHeight
GW :=(wa*50)/100 ;- width
GH :=(ha*95)/100 ;- height
;- telnet is in C:\windows\sytem32
telnet1a=%a_windir%\system32\telnet.exe
;- or
;Telnet1=%A_ScriptDir%\..\..\Programs_SA\telnet\telnet.exe
;loop,%Telnet1% ;- create shortpath
; telnet1a= %A_loopFileShortPath%
DosCommand=%telnet1a% telehack.com
e4x=
(Ltrim Join&
mode con lines=4096 cols=180
color 0A
%doscommand%
)
Run, %COMSPEC% /k %e4x%,,,pid1 ;- start DOS and send commands
WinWait, ahk_pid %pid1% ;
WinWaitActive, ahk_pid %PID1% ;
WinMove,ahk_pid %PID1%,,1,1,%gw%,%gh% ;- DOS at left
sleep,500
gosub,telehack
return
;--------------------
telehack:
sleep,1500
controlsend,,%a_space%cowsay /cow /joke Hello %a_username% (use ESC-button to quit or CTR+C to break)`r,ahk_pid %pid1%
sleep,4000
controlsend,,usenet`r,ahk_pid %pid1%
sleep,3000
controlsend,,r 2A3B8`r,ahk_pid %pid1%
return
;---------------------
esc::
controlsend,,q`r,ahk_pid %pid1%
sleep,500
controlsend,,cowsay /cow /dead Good bye %a_username% now you quit Telnet & DOS`r,ahk_pid %pid1%
sleep,4000
controlsend,,quit`r,ahk_pid %pid1%
sleep,500
controlsend,,%a_space%exit`r,ahk_pid %pid1%
sleep,500
Process, Close, %pid1%
Process, WaitClose, %pid1%
process,close,telnet.exe
ExitApp
;========= END script ==================
Code: Select all
MODIFIED=20091224
scriptname=Telnet_Email.ahk
; how to send an email with telnet.exe
; put telnet.exe in C:\WINDOWS\system32
;https://technet.microsoft.com/pt-pt/library/cc787407(v=ws.10).aspx
;
;
;===========================================
/*
check first follow =
-SMTP (my own mail.bluewin.ch in switzerland )
-POP (my own pop.bluewin.ch or
mail.bluewin.ch works also )
-Dos command (telnet mail.bluewin.ch 25 in this case)
-from
-to
*/
;====== modify these variables =============
smtp1=mail.bluewin.ch
pop1 =pop.bluewin.ch
name1=garry1234
ext1 =bluewin.ch
ccc=This is Testline1`nThis is TestLine2`n
;===========================================
SetBatchLines -1
AutoTrim Off
initext=%A_scriptdir%\telnet_ini.ini
ifnotexist,%initext%
{
transform,E,chr,64
fromemail=%name1%%E%%ext1%
toemail =%name1%%E%%ext1%
SMTP =%smtp1%
subject =Test01
Iniwrite,%fromemail% ,%initext% ,From ,KEY1
Iniwrite,%toemail% ,%initext% ,To ,KEY1
Iniwrite,%SMTP% ,%initext% ,SMTP ,KEY1
Iniwrite,%subject% ,%initext% ,subject,KEY1
}
;------------------------------------------------
IniRead, From , %initext% , From , Key1
IniRead, To , %initext% , To , Key1
IniRead, SMTP , %initext% , SMTP , Key1
IniRead, Subject , %initext% , Subject , Key1
;DosCommand=telnet %SMTP% 25
;------------------------------------------------
SetKeyDelay,10,10,
SendMode, Input
DetectHiddenWindows On
Gui,2:Font,,FixedSys
Gui,2:Add,Text, x5 y10 , FROM
Gui,2:Add,Edit, x90 y10 w150 h20 vVAR1 , %from%
Gui,2:Add,Text, x5 y35 , TO
Gui,2:Add,Edit, x90 y35 w150 h20 vVAR2 , %TO%
Gui,2:Add,Text, x5 y60 , SMTP
Gui,2:Add,Edit, x90 y60 w150 h20 vVAR3 , %SMTP%
Gui,2:Add,Text, x5 y85 , Subject
Gui,2:Add,Edit, x90 y85 w350 h20 vVAR4 , %subject%
Gui,2:Add,Button, x310 y10 w90 h25 gStart1 ,START
Gui,2:Add,Edit, x10 y140 w580 h150 vTEXT1,%ccc%
Gui,2:Add,Edit, x10 y330 w580 h220 vLines1 readonly,
Gui,2:Show, x0 y0 h560 w600 ,TELNET SendToDOS
GuiControl,2:Focus,VAR2
return
;-------------------------------------------------
Start1:
gui,2:submit,nohide
;--- set last settings ------------------
IniWrite, %VAR1% , %initext%, From , KEY1
IniWrite, %VAR2% , %initext%, To , KEY1
IniWrite, %VAR3% , %initext%, SMTP , KEY1
IniWrite, %VAR4% , %initext%, Subject , KEY1
;---------------------------------------------
/* for test
v=%A_ScriptDir%\..\..\Programs_SA\
setworkingdir,%v%
run,%comspec% /k cd ; see pathx where you are
exitapp
*/
;-- Telnet in C:\WINDOWS\system32 or otherwise :
;Telnet1=%A_ScriptDir%\..\..\Programs_SA\telnet.exe
;loop,%Telnet1% ;- create shortpath
; SP1= %A_loopFileShortPath%
F1=%A_now%_telnet.txt
DosCommand=telnet -f %F1% %var3% 25
;---------------------------------------------
TEXT1=%text1%`nXXXXX
GuiControl,2:Text,Lines1,
V1=helo %pop1%
V2=mail from:%var1%
V3=rcpt to:%var2%
V4=data
V5=subject:%var4%
V6=
V9=
V10=.
V11=quit
Run %ComSpec% /k %DosCommand%,,,PID1 ;open a DOS window
;Run %ComSpec% /k %DosCommand%,,hide,PID1 ;open a DOS window
WinWait %ComSpec% ahk_pid %PID1%
WinActivate ahk_pid %PID1%
sleep,3000
gosub,readF1
ControlSend,,%V1%{enter},ahk_pid %PID1%
gosub,readF1
ControlSend,,%V2%{enter},ahk_pid %PID1%
gosub,readF1
ControlSend,,%V3%{enter},ahk_pid %PID1%
gosub,readF1
ControlSend,,%V4%{enter},ahk_pid %PID1%
gosub,readF1
ControlSend,,%V5%{enter},ahk_pid %PID1%
gosub,readF1
ControlSend,,%V6%{enter},ahk_pid %PID1%
gosub,readF1
StringSplit, L, text1, `n
Loop,
{
A:= L%A_Index%
if A=XXXXX
break
ControlSend,,%A%{enter},ahk_pid %PID1%
sleep,500
}
;--------- close telnet ---------------
A3:
ControlSend,,%V9%{enter},ahk_pid %PID1%
gosub,readF1
ControlSend,,%V10%{enter},ahk_pid %PID1%
gosub,readF1
ControlSend,,%V11%{enter},ahk_pid %PID1%
gosub,readF1
;GuiControl,2:Text,Lines1,TELNET Finished
;run,%A_scriptdir%\%F1%
return
;-----------------------------------------
ReadF1:
sleep,1500
GuiControl,2:Text,Lines1,
Fileread,F1content,%F1%
GuiControl,2:Text,Lines1,%F1content%
return
2Guiclose:
process,close,%PID1%
exitapp
esc::
process,close,%PID1%
exitapp
;=================================================