Jump to content

[Resolved]Help me completing this script


Recommended Posts

Hello, i'm making this tool to convert "English" letters To "Arabic" letters

but i have some problems in reading "input1"

Notice: it isn't translator!!

here's the script:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>

$Form1 = GUICreate("Form1", 257, 155, 339, 282)
$Input1 = GUICtrlCreateInput("", 32, 32, 201, 21)
$Input2 = GUICtrlCreateInput("", 32, 88, 201, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_RIGHT))
$Label1 = GUICtrlCreateLabel("English", 104, 8, 38, 17)
$Button1 = GUICtrlCreateButton("Ta7weel", 96, 120, 75, 25)
$Label2 = GUICtrlCreateLabel("Franco", 104, 64, 37, 17)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Button1
Local $Read1 = GUICtrlRead($Input1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If StringInStr($Read1, "3") Then
_GUICtrlEdit_AppendText($Input2, "ع")
EndIf
If StringInStr($Read1, "3'") Then
_GUICtrlEdit_AppendText($Input2, "غ")
EndIf
If StringInStr($Read1, "5") Then
_GUICtrlEdit_AppendText($Input2, "خ")
EndIf
If StringInStr($Read1, "7") Then
_GUICtrlEdit_AppendText($Input2, "ح")
EndIf
If StringInStr($Read1, "9") Then
_GUICtrlEdit_AppendText($Input2, "ص")
EndIf
If StringInStr($Read1, "a") Then
_GUICtrlEdit_AppendText($Input2, "ا")
EndIf
If StringInStr($Read1, "b") Then
_GUICtrlEdit_AppendText($Input2, "ب")
EndIf
If StringInStr($Read1, "c") Then
_GUICtrlEdit_AppendText($Input2, "س")
EndIf
If StringInStr($Read1, "d") Then
_GUICtrlEdit_AppendText($Input2, "د")
EndIf
If StringInStr($Read1, "e") Then
_GUICtrlEdit_AppendText($Input2, "ي")
EndIf
If StringInStr($Read1, "f") Then
_GUICtrlEdit_AppendText($Input2, "ف")
EndIf
If StringInStr($Read1, "g") Then
_GUICtrlEdit_AppendText($Input2, "ج")
EndIf
If StringInStr($Read1, "h") Then
_GUICtrlEdit_AppendText($Input2, "ه")
EndIf
If StringInStr($Read1, "i") Then
_GUICtrlEdit_AppendText($Input2, "ي")
EndIf
If StringInStr($Read1, "j") Then
_GUICtrlEdit_AppendText($Input2, "ج")
EndIf
If StringInStr($Read1, "k") Then
_GUICtrlEdit_AppendText($Input2, "ك")
EndIf
If StringInStr($Read1, "l") Then
_GUICtrlEdit_AppendText($Input2, "ل")
EndIf
If StringInStr($Read1, "m") Then
_GUICtrlEdit_AppendText($Input2, "م")
EndIf
If StringInStr($Read1, "n") Then
_GUICtrlEdit_AppendText($Input2, "ن")
EndIf
If StringInStr($Read1, "o") Then
_GUICtrlEdit_AppendText($Input2, "و")
EndIf
If StringInStr($Read1, "p") Then
_GUICtrlEdit_AppendText($Input2, "ب")
EndIf
If StringInStr($Read1, "q") Then
_GUICtrlEdit_AppendText($Input2, "ق")
EndIf
If StringInStr($Read1, "r") Then
_GUICtrlEdit_AppendText($Input2, "ر")
EndIf
If StringInStr($Read1, "s") Then
_GUICtrlEdit_AppendText($Input2, "س")
EndIf
If StringInStr($Read1, "t") Then
_GUICtrlEdit_AppendText($Input2, "ت")
EndIf
If StringInStr($Read1, "u") Then
_GUICtrlEdit_AppendText($Input2, "و")
EndIf
If StringInStr($Read1, "v") Then
_GUICtrlEdit_AppendText($Input2, "ف")
EndIf
If StringInStr($Read1, "w") Then
_GUICtrlEdit_AppendText($Input2, "و")
EndIf
If StringInStr($Read1, "x") Then
_GUICtrlEdit_AppendText($Input2, "ق")
EndIf
If StringInStr($Read1, "y") Then
_GUICtrlEdit_AppendText($Input2, "ي")
EndIf
If StringInStr($Read1, "z") Then
_GUICtrlEdit_AppendText($Input2, "ز")
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EndSwitch
WEnd

the script working well. but the problem is arranging the output letters

e.g.

i want convert this word "fas"... it must be "فاس" but it converted to "افس".

problem reason: autoit has read "A" letter before "F" & "S" so output will be arranged as reading.

what i need: convert and arragne "Arabic" letters wherever it is as "English" letters. !!

e.g.

A= 1

B= 2

C= 3

D=4

Text what will be converted: "CBDA" so it must be convert like that "3241" but in the script above it converting like that "123".

sorry for bad english :)

and thanks for help ;)

Resolved:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
Local $Form1 = GUICreate("Form1", 257, 155, 339, 282)
Local $Input1 = GUICtrlCreateInput("", 32, 32, 201, 21)
Local $Input2 = GUICtrlCreateInput("", 32, 88, 201, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_RIGHT))
Local $Label1 = GUICtrlCreateLabel("English", 104, 8, 38, 17)
Local $Button1 = GUICtrlCreateButton("Ta7weel", 96, 120, 75, 25)
Local $Label2 = GUICtrlCreateLabel("Franco", 104, 64, 37, 17)
GUISetState(@SW_SHOW)
Local $Read1, $Read2
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button1
   $Read1 = StringSplit(GUICtrlRead($Input1), '', 2)
   $Read2 = ''
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   For $char In $Read1
    Switch $char
     Case 'a'
      $Read2 &= '1'
     Case 'b'
      $Read2 &= '2'
     Case 'c'
      $Read2 &= '3'
     Case 'd'
      $Read2 &= '4'
     Case 'e'
      $Read2 &= '5'
     ; insert as many Case statements as possible input characters
     Case Else
      $Read2 &= '?'
    EndSwitch
   Next
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   GUICtrlSetData($Input2, $Read2)  ; write new data all at once
EndSwitch
WEnd

Edit: resolved Edited by Command3r

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

The actual issue is with the sequence of If... Append that _you_ coded.

To make simple code work the way you want, you can first use StringSplit to obtain an array of successive english characters, then loop on this array and convert each character in turn into their arabic counterpart. That would work as you intend it to work.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

i can't do it but i'll try

ُ

Edit: i dont know more about array and StringSplit

may you write simple script explaining?

Edited by Command3r

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

this isn't working

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>

$Form1 = GUICreate("Form1", 257, 155, 339, 282)
$Input1 = GUICtrlCreateInput("", 32, 32, 201, 21)
$Input2 = GUICtrlCreateInput("", 32, 88, 201, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_RIGHT))
$Label1 = GUICtrlCreateLabel("English", 104, 8, 38, 17)
$Button1 = GUICtrlCreateButton("Ta7weel", 96, 120, 75, 25)
$Label2 = GUICtrlCreateLabel("Franco", 104, 64, 37, 17)
GUISetState(@SW_SHOW)

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

Case $Button1
Local $Read1 = GUICtrlRead($Input1)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If StringSplit($Read1, "a") Then
_GUICtrlEdit_AppendText($Input2, "1")
EndIf
If StringSplit($Read1, "b") Then
_GUICtrlEdit_AppendText($Input2, "2")
EndIf
If StringSplit($Read1, "c") Then
_GUICtrlEdit_AppendText($Input2, "3")
EndIf
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
EndSwitch
WEnd

Edit: Editing script

Edited by Command3r

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

Try this:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
Local $Form1 = GUICreate("Form1", 257, 155, 339, 282)
Local $Input1 = GUICtrlCreateInput("", 32, 32, 201, 21)
Local $Input2 = GUICtrlCreateInput("", 32, 88, 201, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_RIGHT))
Local $Label1 = GUICtrlCreateLabel("English", 104, 8, 38, 17)
Local $Button1 = GUICtrlCreateButton("Ta7weel", 96, 120, 75, 25)
Local $Label2 = GUICtrlCreateLabel("Franco", 104, 64, 37, 17)
GUISetState(@SW_SHOW)
Local $Read1, $Read2
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button1
   $Read1 = StringSplit(GUICtrlRead($Input1), '', 2)
   $Read2 = ''
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   For $char In $Read1
    Switch $char
     Case 'a'
      $Read2 &= '1'
     Case 'b'
      $Read2 &= '2'
     Case 'c'
      $Read2 &= '3'
     Case 'd'
      $Read2 &= '4'
     Case 'e'
      $Read2 &= '5'
     ; insert as many Case statements as possible input characters
     Case Else
      $Read2 &= '?'
    EndSwitch
   Next
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   GUICtrlSetData($Input2, $Read2)  ; write new data all at once
EndSwitch
WEnd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

jchd,

Nice. I had something like this in mind...

#include <ButtonConstants.au3>
#include <array.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

;translation table $a_xlate)
;
;           col0          col1
;        (english    (something =
;         letter)     to english letter)
;   row0    a              a-x
;   row1    b              b-x
;   row2    c              c-x
;   row3    d              d-x
;   row4    e              e-x
;   row5    f              f-x
;
;   ... and so on for all symbols (letters) to be transposed (translated)
;

Local $a_xlate[31][2]

$a_xlate[00][0] = 'a'
$a_xlate[00][1] = 'a-x'
$a_xlate[01][0] = 'b'
$a_xlate[01][1] = 'b-x'
$a_xlate[02][0] = 'c'
$a_xlate[02][1] = 'c-x'
$a_xlate[03][0] = 'd'
$a_xlate[03][1] = 'd-x'
$a_xlate[04][0] = 'e'
$a_xlate[04][1] = 'e-x'
$a_xlate[05][0] = 'f'
$a_xlate[05][1] = 'f-x'
$a_xlate[06][0] = 'g'
$a_xlate[06][1] = 'g-x'
$a_xlate[07][0] = 'h'
$a_xlate[07][1] = 'h-x'
$a_xlate[08][0] = 'i'
$a_xlate[08][1] = 'i-x'
$a_xlate[09][0] = 'j'
$a_xlate[09][1] = 'j-x'
$a_xlate[10][0] = 'k'
$a_xlate[10][1] = 'k-x'
$a_xlate[11][0] = 'l'
$a_xlate[11][1] = 'l-x'
$a_xlate[12][0] = 'm'
$a_xlate[12][1] = 'm-x'
$a_xlate[13][0] = 'n'
$a_xlate[13][1] = 'n-x'
$a_xlate[14][0] = 'o'
$a_xlate[14][1] = 'o-x'
$a_xlate[15][0] = 'p'
$a_xlate[15][1] = 'p-x'
$a_xlate[16][0] = 'q'
$a_xlate[16][1] = 'q-x'
$a_xlate[17][0] = 'r'
$a_xlate[17][1] = 'r-x'
$a_xlate[18][0] = 's'
$a_xlate[18][1] = 's-x'
$a_xlate[19][0] = 't'
$a_xlate[19][1] = 't-x'
$a_xlate[20][0] = 'u'
$a_xlate[20][1] = 'u-x'
$a_xlate[21][0] = 'v'
$a_xlate[21][1] = 'v-x'
$a_xlate[22][0] = 'w'
$a_xlate[22][1] = 'w-x'
$a_xlate[23][0] = 'x'
$a_xlate[23][1] = 'x-x'
$a_xlate[24][0] = 'y'
$a_xlate[24][1] = 'y-x'
$a_xlate[25][0] = 'z'
$a_xlate[25][1] = 'z-x'
$a_xlate[26][0] = '1'
$a_xlate[26][1] = '1-x'
$a_xlate[27][0] = '2'
$a_xlate[27][1] = '2-x'
$a_xlate[28][0] = '3'
$a_xlate[28][1] = '3-x'
$a_xlate[29][0] = '4'
$a_xlate[29][1] = '4-x'
$a_xlate[30][0] = '5'
$a_xlate[30][1] = '5-x'

; el guio

Local  $gui010  = GUICreate('Translation Example',500,400)
                  GUICtrlCreatelabel('Enter Letter/Word to Translate',100,80,300,40)
global $inp010  = GUICtrlCreateInput('',100,100,300,20)
                  GUICtrlCreatelabel('Translation',100,130,300,40)
global $out010  = GUICtrlCreateLabel('',100,150,300,20,$ss_sunken)
Local  $btn010  = GUICtrlCreatebutton('Translate',100,300,300,30)
                  GUISetState()
Local $msg

Do

    $msg = GUIGetMsg()
    select
        Case $msg = $btn010
            transpose()
        Case else
    endselect

until $msg = $gui_event_close

exit

Func transpose()

    Local $in, $out, $hit = false

    GUICtrlSetData($out010,'')
    Local $in = stringsplit(GUICtrlRead($inp010),"")

    ;_arraydisplay($in)

    For $i = 1 To $in[0]
        For $j = 0 To UBound($a_xlate,1) - 1
            If $a_xlate[$j][0] = $in[$i] Then
                $out &= $a_xlate[$j][1]
                $hit = true
            endif
        next
        If Not $hit Then $out &= '-'
        $hit = false
    Next
    GUICtrlSetData($out010,$out)
    GUICtrlSetState($inp010,$gui_focus)

endfunc

My version has the data seperate from the logic, but your is easier to understand...not sure which I like better

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Link to comment
Share on other sites

Yes I know and I wouldn't do it the switch way for myself, but so many people are confused with arrays and since the OP was alreay comfortable with a switch-like design, I did it such.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Try this:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <GuiEdit.au3>
Local $Form1 = GUICreate("Form1", 257, 155, 339, 282)
Local $Input1 = GUICtrlCreateInput("", 32, 32, 201, 21)
Local $Input2 = GUICtrlCreateInput("", 32, 88, 201, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_RIGHT))
Local $Label1 = GUICtrlCreateLabel("English", 104, 8, 38, 17)
Local $Button1 = GUICtrlCreateButton("Ta7weel", 96, 120, 75, 25)
Local $Label2 = GUICtrlCreateLabel("Franco", 104, 64, 37, 17)
GUISetState(@SW_SHOW)
Local $Read1, $Read2
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $Button1
   $Read1 = StringSplit(GUICtrlRead($Input1), '', 2)
   $Read2 = ''
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   For $char In $Read1
    Switch $char
     Case 'a'
      $Read2 &= '1'
     Case 'b'
      $Read2 &= '2'
     Case 'c'
      $Read2 &= '3'
     Case 'd'
      $Read2 &= '4'
     Case 'e'
      $Read2 &= '5'
     ; insert as many Case statements as possible input characters
     Case Else
      $Read2 &= '?'
    EndSwitch
   Next
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   GUICtrlSetData($Input2, $Read2)  ; write new data all at once
EndSwitch
WEnd

It's really easy, helped me..and that's what i want :)

but what does this "&=" mean?

Many thanks.

jchd,

Nice. I had something like this in mind...

#include <ButtonConstants.au3>
#include <array.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

;translation table $a_xlate)
;
;          col0       col1
;       (english    (something =
;        letter)     to english letter)
;   row0    a             a-x
;   row1    b             b-x
;   row2    c             c-x
;   row3    d             d-x
;   row4    e             e-x
;   row5    f             f-x
;
;   ... and so on for all symbols (letters) to be transposed (translated)
;

Local $a_xlate[31][2]

$a_xlate[00][0] = 'a'
$a_xlate[00][1] = 'a-x'
$a_xlate[01][0] = 'b'
$a_xlate[01][1] = 'b-x'
$a_xlate[02][0] = 'c'
$a_xlate[02][1] = 'c-x'
$a_xlate[03][0] = 'd'
$a_xlate[03][1] = 'd-x'
$a_xlate[04][0] = 'e'
$a_xlate[04][1] = 'e-x'
$a_xlate[05][0] = 'f'
$a_xlate[05][1] = 'f-x'
$a_xlate[06][0] = 'g'
$a_xlate[06][1] = 'g-x'
$a_xlate[07][0] = 'h'
$a_xlate[07][1] = 'h-x'
$a_xlate[08][0] = 'i'
$a_xlate[08][1] = 'i-x'
$a_xlate[09][0] = 'j'
$a_xlate[09][1] = 'j-x'
$a_xlate[10][0] = 'k'
$a_xlate[10][1] = 'k-x'
$a_xlate[11][0] = 'l'
$a_xlate[11][1] = 'l-x'
$a_xlate[12][0] = 'm'
$a_xlate[12][1] = 'm-x'
$a_xlate[13][0] = 'n'
$a_xlate[13][1] = 'n-x'
$a_xlate[14][0] = 'o'
$a_xlate[14][1] = 'o-x'
$a_xlate[15][0] = 'p'
$a_xlate[15][1] = 'p-x'
$a_xlate[16][0] = 'q'
$a_xlate[16][1] = 'q-x'
$a_xlate[17][0] = 'r'
$a_xlate[17][1] = 'r-x'
$a_xlate[18][0] = 's'
$a_xlate[18][1] = 's-x'
$a_xlate[19][0] = 't'
$a_xlate[19][1] = 't-x'
$a_xlate[20][0] = 'u'
$a_xlate[20][1] = 'u-x'
$a_xlate[21][0] = 'v'
$a_xlate[21][1] = 'v-x'
$a_xlate[22][0] = 'w'
$a_xlate[22][1] = 'w-x'
$a_xlate[23][0] = 'x'
$a_xlate[23][1] = 'x-x'
$a_xlate[24][0] = 'y'
$a_xlate[24][1] = 'y-x'
$a_xlate[25][0] = 'z'
$a_xlate[25][1] = 'z-x'
$a_xlate[26][0] = '1'
$a_xlate[26][1] = '1-x'
$a_xlate[27][0] = '2'
$a_xlate[27][1] = '2-x'
$a_xlate[28][0] = '3'
$a_xlate[28][1] = '3-x'
$a_xlate[29][0] = '4'
$a_xlate[29][1] = '4-x'
$a_xlate[30][0] = '5'
$a_xlate[30][1] = '5-x'

; el guio

Local  $gui010  = GUICreate('Translation Example',500,400)
                  GUICtrlCreatelabel('Enter Letter/Word to Translate',100,80,300,40)
global $inp010  = GUICtrlCreateInput('',100,100,300,20)
                  GUICtrlCreatelabel('Translation',100,130,300,40)
global $out010  = GUICtrlCreateLabel('',100,150,300,20,$ss_sunken)
Local  $btn010  = GUICtrlCreatebutton('Translate',100,300,300,30)
                  GUISetState()
Local $msg

Do

    $msg = GUIGetMsg()
    select
        Case $msg = $btn010
            transpose()
        Case else
    endselect

until $msg = $gui_event_close

exit

Func transpose()

    Local $in, $out, $hit = false

    GUICtrlSetData($out010,'')
    Local $in = stringsplit(GUICtrlRead($inp010),"")

    ;_arraydisplay($in)

    For $i = 1 To $in[0]
        For $j = 0 To UBound($a_xlate,1) - 1
            If $a_xlate[$j][0] = $in[$i] Then
                $out &= $a_xlate[$j][1]
                $hit = true
            endif
        next
        If Not $hit Then $out &= '-'
        $hit = false
    Next
    GUICtrlSetData($out010,$out)
    GUICtrlSetState($inp010,$gui_focus)

endfunc

My version has the data seperate from the logic, but your is easier to understand...not sure which I like better

kylomas

It's a little difficult... but the same idea, i'll study it ;)

thanks for ur help :D

Edited by Command3r

[font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting.

 

[font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color]

[font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font]

Link to comment
Share on other sites

$var &= "abc" concatenates the string "abc" to $var.

All this is in the help file under Operators.

Glad it worked for you.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...