Что нового

Вывод IP в input через button

mazix

Новичок
Сообщения
7
Репутация
0
Добрый день,
Прошу помощи, все никак не могу понять как встроить уже созданный скрип в лаунчер.
Было бы просто замечательно, если бы он без кнопки выдавал в input, IP-шник.

Версия AutoIt: 3.3.12.0

Код:
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $IP = GUICtrlRead($Input1)
            $Port = GUICtrlRead($Input2)
            $Nick = GUICtrlRead($Input4)
            IniWrite("Binaries/Win32/lumaemu.ini", "Steam2Wrapper", "GameExe", "UDK.exe " & $IP & ":" & $Port)
            IniWrite("Binaries/Win32/lumaemu.ini", "Player", "PlayerName", $Nick)
            ShellExecute("UDK.exe","","Binaries\Win32")
		 Case $Button2
			ShellExecute("ServerUDK.exe","","Binaries\Win32")

    EndSwitch
WEnd


Вот этот скрипт я пытаюсь вставить, но мои попытки тщетны.

Код:
#include <inet.au3>
#include <guibutton.au3>
#include <guitoolbar.au3>
#include <GUIConstantsEX.au3>

$YourIP = _GetIP()
GUICreate("ip fainder", 318, 84, 294, 169)
$Button3 = GUICtrlCreateButton("Мой IP", 201, 30, 62, 30)
$Input3 = GUICtrlCreateInput("Тут появится ип", 17, 31, 138, 20)
$Label3 = GUICtrlCreateLabel("Ваш ип", 19,14,284,15)
GUISetState(@SW_SHOW)

While 2

	$Msg = GUIGetMsg()
	if $msg=-3 Then Exit
	if $msg=$button3 Then button3()
	WEnd

	func button3()
	   GUICtrlSetData($input3, $yourIP)
	   MsgBox(0,"ip","Ну вот и все!")
EndFunc


Пробовал сделать так, но ничего не вышло))

Код:
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $IP = GUICtrlRead($Input1)
            $Port = GUICtrlRead($Input2)
            $Nick = GUICtrlRead($Input4)
            IniWrite("Binaries/Win32/lumaemu.ini", "Steam2Wrapper", "GameExe", "UDK.exe " & $IP & ":" & $Port)
            IniWrite("Binaries/Win32/lumaemu.ini", "Player", "PlayerName", $Nick)
            ShellExecute("UDK.exe","","Binaries\Win32")
		 Case $Button2
			ShellExecute("ServerUDK.exe","","Binaries\Win32")
		 Case $Button3
            	if $msg=-3 Then Exit
	if $msg=$button3 Then button3()

    EndSwitch
WEnd
	func button3()
	   GUICtrlSetData($input3, $yourIP)
	   MsgBox(0,"ip","Ну вот и все!")
EndFunc


Про "это" я само собой не забывал :smile:

Код:
#include <inet.au3>
#include <guibutton.au3>
#include <guitoolbar.au3>
#include <GUIConstantsEX.au3>

$YourIP = _GetIP()

Премного благодарен всем, кто уделил свое время!
 

_dron_

Знающий
Сообщения
84
Репутация
8
А можно весь скрип полностью (просто не понятно что куда нужно записать)
 
Автор
mazix

mazix

Новичок
Сообщения
7
Репутация
0
_dron_ сказал(а):
А можно весь скрип полностью (просто не понятно что куда нужно записать)

Конечно. :smile:

Код:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### 
$Form1 = GUICreate("Launcher", 622, 400, 619, 257)
$Label1 = GUICtrlCreateLabel("Game", 85, 24, 449, 65)
GUICtrlSetFont(-1, 40, 800, 0, "Times New Roman")
$Button1 = GUICtrlCreateButton("Запустить игру", 144, 184, 329, 65)
GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman")
$Button2 = GUICtrlCreateButton("Создать свой сервер", 143, 303, 329, 65)
GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman")
GUICtrlSetTip(-1, "Порт 7777")
$Input1 = GUICtrlCreateInput("Введите IP сервера", 156, 143, 169, 29)
GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman")
$Input2 = GUICtrlCreateInput("Порт", 353, 143, 97, 29)
GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman")
GUICtrlSetTip(-1, "Стандартный порт 7777")
$Label2 = GUICtrlCreateLabel(":", 333, 141, 12, 32, $SS_CENTER)
GUICtrlSetFont(-1, 17, 800, 0, "Tahoma")
$Input3 = GUICtrlCreateInput("Ваш IP", 164, 261, 169, 29, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman")
$Button3 = GUICtrlCreateButton("Получить IP", 344, 254, 97, 41)
GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman")
$Label3 = GUICtrlCreateLabel("текст", 0, 0, 163, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Label4 = GUICtrlCreateLabel("текст", 468, 0, 153, 19)
GUICtrlSetFont(-1, 10, 400, 0, "Times New Roman")
$Input4 = GUICtrlCreateInput("Ваш ник в игре", 213, 102, 185, 29, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
GUICtrlSetFont(-1, 14, 400, 0, "Times New Roman")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $IP = GUICtrlRead($Input1)
            $Port = GUICtrlRead($Input2)
            $Nick = GUICtrlRead($Input4)
            IniWrite("Binaries/Win32/lumaemu.ini", "Steam2Wrapper", "GameExe", "UDK.exe " & $IP & ":" & $Port)
            IniWrite("Binaries/Win32/lumaemu.ini", "Player", "PlayerName", $Nick)
            ShellExecute("UDK.exe","","Binaries\Win32")
		 Case $Button2
			ShellExecute("ServerUDK.exe","","Binaries\Win32")

    EndSwitch
WEnd
 

C2H5OH

AutoIT Гуру
Сообщения
1,473
Репутация
333
Код:
$YourIP = _GetIP()
$Input3 = GUICtrlCreateInput($YourIP, 164, 261, 169, 29, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER))
 

_dron_

Знающий
Сообщения
84
Репутация
8
включить заголовочный файл.
Код:
#include <inet.au3>
$YourIP = _GetIP()


Код:
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $IP = GUICtrlRead($Input1)
            $Port = GUICtrlRead($Input2)
            $Nick = GUICtrlRead($Input4)
            IniWrite("Binaries/Win32/lumaemu.ini", "Steam2Wrapper", "GameExe", "UDK.exe " & $IP & ":" & $Port)
            IniWrite("Binaries/Win32/lumaemu.ini", "Player", "PlayerName", $Nick)
            ShellExecute("UDK.exe","","Binaries\Win32")
         Case $Button2
            ShellExecute("ServerUDK.exe","","Binaries\Win32")
         Case $Button3;<<<<<добавить
            GUICtrlSetData($Input3, $YourIP) ;<<<<добавить 
            ;GUICtrlSetData($Input3, _GetIP()) ;<<<<или так если Ip нужно только вывести на экран

    EndSwitch
WEnd
 
Автор
mazix

mazix

Новичок
Сообщения
7
Репутация
0
Спасибо всем большое ! :smile:
 
Верх