Harabo Posted February 9, 2010 Share Posted February 9, 2010 Hello, im making a converter to a secret language! The converter does like this: It take a number, and a character lets say A Then it take character A and convert it to C then it has jumped 2 characters in the alfabet. Like this: http://en.wikipedia.org/wiki/Caesar_cipher Caesar. And i wonder how sould i do that? My input is named $input and what sould i do if i have more then one character, lets take the world Hello and translate that? Hope you understand what im trying to say:) Not so good in English:S Link to comment Share on other sites More sharing options...
whim Posted February 9, 2010 Share Posted February 9, 2010 Look up Chr() and Asc() functions in the help file hope that helps, whim Link to comment Share on other sites More sharing options...
Xenobiologist Posted February 9, 2010 Share Posted February 9, 2010 Here is something that you could use. expandcollapse popup#include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> HotKeySet('{ESC}', '_end') Opt('TrayMenuMode', 1) Opt('MustDeclareVars', 1) Global $GUI, $name_I, $normalizedName_I, $initialize_B, $clipBoard_B, $nMsg Global $release = 'Release 1.0.0' $GUI = GUICreate('Convert - ' & $release, 520, 175, @DesktopWidth / 2 - 520 / 2, @DesktopHeight / 2 - 100) GUICtrlCreateGroup('Input', 5, 5, 510, 165) GUICtrlCreateLabel('Type', 15, 25, 85, 21, $SS_SUNKEN) GUICtrlSetFont(-1, 11, 600) GUICtrlSetColor(-1, 0xFF0000) $name_I = GUICtrlCreateInput('', 105, 25, 401, 21) GUICtrlCreateGroup('Output', 5, 75, 510, 50) GUICtrlCreateLabel('Result', 15, 93, 85, 21, $SS_SUNKEN) GUICtrlSetFont(-1, 11, 600) GUICtrlSetColor(-1, 0xFF0000) $normalizedName_I = GUICtrlCreateInput('', 105, 93, 401, 21) GUICtrlCreateGroup('', -99, -99, 1, 1) $initialize_B = GUICtrlCreateButton('Release', 15, 135, 240, 25, $BS_DEFPUSHBUTTON) GUICtrlSetFont(-1, 12, 600) $clipBoard_B = GUICtrlCreateButton('Copy to clipboard', 260, 135, 240, 25) GUICtrlSetFont(-1, 12, 600) GUICtrlCreateGroup('', -99, -99, 1, 1) GUISetState(@SW_SHOW) GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit (0) Case $initialize_B GUICtrlSetData($name_I, '') Case $clipBoard_B ClipPut(GUICtrlRead($normalizedName_I)) EndSwitch WEnd Func WM_COMMAND($hWnd, $imsg, $iwParam, $ilParam) Local $nNotifyCode = BitShift($iwParam, 16) Local $nID = BitAND($iwParam, 0x0000FFFF) Local $hCtrl = $ilParam If $nNotifyCode = $EN_CHANGE Then Switch $hCtrl Case GUICtrlGetHandle($name_I) GUICtrlSetData($normalizedName_I, _getNormalizedName(GUICtrlRead($name_I))) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func _end() Exit (0) EndFunc ;==>_end Func _getNormalizedName($name) Local $normalizedName = '', $chars_A $normalizedName = StringStripWS(StringUpper($name), 7) ; vorne hinten, doppelte Leerzeichen entfernen $chars_A = StringSplit($name, '', 2) For $i = 0 To UBound($chars_A) - 1 $chars_A[$i] = Chr(Asc($chars_A[$i]) + 2) Next Return _ArrayToString($chars_A, '') EndFunc ;==>_getNormalizedName Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 9, 2010 Moderators Share Posted February 9, 2010 Harabo, Two possible solutions: expandcollapse popup#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel("This input writes to the label below", 10, 10, 300, 20) $hInput_1 = GUICtrlCreateInput("", 10, 30, 200, 20) $hLabel = GUICtrlCreateLabel("", 10, 70, 200, 20) GUICtrlCreateLabel("This input converts as it goes along", 10, 100, 300, 20) $hInput_2 = GUICtrlCreateInput("", 10, 120, 200, 20) GUISetState() $iCurrLen_1 = 0 $iCurrLen_2 = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; read top input $sInput_1 = GUICtrlRead($hInput_1) $iInputLen_1 = StringLen($sInput_1) ; Has it been changed If $iInputLen_1 <> $iCurrLen_1 Then $iCurrLen_1 = $iInputLen_1 $sText = "" ; Work through the input and convert For $i = 1 To $iCurrLen_1 $iAsc = Asc(StringMid($sInput_1, $i, 1)) Switch $iAsc ; a-x = add 2 Case 65 To 88, 97 To 120 $sText &= Chr($iAsc + 2) ; y & z = subtract 2 to get a & b Case 89 To 90, 121 To 122 $sText &= Chr($iAsc - 24) EndSwitch Next ; Write label GUICtrlSetData($hLabel, $sText) EndIf $sInput_2 = GUICtrlRead($hInput_2) $iInputLen_2 = StringLen($sInput_2) ; If input is longer convert new letter If $iInputLen_2 > $iCurrLen_2 Then $iCurrLen_2 = $iInputLen_2 $iAsc = Asc(StringRight($sInput_2, 1)) Switch $iAsc Case 65 To 88, 97 To 120 $iAsc = $iAsc + 2 Case 89 To 90, 121 To 122 $iAsc = $iAsc - 24 EndSwitch GUICtrlSetData($hInput_2, StringTrimRight($sInput_2, 1) & Chr($iAsc)) ; If input is shorter make no change ElseIf $iInputLen_2 < $iCurrLen_2 Then $iCurrLen_2 = $iInputLen_2 EndIf WEnd Please ask if anything is unclear. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
jchd Posted February 9, 2010 Share Posted February 9, 2010 Think about it for a second and say you shift letters by 2 positions forward (A --> C). For your problem statement o be complete, you have to push it to he limits. What should happen to X? You'll say: "Man, this one is like the other, so X --> Z." Nice shot! But now, what do you do with Y? ... <long silence> "Man, you got me!" That's the questions you need to ask yourself (and answer) _before_ thinking about how to write it. The processor will blindly execute what you said. You only can cover this with intelligence so the result makes sense in every situation. To answer the question you didn't ask, it should consider the "successor" of Z to be A. In a Caesar's cipher, letters are on a strip with Z stuck to A. See that? Now the behavior we need is clear: Y --> A and Z --> B. How to code it? Here' a simple implementation, not the most efficient, but aimed at some clarity. Look in the help file what each funcion does and try to understand by yourself how it works. #include <Array.au3> $input = "This is a big secret. It needs 123 seconds to guess!" ConsoleWrite(Caesar($input, 2) & @LF) Func Caesar($str, $shift) Local $letters = StringToASCIIArray($str) _ArrayDisplay($letters) ;; so you see the (decimal) ASCII code of your plaintext For $i = 0 To UBound($letters) - 1 Select Case $letters[$i] >= Asc('A') And $letters[$i] <= Asc('Z') $letters[$i] = Mod($letters[$i] + 2 - Asc('A'), 26) + Asc('A') Case $letters[$i] >= Asc('a') And $letters[$i] <= Asc('z') $letters[$i] = Mod($letters[$i] + 2 - Asc('a'), 26) + Asc('a') Case $letters[$i] >= Asc('0') And $letters[$i] <= Asc('9') $letters[$i] = Mod($letters[$i] + 2 - Asc('0'), 10) + Asc('0') EndSelect Next _ArrayDisplay($letters) ;; so you see the (decimal) ASCII code of your ciphertext Return(StringFromASCIIArray($letters)) EndFunc 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 hereRegExp tutorial: enough to get startedPCRE 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 More sharing options...
Harabo Posted February 9, 2010 Author Share Posted February 9, 2010 Harabo, Two possible solutions: expandcollapse popup#include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel("This input writes to the label below", 10, 10, 300, 20) $hInput_1 = GUICtrlCreateInput("", 10, 30, 200, 20) $hLabel = GUICtrlCreateLabel("", 10, 70, 200, 20) GUICtrlCreateLabel("This input converts as it goes along", 10, 100, 300, 20) $hInput_2 = GUICtrlCreateInput("", 10, 120, 200, 20) GUISetState() $iCurrLen_1 = 0 $iCurrLen_2 = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; read top input $sInput_1 = GUICtrlRead($hInput_1) $iInputLen_1 = StringLen($sInput_1) ; Has it been changed If $iInputLen_1 <> $iCurrLen_1 Then $iCurrLen_1 = $iInputLen_1 $sText = "" ; Work through the input and convert For $i = 1 To $iCurrLen_1 $iAsc = Asc(StringMid($sInput_1, $i, 1)) Switch $iAsc ; a-x = add 2 Case 65 To 88, 97 To 120 $sText &= Chr($iAsc + 2) ; y & z = subtract 2 to get a & b Case 89 To 90, 121 To 122 $sText &= Chr($iAsc - 24) EndSwitch Next ; Write label GUICtrlSetData($hLabel, $sText) EndIf $sInput_2 = GUICtrlRead($hInput_2) $iInputLen_2 = StringLen($sInput_2) ; If input is longer convert new letter If $iInputLen_2 > $iCurrLen_2 Then $iCurrLen_2 = $iInputLen_2 $iAsc = Asc(StringRight($sInput_2, 1)) Switch $iAsc Case 65 To 88, 97 To 120 $iAsc = $iAsc + 2 Case 89 To 90, 121 To 122 $iAsc = $iAsc - 24 EndSwitch GUICtrlSetData($hInput_2, StringTrimRight($sInput_2, 1) & Chr($iAsc)) ; If input is shorter make no change ElseIf $iInputLen_2 < $iCurrLen_2 Then $iCurrLen_2 = $iInputLen_2 EndIf WEnd Please ask if anything is unclear. M23 Thank you very much:) I get it to work, but now i have a new problem... I use GUICtrlCreateListView to show the result, and it luck like this: $1 = "" $listview =GUICtrlCreateListView("Number|Key", 10, 50, 1580, 450) GUICtrlCreateListViewItem("1|" & $1, $listview) There i can only fill in to $1 what i want to get as result, but when i sett that to $sText i get this: GUICtrlCreateListViewItem("1|" & $text, $listview) GUICtrlCreateListViewItem("1|" & ^ ERROR I have the $listview =GUICtrlCreateListView("Number|Key", 10, 50, 1580, 450) GUICtrlCreateListViewItem("1|" & $1, $listview) part outside, and the function part inside a function. How can i get $sText outside of the function? Hope you understood:) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 9, 2010 Moderators Share Posted February 9, 2010 (edited) Harabo,The easiest way to get a value out of a function is to use Return like this:; Call a function and set a variable to hold the return value Global $sRet_Value = My_Function() ; Display the return value MsgBox(0,"Return Value", $sRet_Value) ; If we try and show $sText directly we get an error!!!!! MsgBox(0, "Local Variable", $sText) Func My_Function() Local $sText = "I am a Local variable" ; Return the value Return $sText EndFuncYou will see I used Global and Local here. Global means that the variable is visible everywhere in the script - Local means that it is only visible inside the function. AutoIt will automatically scope the variables as follows: Global in the main script, Local inside functions - but it is best to declare them yourself as you go along.Ah, I hear you say, why not declare everything as Global and then it is visible everywhere? Plenty of reasons!To start with there is the question of memory. Global veriables are stored permamently - Local variables are destroyed when you exit the function.Then there is the problem of overwriting. If 2 of your functions use the same name for a variable (very easy to do for simple names like $iCount or $sText) than you risk overwriting the value and not getting what you think you have in the variable.There are plenty of other reasons as well, but they will do for now.I hope that is clear - please ask if not. M23Edit: When you reply please use the "Add Reply" button at the top and bottom of the page rather then the "Reply" button in the post itself. That way you do not get the contents of the previous post quoted in your reply and the whole thread becomes easier to read. Edited February 9, 2010 by Melba23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
Harabo Posted February 9, 2010 Author Share Posted February 9, 2010 A little problem again :S Does GUICtrlCreateListViewItem("1|" & $sRet_Value, $listview) update when $sRet_Value updates? I dont have that line in a loop. The only thing i get when i run the program is 0 But if i set $sRet_Value = "Test" then 0 turns to test. So i think the line don`t update :S Any resolution? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 9, 2010 Moderators Share Posted February 9, 2010 Harabo, If you post your script I will try and help - but without it I am a little stuck as my crystal ball is being repaired today! M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
Harabo Posted February 9, 2010 Author Share Posted February 9, 2010 (edited) Here the script is: Is far away from finish, but now im try to get a to c on col 2 rad 1. But there its only 0. I want it to "live update" so when im write in the input, it shows up in the output. The tooltip is only a little help:) And im not sure if i need all the Includes but i have them there:S EDIT: And i can`t use array yet, so maybe you thing this a hard way, but its the only one i understand. Thanks for alle the help so far:) expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiListView.au3> #include <GuiImageList.au3> $GUI = GUICreate("Cæsar decrypter", 1600, 500) GUICtrlCreateLabel("Cæsar decrypter", 750, 1) $inn = GUICtrlCreateInput("", 10, 20, 1580, 20) $listview =GUICtrlCreateListView("Number|Key", 10, 50, 1580, 450) GUISetState(@SW_SHOW) $1 = "" $2 = "" $3 = "" $4 = "" $5 = "" $6 = "" $7 = "" $8 = "" $9 = "" $10 = "" $11 = "" $12 = "" $13 = "" $14 = "" $15 = "" $16 = "" $17 = "" $18 = "" $19 = "" $20 = "" $21 = "" $22 = "" $23 = "" $24 = "" $25 = "" $lengde = 0 Global $sRet_Value = My_Function() $sRet_Value = "" GUICtrlCreateListViewItem("1|" & $sRet_Value, $listview) GUICtrlCreateListViewItem("2|" & $2, $listview) GUICtrlCreateListViewItem("3|" & $3, $listview) GUICtrlCreateListViewItem("4|" & $4, $listview) GUICtrlCreateListViewItem("5|" & $5, $listview) GUICtrlCreateListViewItem("6|" & $6, $listview) GUICtrlCreateListViewItem("7|" & $7, $listview) GUICtrlCreateListViewItem("8|" & $8, $listview) GUICtrlCreateListViewItem("9|" & $9, $listview) GUICtrlCreateListViewItem("10|" & $10, $listview) GUICtrlCreateListViewItem("11|" & $11, $listview) GUICtrlCreateListViewItem("12|" & $12, $listview) GUICtrlCreateListViewItem("13|" & $13, $listview) GUICtrlCreateListViewItem("14|" & $14, $listview) GUICtrlCreateListViewItem("15|" & $15, $listview) GUICtrlCreateListViewItem("16|" & $16, $listview) GUICtrlCreateListViewItem("17|" & $17, $listview) GUICtrlCreateListViewItem("18|" & $18, $listview) GUICtrlCreateListViewItem("19|" & $19, $listview) GUICtrlCreateListViewItem("20|" & $20, $listview) GUICtrlCreateListViewItem("21|" & $21, $listview) GUICtrlCreateListViewItem("22|" & $22, $listview) GUICtrlCreateListViewItem("23|" & $23, $listview) GUICtrlCreateListViewItem("24|" & $24, $listview) GUICtrlCreateListViewItem("25|" & $25, $listview) func My_Function() $rinn = GUICtrlRead($inn) $linn = StringLen($rinn) If $linn <> $lengde Then $lengde = $linn $text = "" For $i = 1 to $linn $asc = asc(StringMid($rinn, $i, 1)) Switch $asc case 65 to 88, 97 to 120 $text &= Chr($asc + 2) Case 89 To 90, 121 To 122 $text &= Chr($asc - 24) EndSwitch local $text1 = $text Next GUICtrlSetData($1, $text) ToolTip($text1) EndIf EndFunc While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch My_Function() WEnd GUIDelete() Edited February 9, 2010 by Harabo Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 9, 2010 Moderators Share Posted February 9, 2010 Harabo,You need to learn arrays - they are a vital part of any form of coding. There is a nice tutorial here. What exactly do you want to appear in your ListView? Do want each keypress to start a new Item? Please explain in as much detail as you can what you want to happen when you enter a new charater into the Input.M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
Harabo Posted February 9, 2010 Author Share Posted February 9, 2010 Im making a Caesar decrypter. If you luck it is 25 lines, and on each line it is a difrent komenision. Like this: INPUT: ab OUTPUT 1:bc 2:cd 3:de 4:ef ... If you understand, every time it is jumping one space in the alfabeth:) And at the lest ab comes and then i can see it was that. So if i have hello krypted to: jgnnq, then in one of the 25 lines it says hello. Hope you understand, thanks for the tut. I think im gonna read it now(: Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 9, 2010 Moderators Share Posted February 9, 2010 Harabo,I have changed your ListView for a whole bunch of labels. Trying to use a ListView meant a lot of advanced UDFs and I do not want to confuse you....yet! Try and follow what I have done here:expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiListView.au3> #include <GuiImageList.au3> Global $iAsc_New ; Create GUI Global $GUI = GUICreate("Cæsar decrypter", 500, 600) GUICtrlCreateLabel("Cæsar decrypter", 10, 5) Global $inn = GUICtrlCreateInput("", 10, 30, 480, 20) GUICtrlCreateLabel("Number", 10, 50, 80, 20) GUICtrlCreateLabel("Key", 100, 50, 80, 20) GUISetState(@SW_SHOW) For $i = 1 To 25 GUICtrlCreateLabel($i, 10, 50 + (20 * $i), 40, 20) GUICtrlCreateLabel("|", 90, 50 + (20 * $i), 10, 20) Next Global $hDummy = GUICtrlCreateDummy() For $i = 1 To 25 GUICtrlCreateLabel("", 100, 50 + (20 * $i), 380, 20) Next Global $lengde = 0 While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch Global $rinn = GUICtrlRead($inn) Global $linn = StringLen($rinn) ; If input is longer convert new letter If $linn > $lengde Then $lengde = $linn Global $iAsc = Asc(StringRight($rinn, 1)) For $i = 1 To 25 Switch $iAsc Case 65 To 90 $iAsc_New = $iAsc + $i If $iAsc_New > 90 Then $iAsc_New = $iAsc_New - 26 Case 97 To 122 $iAsc_New = $iAsc + $i If $iAsc_New > 122 Then $iAsc_New = $iAsc_New - 26 EndSwitch Global $sText = GUICtrlRead($hDummy + $i) $sText = $sText & Chr($iAsc_New) GUICtrlSetData($hDummy + $i, $sText) Next ; If input is shorter ElseIf $linn < $lengde Then $lengde = $linn For $i = 1 To 25 $sText = GUICtrlRead($hDummy + $i) $sText = StringLeft($sText, $linn) GUICtrlSetData($hDummy + $i, $sText) Next EndIf WEndAsk if you cannot follow, although it is not difficult - honest! M23P.S. OK the Dummy bit is complicated, so I will explain. Normally I would save the ControlIDs of the labels I need to change in an array - but you are not ready for that yet. So I created a Dummy, which does nothing except use a ControlID. I can then reference the labels created immediately afterwards using this value, as ControlIDs are issued in sequence. Get it?  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
Harabo Posted February 9, 2010 Author Share Posted February 9, 2010 thank you very much! Now im going to studdy this script and learn me everything there. And again thank you very much;) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now