1
+ Opt (" TrayMenuMode" ,1 )
2
+
3
+ #include < ButtonConstants.au3>
4
+ #include < ComboConstants.au3>
5
+ #include < EditConstants.au3>
6
+ #include < GUIConstantsEx.au3>
7
+ #include < StaticConstants.au3>
8
+ #include < WindowsConstants.au3>
9
+
10
+ #include < Constants.au3>
11
+
12
+ #include < FileConstants.au3>
13
+ #include < MsgBoxConstants.au3>
14
+ #include < WinAPIFiles.au3>
15
+
16
+ #Region ### START Koda GUI section ### Form=C:\Program Files (x86)\AutoIt3\koda_1.7.3.0\Extras\Import\ForceBindIP.kxf
17
+ $ForceBindIP = GUICreate (" ForceBindIP - By IX JB" , 627 , 429 , - 1 , - 1 )
18
+ $Group_appAddress = GUICtrlCreateGroup (" Application Address" , 16 , 16 , 593 , 153 )
19
+ $Button_runApp = GUICtrlCreateButton (" Run Application" , 240 , 120 , 123 , 25 )
20
+ $Input_appAddress = GUICtrlCreateInput (" Application Address" , 32 , 72 , 553 , 21 )
21
+ $Combo_internetSelect = GUICtrlCreateCombo (" Select Internet Connection" , 32 , 40 , 553 , 25 )
22
+ $Radio_x86 = GUICtrlCreateRadio (" x86" , 440 , 112 , 113 , 17 )
23
+ $Radio_x64 = GUICtrlCreateRadio (" x64" , 440 , 136 , 113 , 17 )
24
+ GUICtrlCreateGroup (" " , - 99 , - 99 , 1 , 1 )
25
+ $Group_Quick = GUICtrlCreateGroup (" Quick Access" , 16 , 176 , 593 , 209 )
26
+ $Button1 = GUICtrlCreateButton (" " , 40 , 200 , 91 , 25 )
27
+ $Button2 = GUICtrlCreateButton (" " , 192 , 200 , 91 , 25 )
28
+ $Button3 = GUICtrlCreateButton (" " , 352 , 200 , 91 , 25 )
29
+ $Button4 = GUICtrlCreateButton (" " , 496 , 200 , 91 , 25 )
30
+ $Button5 = GUICtrlCreateButton (" " , 40 , 240 , 91 , 25 )
31
+ $Button6 = GUICtrlCreateButton (" " , 192 , 240 , 91 , 25 )
32
+ $Button7 = GUICtrlCreateButton (" " , 352 , 240 , 91 , 25 )
33
+ $Button8 = GUICtrlCreateButton (" " , 496 , 240 , 91 , 25 )
34
+ $Button9 = GUICtrlCreateButton (" " , 40 , 280 , 91 , 25 )
35
+ $Button10 = GUICtrlCreateButton (" " , 192 , 280 , 91 , 25 )
36
+ $Button11 = GUICtrlCreateButton (" " , 352 , 280 , 91 , 25 )
37
+ $Button12 = GUICtrlCreateButton (" " , 496 , 280 , 91 , 25 )
38
+ $Button_downloadConfig = GUICtrlCreateButton (" Download and Config ForceBindIP" , 40 , 344 , 203 , 25 )
39
+ $Button_Config = GUICtrlCreateButton (" Config" , 432 , 344 , 155 , 25 )
40
+ GUICtrlCreateGroup (" " , - 99 , - 99 , 1 , 1 )
41
+ $Label_copyRight = GUICtrlCreateLabel (" IX JB" , 520 , 400 , 84 , 17 )
42
+ $Label_Internet = GUICtrlCreateLabel (" Select Internet Connection" , 16 , 400 , 474 , 17 )
43
+ GUISetState (@SW_SHOW )
44
+ #EndRegion ### END Koda GUI section ###
45
+
46
+
47
+ ; Vars
48
+ Global $cFilePath = @ScriptDir & " \ForceBindIP-config.ini"
49
+
50
+ If FileExists ($cFilePath ) = False Then
51
+ createIniFile() ; Create config.ini
52
+ EndIf
53
+
54
+ GetInternet()
55
+ setIniName()
56
+
57
+ While 1
58
+ $nMsg = GUIGetMsg ()
59
+
60
+ Switch $nMsg
61
+
62
+ Case $GUI_EVENT_CLOSE
63
+ Exit
64
+
65
+ Case $Button_runApp
66
+ If GUICtrlRead ($Input_appAddress ) <> " " Then
67
+ runCMD(GUICtrlRead ($Input_appAddress ))
68
+ Else
69
+ MsgBox (0 ," Input Can Not Be Empty" ," Please Enter Valid Data..." )
70
+ EndIf
71
+
72
+ Case $Button1
73
+ $iniX = getIniX(" Button1" )
74
+ runQuickCMD(getIniAddress(" Button1" ))
75
+
76
+ Case $Button2
77
+ $iniX = getIniX(" Button2" )
78
+ runQuickCMD(getIniAddress(" Button2" ))
79
+
80
+ Case $Button3
81
+ $iniX = getIniX(" Button3" )
82
+ runQuickCMD(getIniAddress(" Button3" ))
83
+
84
+ Case $Button4
85
+ $iniX = getIniX(" Button4" )
86
+ runQuickCMD(getIniAddress(" Button4" ))
87
+
88
+ Case $Button5
89
+ $iniX = getIniX(" Button5" )
90
+ runQuickCMD(getIniAddress(" Button5" ))
91
+
92
+ Case $Button6
93
+ $iniX = getIniX(" Button6" )
94
+ runQuickCMD(getIniAddress(" Button6" ))
95
+
96
+ Case $Button7
97
+ $iniX = getIniX(" Button7" )
98
+ runQuickCMD(getIniAddress(" Button7" ))
99
+
100
+ Case $Button8
101
+ $iniX = getIniX(" Button8" )
102
+ runQuickCMD(getIniAddress(" Button8" ))
103
+
104
+ Case $Button9
105
+ $iniX = getIniX(" Button9" )
106
+ runQuickCMD(getIniAddress(" Button9" ))
107
+
108
+ Case $Button10
109
+ $iniX = getIniX(" Button10" )
110
+ runQuickCMD(getIniAddress(" Button10" ))
111
+
112
+ Case $Button11
113
+ $iniX = getIniX(" Button11" )
114
+ runQuickCMD(getIniAddress(" Button11" ))
115
+
116
+ Case $Button12
117
+ $iniX = getIniX(" Button12" )
118
+ runQuickCMD(getIniAddress(" Button12" ))
119
+
120
+ Case $Button_Config
121
+ ShellExecute ($cFilePath )
122
+
123
+ Case $Button_downloadConfig
124
+ GetFileDownload()
125
+ ShellExecute (" ForceBindIP - Download.exe" )
126
+
127
+ Case $Combo_internetSelect
128
+ $ComboString = GUICtrlRead ($Combo_internetSelect )
129
+ $iPosition = StringInStr ($ComboString , " {" )
130
+ $iPosition = $iPosition - 1
131
+ $sString = StringTrimLeft ($ComboString ,$iPosition )
132
+ GUICtrlSetData ($Label_Internet ,$sString )
133
+
134
+ EndSwitch
135
+ WEnd
136
+
137
+
138
+
139
+
140
+ Func getIniName($section ,$param )
141
+
142
+ ; Ini Array
143
+ Local $iArray = IniReadSection ($cFilePath , $section )
144
+ $name = $iArray [1 ][1 ] ; Name
145
+ GUICtrlSetData ($param ,$name )
146
+
147
+ EndFunc
148
+
149
+
150
+ Func getIniAddress($section )
151
+
152
+ ; Ini Array
153
+ Local $iArray = IniReadSection ($cFilePath , $section )
154
+ $address = $iArray [2 ][1 ] ; Address
155
+ Return $address
156
+
157
+ EndFunc
158
+
159
+
160
+ Func getIniX($section )
161
+
162
+ ; Ini Array
163
+ Local $iArray = IniReadSection ($cFilePath , $section )
164
+ $x = $iArray [3 ][1 ] ; X
165
+ Return $x
166
+
167
+ EndFunc
168
+
169
+
170
+ Func setIniName()
171
+
172
+ getIniName(" Button1" ,$Button1 )
173
+ getIniName(" Button2" ,$Button2 )
174
+ getIniName(" Button3" ,$Button3 )
175
+ getIniName(" Button4" ,$Button4 )
176
+ getIniName(" Button5" ,$Button5 )
177
+ getIniName(" Button6" ,$Button6 )
178
+ getIniName(" Button7" ,$Button7 )
179
+ getIniName(" Button8" ,$Button8 )
180
+ getIniName(" Button9" ,$Button9 )
181
+ getIniName(" Button10" ,$Button10 )
182
+ getIniName(" Button11" ,$Button11 )
183
+ getIniName(" Button12" ,$Button12 )
184
+
185
+ EndFunc
186
+
187
+
188
+ Func createIniFile()
189
+
190
+ For $i = 1 To 12 Step 1
191
+ IniWrite ($cFilePath , " Button" & $i , " Name" , " Button" & $i )
192
+ IniWrite ($cFilePath , " Button" & $i , " Address" , " " & @CRLF )
193
+ ; ~ IniWrite ($cFilePath , "Button" & $i , "X", "" & @CRLF)
194
+ Next
195
+
196
+ EndFunc
197
+
198
+
199
+ Func GetInternet ()
200
+
201
+ ; Get WMI
202
+ $wbemFlagReturnImmediately = 0x10
203
+ $wbemFlagForwardOnly = 0x20
204
+ $colItems = " "
205
+ $strComputer = " localhost"
206
+ $Output = " "
207
+ $objWMIService = ObjGet (" winmgmts:\\" & $strComputer & " \root\CIMV2" )
208
+ $colItems = $objWMIService .ExecQuery(" SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID != NULL" , " WQL" , $wbemFlagReturnImmediately + $wbemFlagForwardOnly )
209
+
210
+ If IsObj ($colItems ) then
211
+ For $objItem In $colItems
212
+ If $objItem .NetEnabled = True Then
213
+ GUICtrlSetData ($Combo_internetSelect , " (" & $objItem .NetConnectionID & " ) " & $objItem .Name & " --- " & $objItem .GUID)
214
+ EndIf
215
+ Next
216
+ Else
217
+ Msgbox (0 ," WMI Output" ," No WMI Objects Found for class: " & " Win32_NetworkAdapter" )
218
+ Endif
219
+
220
+ EndFunc
221
+
222
+
223
+ Func runCMD($address )
224
+
225
+ If (GUICtrlRead ($Radio_x86 ) = 1 ) Then
226
+ Run (" cmd /c ForceBindIP -i " & GUICtrlRead ($Label_Internet ) & ' ' & $address ," " , @SW_HIDE )
227
+ ElseIf (GUICtrlRead ($Radio_x64 ) = 1 ) Then
228
+ Run (" cmd /c ForceBindIP64 -i " & GUICtrlRead ($Label_Internet ) & ' ' & $address ," " , @SW_HIDE )
229
+ Else
230
+ MsgBox (1 ," Select One Option" , " Please Select One Option" )
231
+ EndIf
232
+
233
+ EndFunc
234
+
235
+
236
+ Func runQuickCMD($address )
237
+
238
+ If ($iniX = " 86" ) Then
239
+ Run (" cmd /c ForceBindIP -i " & GUICtrlRead ($Label_Internet ) & ' ' & $address ," " , @SW_HIDE )
240
+ ElseIf ($iniX = " 64" ) Then
241
+ Run (" cmd /c ForceBindIP64 -i " & GUICtrlRead ($Label_Internet ) & ' ' & $address ," " , @SW_HIDE )
242
+ Else
243
+ MsgBox (1 ," x64 / x86 Not Set" , " Please Set 86 or 64 In X Section From Config File" )
244
+ EndIf
245
+
246
+ EndFunc
247
+
248
+
249
+ Func GetFileDownload()
250
+
251
+ If FileExists (@ScriptDir & " \ForceBindIP - Download.exe" ) Then ; System64
252
+ Return Null
253
+ Else
254
+ InetGet ( " https://raw.githubusercontent.com/ixjb94/ForceBindIP-Gui/master/dist/ForceBindIP%20-%20Download.exe" , " ForceBindIP - Download.exe" ) ; Download
255
+ EndIf
256
+
257
+ EndFunc
0 commit comments