Accented Letters to normal?

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Accented Letters to normal?

Post by Dudus »

Hi,

I would have a question about whether it is possible to automatically change the accented letters to normal letters? Or do not let to type in TextField an accented letters?

Thank you!
Dudus
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Accented Letters to normal?

Post by Gaev »

Dudus:

Do you have a list of the accented characters and their replacement characters ?
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Accented Letters to normal?

Post by Dudus »

Hello Gave yes,

éáíöüóÖÜÓŐÚÉÁŰÍłŁ
eaiouoOUOOUEAUÍlL

the true is that i need to disable to fill TextEntry with special letters, i need Text as a normal english.
Because i want to create a file with name from TextEntry and upload it to ftp, but with special chars the browser not able to show the file
for example: http://myhost.com/hellóóóó.htm

Any Idea? any plugin? :)
Thanks!
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Accented Letters to normal?

Post by Gaev »

Dudus:

On this page ... http://www.asciitable.com/ ... you will see the codes associated with each character ... the second part of the table has codes (128 to 255) for special characters.

On my machine (Canadian English), this code (in the TextChange event section of my TextEntry Box) works ...

Code: Select all

StrLen "[TextEntry11]" "[thisTextlen]"
If "[thisTextLen]" ">" "0"
   SubStr "[TextEntry11]" "[thisTextLen]" "1" "[thisChar]"
   If "[thisChar]" ">" "[#127]"
      SetVar "[result]" "[thisChar] not allowed"
   Else
      SetVar "[result]" "[thisChar] allowed"
   Endif
Else
      SetVar "[result]" "no character"
EndIf
AlertBox "Text" "[result]"
... you will have to change [TextEntry11] to whatever your box's variable name is.

If this code performs the same on yours, it can be modified so invalid characters are immediately removed.

Let me know if it does ... and if you need assistance in scripting to remove illegal characters.
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Accented Letters to normal?

Post by Dudus »

Hello Gave :)

Thanks for your lot of help, it is work perfect.
One more question

I have a Listbox, inside of it i have:
HU DE.txt
DE IT.txt
IT HU.txt

+ 2 Combo boxes: ComboBox1 and ComboBox2 contains:
HU
DE
IT

How to make a filter of the Listbox by combination of ComboBox1 and Combobox2 in fly?
for example:

If ComboBox1 is HU and Combobox2 is DE, than Listbox shows only HU DE.txt?
Thanks in advance!
Dududs
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Accented Letters to normal?

Post by Gaev »

Dudus:

Make sure that List Items property for the ListBox specifies a variable like [ListItems1]

When you want to dynamically load the appropriate list in the ListBox ...

Code: Select all

FileRead "[ComboBox1] [ComboBox2].txt" "All" "[ListItems1]" 
Note that you can make it more efficient (faster) by pre-loading the file contents into other variables at the start of your program ...

Code: Select all

FileRead "HU DE.txt" "All" "[ListItemsHUDE]"
FileRead "DE IT.txt" "All" "[ListItemsDEIT]"
FileRead "IT HU.txt" "All" "[ListItemsITHU]"
etc.
... and when required ...

Code: Select all

SetVar "[ListItems1]" "[ListItems[ComboBox1][ComboBox2]]"
You can also use FileToVar instead of FileRead if you want to deploy Embedded files instead of external (.txt) ones.
User avatar
virger
Posts: 540
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: Accented Letters to normal?

Post by virger »

Bueno intenta esto y me cuentas.
Well try this and tell me.

Code: Select all

{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=9
Name=EnTx
X=0
Y=50
W=320
H=28
Anchor=0
VarName=[vTx]
Align=1
EditLen=0
ObjAction=..OPTIONAL USE 'TIMER DATA'¶.. [PsCursorT]¶¶GetObjectInfo "EnTx" "CursorPosition" "[PsCursor]"¶substr "[vTx]" "[PsCursor]-1" "1" "[ChC]"¶SearchStr "[ChC]" "[[Lan]]" "[Ps]" ""¶if "[Ps]" ">" "0"¶   StrDel "[vTx]" "[PsCursor]-1" "1" "[vTx]"¶   substr "[t[Lan]]" "[Ps]" "1" "[Ch]"¶   StrIns "[Ch]" "[vTx]" "[PsCursor]-1" "[vTx]"¶   setvar "[ChT]" "[ChC]"¶   setvar "[tPs]" "[PsCursor]-1"¶endif
LineColor=0
LineWidth=1
LineStyle=0
FillColor=14743784
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=8
Name=Inf
X=81
Y=88
W=191
H=96
Anchor=0
Font=Arial
FontSize=11
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs22\cf0 Current [PsCursor]\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs22\cf0 Last Change [tPs]\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs22\cf0 \tab \tab \tab \tab [ChT]\tab [Ch]\par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs22\cf0 \par¶\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs22\cf0 Pos By Timer [PsCursorT]}}¶}
HMargin=0
VMargin=0
LineColor=0
LineWidth=1
LineStyle=0
FillColor=14213368
FillPattern=0
TabOrder=3
ObjectType=15
Name=Tm1
X=285
Y=11
W=32
H=32
Anchor=0
Interval=10
ObjAction=GetObjectInfo "EnTx" "CursorPosition" "[PsCursorT]"
ObjectType=8
Name=Inf2
X=10
Y=16
W=131
H=23
Anchor=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs24\cf0 Set Languaje}}¶}
HMargin=0
VMargin=0
LineColor=0
LineWidth=0
LineStyle=0
FillColor=13619151
FillPattern=1
TabOrder=6
ObjectType=11
Name=CbLan
X=109
Y=15
W=69
H=28
Anchor=0
Text=Esp¶Fran¶Ita
VarName=[vLan]
VarType=0
XPTheme=Yes
ObjAction=setvar "[Esp]" "áéíóúñÑ"¶setvar "[tEsp]" "aeiounN"¶¶... NO SE CUALES SON¶setvar "[Fra]" "êûéè"¶setvar "[tFra]" "euee"¶¶setvar "[Ita]" "àèìòù"¶setvar "[tIta]" "aeiou"¶¶setvar "[Lan]" "[vLan]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=16308440
FillPattern=0
Font=Arial
FontSize=12
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4
Le ganaremos a Honduras
We will beat Honduras
COSTA RICA
PURA VIDA
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Accented Letters to normal?

Post by Dudus »

Gaev wrote:Dudus:

Make sure that List Items property for the ListBox specifies a variable like [ListItems1]

When you want to dynamically load the appropriate list in the ListBox ...

Code: Select all

FileRead "[ComboBox1] [ComboBox2].txt" "All" "[ListItems1]" 
Note that you can make it more efficient (faster) by pre-loading the file contents into other variables at the start of your program ...

Code: Select all

FileRead "HU DE.txt" "All" "[ListItemsHUDE]"
FileRead "DE IT.txt" "All" "[ListItemsDEIT]"
FileRead "IT HU.txt" "All" "[ListItemsITHU]"
etc.
... and when required ...

Code: Select all

SetVar "[ListItems1]" "[ListItems[ComboBox1][ComboBox2]]"
You can also use FileToVar instead of FileRead if you want to deploy Embedded files instead of external (.txt) ones.
Hi Gave, i'm in this stage with my code:
PAGE ACTION
FileList "C:\TEST\*.*" "Files" "[ListBox]"
FileList "C:\TEST\*.*" "Files" "[display]"


ListBoxGetItem "ListBox3" "all" "[all]"
SetVar "[AB]" "[ComboBox1] [ComboBox2]"
SetVar "[display]" ""

THIS IS THE CODE OF COMBOBOX1 (AND COMBOBOX 2 HAS THE SAME)
ListBoxSize "ListBox3" "[Count]"
Loop "1" "[Count]" "[N]"
ListBoxGetItem "ListBox3" "[N]" "[Item]"
SearchStr "[AB]" "[Item]" "[Pos]"
If "[Pos]" "=" "1"
SetVar "[display]" "[display][item][#13]"
Endif
EndLoop

And now it is works in fly, BUT just with if I use ComboBox1 and Combobox2 combination.
If I use only Combobox2 it is not working :(
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Accented Letters to normal?

Post by Gaev »

Dudus:

The code in your last post bears no resemblance to that in my last post; is this a different problem you are trying to resolve ?

If so, please take the time to explain in detail ...

- what problem you are trying to solve
- the exact events where each code resides
- variables associated with each object
- the contents of the files being referenced
- the value of the variables at each stage (use AlertBox to capture them)

I can help ... but you have to make the effort to describe everything in detail ... and tell us what does not work as expected ... the process of problem determination involves examination of the result of every command vs. what was expected.
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Accented Letters to normal?

Post by Dudus »

Ok :D i will try to show you in a picture:

Image

So ComboBox 1 and ComboBox2 are filters of the filenames. So if you can show me how to do such like this I would be grateful :)
Dudus
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Accented Letters to normal?

Post by Gaev »

Dudus:
And now it is works in fly, BUT just with if I use ComboBox1 and Combobox2 combination.
If I use only Combobox2 it is not working
1) You are setting the value of [AB] ...

Code: Select all

 
SetVar "[AB]" "[ComboBox1] [ComboBox2]"
... so, if ComboBox1 is not selected, the value of [ComboBox1] is "" (i.e. null) ... so the value of [AB] is null+space+[ComboBox2]

2) So if [ComboBox2] is "FR", [AB] will be " FR" ... and when you do the search ...

Code: Select all

ListBoxGetItem "ListBox3" "[N]" "[Item]"
SearchStr "[AB]" "[Item]" "[Pos]"
If "[Pos]" "=" "1"
   SetVar "[display]" "[display][item][#13]"
Endif
... there is no file with the name " FR 2017.09.xxxxx.txt" ... and so there is no match in position 1


Question: When user only selects [ComboBox2] (let us say FR), what file(s) do you want to match ? ...

- any file with FR in the 4th/5th position ?

OR

- any file with FR in the 1st/2nd position ?

OR

- both of the above ?
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Accented Letters to normal?

Post by Dudus »

Hi Gave!

1.) When user only selects [ComboBox2] (let say FR), than any file with FR in the 4th/5th position. (in this case ComboBox1 not selected)
2.) When user only selects [ComboBox1] (let say HU), than any file with HU in the 1st/2nd position (in this case ComboBox2 not selected)
3.) When user selects [ComboBox1]+[ComboBox2] than only files with 1+2 Combination.

[ComboBox1] = 1st/2nd position
[ComboBox2] = 4th/5th position

It will be a From country to country filter. Im looking for a file with from to option. Sometimes only from country filter, sometime only to country filter
But sometimes with a FROM + TO special options.

Thats what I'm looking for.
Dudus
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Accented Letters to normal?

Post by Gaev »

Dudus:
1.) When user only selects [ComboBox2] (let say FR), than any file with FR in the 4th/5th position. (in this case ComboBox1 not selected)
2.) When user only selects [ComboBox1] (let say HU), than any file with HU in the 1st/2nd position (in this case ComboBox2 not selected)
3.) When user selects [ComboBox1]+[ComboBox2] than only files with 1+2 Combination.

[ComboBox1] = 1st/2nd position
[ComboBox2] = 4th/5th position
Try this ...

Code: Select all

ListBoxGetItem "ListBox3" "[N]" "[Item]"

If "[ComboBox2]" "=" ""
   ... compare against ComboBox1
   SearchStr "[ComboBox1]" "[Item]" "[Pos]"
   If "[Pos]" "=" "1"
      SetVar "[display]" "[display][item][#13]"
   Endif
EndIf

If "[ComboBox1]" "=" ""
   ... compare against ComboBox2
   SearchStr "[ComboBox2]" "[Item]" "[Pos]"
   If "[Pos]" "=" "4"
      SetVar "[display]" "[display][item][#13]"
   Endif
EndIf

StrLen "[AB]" "[ABLen]"
If "[ABLen]" ">" "3"
   ... both boxes selected 
   SearchStr "[AB]" "[Item]" "[Pos]"
   If "[Pos]" "=" "1"
      SetVar "[display]" "[display][item][#13]"
   Endif
EndIf
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: Accented Letters to normal?

Post by Dudus »

Hi Gave,

sorry but it's not working for me. Wil you able to send me your publication?
Porbably i missed something.

Thank you!
D
User avatar
Gaev
Posts: 3782
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada
Contact:

Re: Accented Letters to normal?

Post by Gaev »

Dudus:

1) The code I posted was a replacement for your code within the Loop/EndLoop i.e. ...

Code: Select all

Loop "1" "[Count]" "[N]"
ListBoxGetItem "ListBox3" "[N]" "[Item]"
SearchStr "[AB]" "[Item]" "[Pos]"
If "[Pos]" "=" "1"
SetVar "[display]" "[display][item][#13]"
Endif
... all your other code remains unchanged.

Did you do this ?

2) I you did that, tell us something more than 'it is not working" ... place some AlertBox commands at appropriate places to confirm that the expected If/EndIf code block is being serviced; if not capture the values of [ComboBox1], [ComboBox2], [AB] and [item] and post here.

If it is, capture [Pos] to see what the SearchStr is finding.
Locked