Sign in to follow this  
Followers 0
bovirus

InputBox - Translation of "Cancel" and "OK" button text

10 posts in this topic

I want to translate the standard text (OK & Cancel" for ImputBox feature.How can do it?Thanks.

 

 

 

Share this post


Link to post
Share on other sites



Translate it in what way?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I think he's trying to make the "Ok & Cancel" buttons with another text. But I don't know how, except setting up manually the GUI.


Codes codes codes.

Share this post


Link to post
Share on other sites

The Windows standard inputbox control uses the language that windows is running in, as far as I know, so to make it in another language you'd have to write your own.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

The Windows standard inputbox control uses the language that windows is running in, as far as I know, so to make it in another language you'd have to write your own.

 

There is no windows standard inputbox, afaik. I'm sure it can be done with use of hooks.

Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites

Yes, there is a standard inputbox, VBScript has the same function in it which displays the same inputbox as AutoIt.

strMessage =Inputbox("Enter your message","Input Required")
WScript.Echo strMessage

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Hi.

Thanks for the answer.

Yes, I want replace "OK" / "Cancel" with italian text.

The OS is italian, but the text strings of tro buttons are in english.

Can I use VBscript directly in Autoit .AU3 file script?

Share this post


Link to post
Share on other sites

You can run a vbscript file from within AutoIt, but there's no need to as AutoIt can do everything that VBScript can do already. You can't use VBScript code within an AutoIt script though, you'd have to translate it to AutoIt code.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

A while ago I made this : 

#include <WinAPI.au3>
#include <string.au3>

Opt("WinWaitDelay", 0)
$i=0

$shit=_InputBoxEx("Numéro de balise", "Entrez le numéro de téléphone de la balise :", True, False, Default, "Fermer", False)

Func _InputBoxEx($title, $text, $numbers=False, $pass=False, $pwdchar=Default, $cancel="Cancel", $allowcanceling=True, $parent="")
    Local Const $SC_CLOSE  = 0xF060
    Local Const $MF_GRAYED = 0x00000001
    Local Const $EM_SETPASSWORDCHAR=0xCC
    If $numbers=True Then
        $number=2 ;2 to lock to numbers, 0 to all
    Else
        $number=0
    EndIf
    $cancela=0
    If $allowcanceling=False Then
        $cancela=8 ;8 to grey, 0 to activate
    EndIf
    $pass=8 ;a for pass, 8 for normal
    If $pass=True Then
        $pass='a'
    EndIf
    If mod(StringLen($title), 2) = 0 Then
        $title=$title&" "
    EndIf
    $titlehex=StringTrimRight(StringReplace(StringRegExpReplace(StringTrimLeft(StringToBinary($title), 2),"(..)","\1 "), " ", "00"), 2)
    If not mod(StringLen($text), 2) = 0 Then
        $text=$text&" "
    EndIf
    $texthex=StringTrimRight(StringReplace(StringRegExpReplace(StringTrimLeft(StringToBinary($text), 2),"(..)","\1 "), " ", "00"), 2)
    If not mod(StringLen($text), 2) = 0 Then
        $cancel=$cancel&" "
    EndIf
    $cancelhex=StringTrimRight(StringReplace(StringRegExpReplace(StringTrimLeft(StringToBinary($cancel), 2),"(..)","\1 "), " ", "00"), 2)
    Global $bDialog="0x0100ffff0000000000000400480acc80040000000000a2005f0000000000"&$titlehex&"0000000800000000004d00530020005300680065006c006c00200044006c006700000000000000000000000000000002500700070093002c00ea030000ffff8200"&$texthex&"00000000000000000000000000"&$pass&"0"&$number&"081500700380093000c00e9030000ffff8100000000000000000000000000010001501000490032000e0001000000ffff80004f004b000000000000000000000000000000015"&$cancela&"5e00490032000e0002000000ffff8000"&$cancelhex&"0000000000"

    Global $tDialog = DllStructCreate("byte[" & BinaryLen($bDialog) & "]")
    DllStructSetData($tDialog, 1, $bDialog)

    Global $hDialogProc = DllCallbackRegister("_DialogProc", "int_ptr", "hwnd;dword;wparam;lparam")
    If StringLen($parent)<>0 Then
        Global $aCall = DllCall("user32.dll", "hwnd", "CreateDialogIndirectParamW", _
                "handle", 0, _
                "ptr", DllStructGetPtr($tDialog), _
                "hwnd", $parent, _
                "ptr", DllCallbackGetPtr($hDialogProc), _
                "lparam", 0)
    Else
        Global $aCall = DllCall("user32.dll", "hwnd", "CreateDialogIndirectParamW", _
                "handle", 0, _
                "ptr", DllStructGetPtr($tDialog), _
                "hwnd", 0, _
                "ptr", DllCallbackGetPtr($hDialogProc), _
                "lparam", 0)
    EndIf
    Global $hDialog = $aCall[0]

    If $allowcanceling=False Then
        Local $hMenu = DllCall('user32.dll', 'int', 'GetSystemMenu', 'hwnd', $hDialog, 'int', 0)
        DllCall('user32.dll', 'int', 'EnableMenuItem', 'hwnd', $hMenu[0], 'int', $SC_CLOSE, 'int', $MF_GRAYED)
    EndIf
    Global $hInput = ControlGetHandle($title, "", "[CLASS:Edit]")
    If Not $pwdchar=Default Then
        _SendMessage($hInput, $EM_SETPASSWORDCHAR, Asc($pwdchar))
    Else

    EndIf
    WinSetState($hDialog, 0, @SW_SHOW)
EndFunc

While 1
WEnd



Func _DialogProc($hWnd, $iMsg, $wParam, $lParam)
    Local Const $WM_COMMAND = 0x0111
    Local Const $WM_CLOSE = 0x0010
    Switch $iMsg
        Case $WM_CLOSE
            SetError(-1)
            DllCall("user32.dll", "int", "DestroyWindow", "hwnd", $hDialog)
        Case $WM_COMMAND
            Switch BitAND($wParam, 65535)
                Case 1
                    ConsoleWrite("'OK' clicked" & @CRLF)
                    $IBX_DATA=ControlGetText("Numéro de balise", "", _WinAPI_GetDlgCtrlID($hInput))
                    DllCall("user32.dll", "int", "DestroyWindow", "hwnd", $hDialog)
                    Global $IBX_DATA
                Case 2
                    SetError(-1)
                    DllCall("user32.dll", "int", "DestroyWindow", "hwnd", $hDialog)
            EndSwitch
    EndSwitch
EndFunc   ;==>_DialogProc

You call the first func (_InputBoxEx) with the parameters you want. You can lock the input to numbers only, or all, set it to password mode, and choose the char you want to use, as well as choose the text you want for "Close" button. The ability close to window (either with the cross or the button) is an option, too.

Get the typed text via getting the $IBX_DATA variable

Edited by perfaram

Never forget to mark a question as resolved, this button has been purposely created :-P 

Share this post


Link to post
Share on other sites

But the inputbox should be in AutoIt by default showwed "OK" "Cancel" in native OS language?

Do you have to include some Autoit file to show the defauult buuton etxt in native langaiueg (ex., OS italian = OK/Cancel in italian)?

Share this post


Link to post
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
Sign in to follow this  
Followers 0