Graphics

 View Only
  • 1.  lower to uppercase

    Posted 04-10-2013 21:10
    hi, im linking text with a database of flags, so when I type the name of a country the system searchs that same name on a PNG database, but I have a problem with the lower and uppercases.

    My question is, how can I convert a text from lower to upper case only? I know it can be done by changing the font to smlcaps 100%), but it doesnt help because I can still type a lowercase letter on the published box and my script recognizes the text as lowercase (althought it outputs it correctly as uppercase). The problem with that, is that I have to write two conditions in my script instead of one. Example:

    If text_IN.text = "countryname" orElse text_IN.text = "COUNTRYNAME" then

    text_OUT.text = "COUNTRYNAME"

    else

    text_OUT.text = ""

    end if

    this is to make sure I have to type the name I want, and to avoid bad spelling.


  • 2.  RE: lower to uppercase

    Posted 04-10-2013 21:23
    On the text object, under OnSetText, try:

    text = UCase(text)

    Then run your PNG search at the OnOnline level for the scene. The scene will set the text first at the object level, then run the script to place the image correctly.

    I'm assuming something on the scene level like:

    dim TxtObject as xpTextObject

    dim ImageObject as xpBaseObject

    dim PicMat as xpMaterial

    dim PicShad as xpBaseShader

    dim FilePath as String

    Self.GetObjectByName("Text Object", TxtObject)

    Self.GetObjectByName("Image Object", ImageObject)

    FilePath = "path to image folder" & TxtObject.Text & ".png"

    ImageObject.GetMaterial(0, PicMat)

    PicMat.GetShader(0, PicShad)

    PicShad.SetFileName(FilePath)


    That's how I would put it together. See if that works for you. :)

    #XPression


  • 3.  RE: lower to uppercase

    Posted 04-11-2013 16:29
    Great! It worked perfectly. Do you have another script for ignoring Extended ASCII characters from the text input?

    #XPression


  • 4.  RE: lower to uppercase

    Posted 04-11-2013 16:40
    I'd have to see an example of your input to figure it out.

    Give me a few examples of the text that would be input into these fields, and I'll see what I can come up with. The trick is to find something uniform in each of them, then find a way to break it at that point. That way only one script is needed instead of a custom script for each possible input.

    #XPression


  • 5.  RE: lower to uppercase

    Posted 04-11-2013 16:57
    oh... this is the script so far

    dim text_IN, text_OUT as xptextobject

    dim Bandera as xpBaseObject

    Self.GetObjectByName("Text1", text_IN)

    Self.GetObjectByName("Text2", text_OUT)

    Self.GetObjectByName("Bandera", Bandera)

    Bandera.PosX = 524

    If text_IN.text = "ESTADOS UNIDOS" orElse text_IN.text = "USA" orElse text_IN.text = "EEUU" orElse text_IN.text = "ESTADOS UNIDOS DE AMERICA" Then

    text_OUT.text = "ESTADOS UNIDOS"

    ElseIf text_IN.text = "AFGANISTAN" orElse text_IN.text = "AFGANISTÁN" Then

    text_OUT.text = "AFGANISTÁN"

    ElseIf text_IN.text = "ALBANIA" Then

    text_OUT.text = "ALBANIA"

    ElseIf text_IN.text = "ALEMANIA" Then

    text_OUT.text = "ALEMANIA"

    ElseIf text_IN.text = "ANTIGUA BARBUDA" orElse text_IN.text = "ANTIGUA Y BARBUDA" Then

    text_OUT.text = "ANTIGUA Y BARBUDA"

    ElseIf text_IN.text = "AZERBAIYAN" orElse text_IN.text = "AZERBAYAN" orElse text_IN.text = "AZERBAJAN" orElse text_IN.text = "AZERBAYÁN" orElse text_IN.text = "AZERBAJÁN" Then

    text_OUT.text = "AZERBAIYÁN"

    ElseIf text_IN.text = "belgica" orElse text_IN.text = "BELGICA" orElse text_IN.text = "BÁ‰LGICA" Then

    text_OUT.text = "BÁ‰LGICA"

    ElseIf text_IN.text = "BELIZE" orElse text_IN.text = "BELICE" orElse text_IN.text = "BÁ‰LICE" then

    text_OUT.text = "BELICE"

    ElseIf text_IN.text = "BENIN" orElse text_IN.text = "BÁ‰NIN" orElse text_IN.text = "BENÁN" Then

    text_OUT.text = "BENÁN"

    ElseIf text_IN.text = "BIELORUSIA" orElse text_IN.text = "BIELORRUSIA" Then

    text_OUT.text = "BIELORRUSIA"

    ElseIf text_IN.text = "BOSNIA HERZEGOVINA" orElse text_IN.text = "BOSNIA-HERZEGOVINA" orElse text_IN.text = "BOSNIA Y HERZEGOVINA" Then

    text_OUT.text = "BOSNIA Y HERZEGOVINA"

    ElseIf text_IN.text = "BOTSWANA" orElse text_IN.text = "BOTSUANA" Then

    text_OUT.text = "BOTSUANA"

    ElseIf text_IN.text = "BRAZIL" orElse text_IN.text = "BRASIL" Then

    text_OUT.text = "BRASIL"

    ElseIf text_IN.text = "BRUNEI" orElse text_IN.text = "BRUNÁ‰I" Then

    text_OUT.text = "BRUNÁ‰I"

    ElseIf text_IN.text = "BURUNDI" orElse text_IN.text = "BURUNDÁ" Then

    text_OUT.text = "BURUNDI"

    ElseIf text_IN.text = "BUTAN" orElse text_IN.text = "BUTÁN" Then

    text_OUT.text = "BUTÁN"

    ElseIf text_IN.text = "CAMBODIA" orElse text_IN.text = "CAMBODYA" orElse text_IN.text = "CAMBOYA" Then

    text_OUT.text = "CAMBOYA"

    ElseIf text_IN.text = "CAMERUN" orElse text_IN.text = "CAMERÁšN" Then

    text_OUT.text = "CAMERÁšN"

    Else text_OUT.text = ""

    Bandera.PosX = -200

    End If

    dim materialBandera as xpMaterial

    dim shaderBandera as xpBaseShader

    dim directorio as String

    directorio = "E:xpprojectsImagesbanderas - paises" & text_OUT.text & ".png"

    Bandera.GetMaterial(0, materialBandera)

    materialBandera.GetShader(0, shaderBandera)

    shaderBandera.SetFileName(directorio)

    ''''''''''''''''''''''''''''''''''''''''''''''''''''

    as you can see, im trying to correct some common flaws of the operator (to avoid bad spelling), so they dont worry about how they type the country name and still it outputs the "correct" name (thanks to wikipedia), and the correct flag for that country. I have to do it because if they spell wrong the country name, the flag wont update correctly and we could end up showing united states with the canadian flag as an example.

    Another way to avoid this would be in theory with a list of the countries and the operator would select one, but I cant find a way to do it inside ross xpression (I could in theory do that within a custom web page, but I have to learn dreamweaver to do it)

    thanks!

    #XPression


  • 6.  RE: lower to uppercase

    Posted 04-16-2013 01:39
    You could do this two ways, I suggest the first. We do a similar thing with Twitter handles for all of our staff. I created an "invisible" text object (visibility turned off, alpha set to 0), with their handles in each. That way, when they pull up the template, they see a list of all possible options. I would start with that.

    The second would be to script it, which would be a pain in the tail. Looking at your first line (for USA) only:

    If text_IN.text = "ESTADOS UNIDOS" orElse text_IN.text = "USA" orElse text_IN.text = "EEUU" orElse text_IN.text = "ESTADOS UNIDOS DE AMERICA" Then

    text_OUT.text = "ESTADOS UNIDOS"


    Change it to:

    If InStr(text_IN.text, "ESTADOS UNIDOS") = 1

    orElse InStr(text_IN.text, "USA") = 1

    orElse InStr(text_IN.text, "EEUU")

    orElse InStr(text_IN.text, "ESTADOS UNIDOS DE AMERICA") = 1 Then

    text_OUT.text = "ESTADOS UNIDOS"


    This will allow for any of the input and anything else following it to be used, and only the desired outcome would be fed. It does this by seeing If the first characters are the text desired, ignoring anything past that. For example, if I put in "USAxxxxxx," it'll only check to make sure "USA" is in there, then output "ESTADOS UNIDOS."

    I would stick with training your operators to read from a list. :)

    #XPression


  • 7.  RE: lower to uppercase

    Posted 04-16-2013 01:45
    Just thought of another fun way to do this.

    Create a text object. Input "Tiene entrada de un nombre de paÁ­s inccorect. Por favor, compruebe la ortografÁ­a." Set it to invisible.

    In the OnPreviewRender script write:

    if text_IN = "ESTADOS UNIDOS" orElse if text_IN = "USA" ...etc for the full list then

    Warning.Visible = False

    Else

    Warning.Visible = True

    End If


    That would make your operators see the giant text on the scene while building it in their render pane, and change it accordingly. A little meaner, but could be more fun and more of an impact on how to do it the right way.

    ...Just a thought. ;)

    EDIT: fyi, I did this within my station for a couple things. Turned out to work really well, as we have extremely high turnover of producers. Very impactful.

    #XPression