Jump to content

Problem here, somebody help?


Recommended Posts

Hello I am trying to make 1 script for my program, I have 2 versions of the program to Brazilian and Spanish, I'm trying to make a script that when the program is open, a box appears to choose, to choose the Brazilian version or the Spanish,

I am using to select each version GUICtrlCreateRadio but not I'm getting, if someone can help me ..

#NoTrayIcon;
#include <GUIConstantsEx.au3>

_Gercheck() ;Cheack version

if $country = 'BRA' Then
;.....  
ElseIf $country = 'Espanha' Then
;.....
Endif
;......
;......
;......
Func _gercheck()


   Local $n2,$1,$2
   GUICreate("Opçao",300,200)
   GUICtrlCreateLabel("Test",150,150)
   $1 = GUICtrlCreateRadio("Version Brazil", 10, 10, 120, 20)
   $2 = GUICtrlCreateRadio("Version España", 10, 40, 120, 20)
   $n2 = GUICtrlCreateButton("Read", 10, 110, 50)

   If $1 = $n2 Then
               Global $country = 'BRA'
           EndIf
           If $2 = $n2 Then
               Global $country = 'Espanha'

           EndIf


EndFunc

-------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program

Link to comment
Share on other sites

I have a better idea!!

MsgBox(0, "", _Language())

Func _Language()
    Select
        Case StringInStr("040a 080a 0c0a 100a 140a 180a 1c0a 200a 240a 280a 2c0a 300a 340a 380a 3c0a 400a 440a 480a 4c0a 500a", @OSLang)
            Return "Spanish version"
        Case StringInStr("0416 0816", @OSLang)
            Return "Brazilian version"
    EndSelect
EndFunc   ;==>_Language
Link to comment
Share on other sites

If you still (i say still because the function of DCCD is easyest) want to use your code you have to do this:

First, you have to declare the variable ($country), then you have to do visible your GUI, and then add a loop until the user press the buttom.

PD: Use Koda

PD2: Is Versión España, whit ´, la tilde es muy importante en español xD

#NoTrayIcon
#include <GUIConstantsEx.au3>

_Gercheck() ;Cheack version

Dim $country ; <== Declare the variable

if $country = 'BRA' Then
;.....  
ElseIf $country = 'Espanha' Then
;.....
Endif
;......
;......
;......
Func _gercheck()


   Local $n2,$1,$2
   GUICreate("Opçao",300,200)
   GUICtrlCreateLabel("Test",150,150)
   $1 = GUICtrlCreateRadio("Version Brazil", 10, 10, 120, 20)
   $2 = GUICtrlCreateRadio("Version España", 10, 40, 120, 20)
   $n2 = GUICtrlCreateButton("Read", 10, 110, 50)
   GUISetState () ; <== Gui visible
    While 1 ; <==loop
        $nMsg = GUIGetMsg() ; <==
        Switch $nMsg ; <==
            Case $n2 ; <==
                If GUICtrlRead ($1) = $GUI_CHECKED Then ; <==You should use GUICtrlRead
                    Global $country = 'BRA' 
                    ExitLoop
                ElseIf GUICtrlRead ($2) = $GUI_CHECKED Then
                    Global $country = 'Espanha' ; <==
                    ExitLoop
                EndIf ; <==
        EndSwitch ; <==
    WEnd ; <==
    
    
EndFunc
Link to comment
Share on other sites

I have a better idea!!

MsgBox(0, "", _Language())

Func _Language()
    Select
        Case StringInStr("040a 080a 0c0a 100a 140a 180a 1c0a 200a 240a 280a 2c0a 300a 340a 380a 3c0a 400a 440a 480a 4c0a 500a", @OSLang)
            Return "Spanish version"
        Case StringInStr("0416 0816", @OSLang)
            Return "Brazilian version"
    EndSelect
EndFunc   ;==>_Language

This is a good way, but there are Brazilians who use the Spanish version and Spanish using a Brazilian, so I'm trying to do this, so that both can choose which versions to

-------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program

Link to comment
Share on other sites

If you still (i say still because the function of DCCD is easyest) want to use your code you have to do this:

First, you have to declare the variable ($country), then you have to do visible your GUI, and then add a loop until the user press the buttom.

PD: Use Koda

PD2: Is Versión España, whit ´, la tilde es muy importante en español xD

#NoTrayIcon
#include <GUIConstantsEx.au3>

_Gercheck() ;Cheack version

Dim $country ; <== Declare the variable

if $country = 'BRA' Then
;.....  
ElseIf $country = 'Espanha' Then
;.....
Endif
;......
;......
;......
Func _gercheck()


   Local $n2,$1,$2
   GUICreate("Opçao",300,200)
   GUICtrlCreateLabel("Test",150,150)
   $1 = GUICtrlCreateRadio("Version Brazil", 10, 10, 120, 20)
   $2 = GUICtrlCreateRadio("Version España", 10, 40, 120, 20)
   $n2 = GUICtrlCreateButton("Read", 10, 110, 50)
   GUISetState () ; <== Gui visible
    While 1 ; <==loop
        $nMsg = GUIGetMsg() ; <==
        Switch $nMsg ; <==
            Case $n2 ; <==
                If GUICtrlRead ($1) = $GUI_CHECKED Then ; <==You should use GUICtrlRead
                    Global $country = 'BRA' 
                    ExitLoop
                ElseIf GUICtrlRead ($2) = $GUI_CHECKED Then
                    Global $country = 'Espanha' ; <==
                    ExitLoop
                EndIf ; <==
        EndSwitch ; <==
    WEnd ; <==
    
    
EndFunc

I put in the way you left but when you select the version he does not open

the Spanish version, so changing the values,

nothing is in spanish, only the values that are different from the Brazilian

Edited by 10031992

-------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program

Link to comment
Share on other sites

As I told you, use my fun, write some configuration into an INI file nameit "Lang.ini" that's all!! Seems much more practical for me.

If you are determined!

#include <GUIConstants.au3>
$Form1 = GUICreate("Ex", 400, 84, 192, 124)
$Label1 = GUICtrlCreateLabel("Spanish version", 48, 16, 79, 17)
$Radio1 = GUICtrlCreateRadio("", 24, 16, 17, 17)
GUICtrlSetState(-1,$GUI_CHECKED)
$Radio2 = GUICtrlCreateRadio("", 24, 40, 17, 17)
$Label2 = GUICtrlCreateLabel("Brazilian version", 48, 40, 80, 17)
$Button1 = GUICtrlCreateButton("Go", 256, 24, 113, 33, $WS_GROUP)
GUISetState(@SW_SHOW)
While 1
    $Spanish   = GUICtrlRead($Radio1)
    $Brazilian = GUICtrlRead($Radio2)
    If GUICtrlRead($Radio1) = $GUI_CHECKED Then
        $MSG = 'hola mundo'
    ElseIf GUICtrlRead($Radio2) = $GUI_CHECKED Then
        $MSG = 'Olá mundo'
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            MsgBox(0,"",$MSG)
    EndSwitch
WEnd
Link to comment
Share on other sites

>_< It works to me o.o?

If you can put all your code, it can help a lot.

Here is my edited script ,

He does not open either of the versions

#NoTrayIcon;
#include <GUIConstantsEx.au3>;
#include <EditConstants.au3>
#include <Inet.au3>

Opt("guioneventmode", 1);

$version = "v4.4 ";
local $listText, $s_TempText,$country

_Gercheck();


$ID = _MemoryOpen(ProcessExists("Program.exe"));
if $country = 'BRA' Then;
    ;.............
        ;.............
            ;.............
                ;.............
                    ;.............
                        ;.............
ElseIf $country = 'Esp' Then
    ;.............
        ;.............
            ;.............
                ;.............
                    ;.............
                        ;.............
Endif


$form = GUICreate("GOHC " & $country & " My programa  -" & $version, 500, 300); Creates a GUI window
GUISetOnEvent($GUI_EVENT_CLOSE, "onautoitexit"); 
GUISetBkColor(0xFFFFFF); sets the background color to black
$listText = GUICtrlCreateList("    <:::::::():::(} Test             . ", 50, 10, 306, 40, 10) ;
GUICtrlSetFont(-1, 17, 400, 2, "Impact"); font
GUICtrlSetColor(-1, 0x000000); color

While 1
Sleep(250)
     $s_TempText = GUICtrlRead($listText)
     GUICtrlSetData($listText, "|" & StringTrimLeft($s_TempText, 1)  & StringLeft($s_TempText, 1))

;.............
        ;.............
            ;.............
                ;.............
                    ;.............
                        ;.............

WEnd




Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $if_InheritHandle = 1)

   If Not ProcessExists($iv_Pid) Then
       SetError(1)
       Return 0
   EndIf

   Local $ah_Handle[2] = [DllOpen('kernel32.dll')]

   If @error Then
       SetError(2)
       Return 0
   EndIf

   Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', $iv_DesiredAccess, 'int', $if_InheritHandle, 'int', $iv_Pid)

   If @error Then
       DllClose($ah_Handle[0])
       SetError(3)
       Return 0
   EndIf

   $ah_Handle[1] = $av_OpenProcess[0]

   Return $ah_Handle

EndFunc  ;==>_MemoryOpen
Func _MemoryRead($iv_Address, $ah_Handle, $sv_Type = 'dword')

   If Not IsArray($ah_Handle) Then
       SetError(1)
       Return 0
   EndIf

   Local $v_Buffer = DllStructCreate($sv_Type)

   If @error Then
       SetError(@error + 1)
       Return 0
   EndIf

   DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')

   If Not @error Then
       Local $v_Value = DllStructGetData($v_Buffer, 1)
       Return $v_Value
   Else
       SetError(6)
       Return 0
   EndIf

EndFunc  ;==>_MemoryRead
Func _MemoryWrite($iv_Address, $ah_Handle, $v_Data, $sv_Type = 'dword')

   If Not IsArray($ah_Handle) Then
       SetError(1)
       Return 0
   EndIf

   Local $v_Buffer = DllStructCreate($sv_Type)

   If @error Then
       SetError(@error + 1)
       Return 0
   Else
       DllStructSetData($v_Buffer, 1, $v_Data)
       If @error Then
           SetError(6)
           Return 0
       EndIf
   EndIf

   DllCall($ah_Handle[0], 'int', 'WriteProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '')

   If Not @error Then
       Return 1
   Else
       SetError(7)
       Return 0
   EndIf

EndFunc  ;==>_MemoryWrite

Func _gercheck()
Local $n2,$1,$2
   GUICreate("Multi Version",200,100)
    $PublicIP = _GetIP()
GUICtrlCreateLabel("Your IP is: "& $PublicIP,65,5)
   GUICtrlCreateGroup("Choose a version",0,30,200,100)
   $1 = GUICtrlCreateRadio("Version Brazil", 60, 50, 120, 20)
   $2 = GUICtrlCreateRadio("Version España", 60, 69, 120, 20)
   $n2 = GUICtrlCreateButton("Open", 10, 1, 50)
   GUISetState()
   While 1
        Select
            Case $n2 = $1 Or $2
                If $1 = $n2 Then
                    Global $country = 'BRA'
                ElseIf $2 = $n2 Then
                    Global $country = 'Esp'
                EndIf
            EndSelect
    WEnd
EndFunc


Func onautoitexit()
   Exit
EndFunc  ;==>onautoitexit

-------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program

Link to comment
Share on other sites

Ok, thnx for look

If you can put there for me, if you achieve

Thanks

-------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...