Eedis
Joined: 12 Jun 2009 Posts: 389
|
Posted: Sun Oct 18, 2009 1:36 am Post subject: Need help with a simple macro. |
|
|
What I want it to do overall is to retrieve a sentence that someone has typed into an editbox, then translate it to another language, then display the results in another editbox. Right now, for testing purposes, I just have it send the results so that it will just send it to the text file so I can see if it's correct.
Unfortunately, the problem is that it only sends a, b, c, d, etc. It only goes through the alphabet and puts each letter in order according to how many words there are in the sentence you want to translate. Don't get me wrong, the letters are in the seperate language, but it's not what the user typed, it's just the alphabet.
There is a bunch of other stuff to this code that you won't need, so just ignore all that stuff. I'm working within the buttonLeet: right now, so if I get this button working, I can do it for all the other buttons.
| Code: | a:
gui, destroy
SetBatchLines -1 ; here for the complete script
setkeydelay 0 ; or -1 for the send speed
lower_type0 = {4},13,(,1),3,f,g,|-|,|,j,1<,1,/\/\,|\|,0,p,q,12,5,7,u,\/,\/\/,x,y,2 ; ,...
lower_type1 = {a},bong,cong,dong,e,fong,gong,hong,i,jong,kong,long,mong,nong,o,pong,qong,rong,song,tong,u,vong,wong,xong,yong,zong ; ,...
lower_type2 = .-,-...,-.-.,-..,.,..-.,--.,....,..,.---,-.-,.-..,--,-.,---,.--.,--.-,.-.,...,-,..-,...-,.--,-..-,-.--,--.. ; ,...
lower_type3 = 01100001,01100010,01100011,01100100,01100101,01100110,01100111,01101000,01101001,01101010,01101011,01101100,01101101,01101110,01101111,01110000,01110001,01110010,01110011,01110100,01110101,01110110,01110111,01111000,01111001,01111010 ; ,...
lower_type4 = a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
upper_type0 = {4},13,(,1),3,f,g,|-|,|,j,1<,1,/\/\,|\|,0,p,q,12,5,7,u,\/,\/\/,x,y,2 ; ,...
upper_type1 = {A},Bong,Cong,Dong,E,Fong,Gong,Hong,I,Jong,Kong,Long,Mong,Nong,O,Pong,Qong,Rong,Song,Tong,U,Vong,Wong,Xong,Yong,Zong ; ,...
upper_type2 = .-,-...,-.-.,-..,.,..-.,--.,....,..,.---,-.-,.-..,--,-.,---,.--.,--.-,.-.,...,-,..-,...-,.--,-..-,-.--,--.. ; ,...
upper_type3 = 01000001,01000010,01000011,01000100,01000101,01000110,01000111,01001000,01001001,01001010,01001011,01001100,01001101,01001110,01001111,01010000,01010001,01010010,01010011,01010100,01010101,01010110,01010111,01011000,01011001,01011010 ; ,...
upper_type4 = A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z
stringsplit, lower_t0_, lower_type0, `,
stringsplit, lower_t1_, lower_type1, `,
stringsplit, lower_t2_, lower_type2, `,
stringsplit, lower_t3_, lower_type3, `,
stringsplit, lower_t4_, lower_type4, `,
stringsplit, upper_t0_, upper_type0, `,
stringsplit, upper_t1_, upper_type1, `,
stringsplit, upper_t2_, upper_type2, `,
stringsplit, upper_t3_, upper_type3, `,
stringsplit, upper_t4_, upper_type4, `,
var1 = 4
Gui, Color, FF8040
Gui, Font, S8 CGreen, Papyrus
Gui, Add, Text, x6 y90 w370 h90 , Welcome to TransxXx that was created by Eedis. Please select your translation language`, press = to temporarily turn the program off to go back to regular typing`, and also use - to return to the previous screen to select a new language. Also, to translate the code back to English, use the edit fields to the right. Thank you`, and please enjoy. :) :)
Gui, Font, S12 CGreen Bold, Quick Type II
Gui, Add, Text, x6 y180 w370 h30 , ___________________________________________________-
Gui, Add, Text, x6 y220 w100 h30 , Leet
Gui, Add, Text, x6 y270 w100 h30 , Ong
Gui, Add, Text, x6 y320 w110 h30 , Morse Code
Gui, Add, Text, x6 y370 w100 h30 , Binary
Gui, Add, Button, x256 y220 w120 h30 , 1337
Gui, Add, Button, x256 y270 w120 h30 , Ononggong
Gui, Add, Button, x256 y320 w120 h30 , .-..---.-..--..
Gui, Add, Button, x256 y370 w120 h30 , 01100101
Gui, Add, Text, x106 y270 w150 h30 , ----------------------------------------------------
Gui, Add, Text, x116 y320 w140 h30 , ----------------------------------------------------
Gui, Add, Text, x106 y370 w150 h30 , ----------------------------------------------------
Gui, Add, Button, x146 y410 w100 h30 , Exit
Gui, Font, S8 CGreen, Verdana
Gui, Add, Text, x106 y230 w150 h30 , ----------------------------------------------------
Gui, Font, S12 CGreen Bold, Quick Type II
Gui, Add, Edit, x385 y19 w310 h150 vCodeHere, Type the code here...
Gui, Add, Button, x386 y180 w50 h50 , Leet
Gui, Add, Button, x446 y180 w70 h50 , Ong
Gui, Add, Button, x526 y180 w70 h50 , Morse Code
Gui, Add, Button, x606 y180 w80 h50 , Binary
Gui, Add, Edit, x386 y240 w310 h190 vResults, Your results are displayed here...
Gui, Font, S42 CGreen Bold Strike, curlz mt
Gui, Add, Text, x46 y190 w200 h-120 , __________________________________________
Gui, Add, Text, x6 y30 w370 h60 +Center, _________________________________________________
Gui, Add, Text, x26 y10 w330 h70 +Center, Trans-XxX
Gui, Show, x446 y109 w710 h448, Trans-xXx
Return
buttonexit:
exitapp
button1337:
{
var1 = 0
gui, hide
}
return
buttonononggong:
{
var1 = 1
gui, hide
}
return
button.-..---.-..--..:
{
var1 = 2
gui, hide
}
return
button01100101:
{
var1 = 3
gui, hide
}
return
buttonLeet:
{
gui, submit
stringsplit, result_, codehere, ` %A_Space%
msgbox, %codehere%
StringReplace, string, codehere, %A_Space%, %A_Space%, UseErrorLevel
var := ErrorLevel+1
Loop, %var%
{
result_%a_index% := lower_t0_%a_index%
send, % result_%a_index%
}
;guicontrol,, Result,
}
Return
ButtonOng:
{
var1 = 6
gui, submit
}
Return
ButtonMorseCode:
{
var1 = 7
gui, submit
}
Return
ButtonBinary:
{
var1 = 8
gui, submit
}
Return
; lower case
$a::
$b::
$c::
$d::
$e::
$f::
$g::
$h::
$i::
$j::
$k::
$l::
$m::
$n::
$o::
$p::
$q::
$r::
$s::
$t::
$u::
$v::
$w::
$x::
$y::
$z::
thiskey := asc(substr(a_thishotkey, 2, 1)) - 96
if var1 = 0
send % lower_t0_%thiskey%
if var1 = 1
send % lower_t1_%thiskey%
if var1 = 2
send % lower_t2_%thiskey%
if var1 = 3
send % lower_t3_%thiskey%
if var1 = 4
send % lower_t4_%thiskey%
return
; upper case
$+a::
$+b::
$+c::
$+d::
$+e::
$+f::
$+g::
$+h::
$+i::
$+j::
$+k::
$+l::
$+m::
$+n::
$+o::
$+p::
$+q::
$+r::
$+s::
$+t::
$+u::
$+v::
$+w::
$+x::
$+y::
$+z::
thiskey := asc(substr(a_thishotkey, 3, 1)) - 96
if var1 = 0
send % upper_t0_%thiskey%
if var1 = 1
send % upper_t1_%thiskey%
if var1 = 2
send % upper_t2_%thiskey%
if var1 = 3
send % upper_t3_%thiskey%
if var1 = 4
send % upper_t4_%thiskey%
return
$space::
if var1 = 0
send {space}
if var1 = 1
send {space}
if var1 = 2
send /
if var1 = 3
send 01000000
if var1 = 4
send {space}
return
$=::suspend
$-:: ; - awakes the script even from suspend
suspend
suspend off
goto a
return |
_________________ Pylons Are Trapped Balls.
http://www.autohotkey.net/~Eedis/
 |
|