|
| 1 | +#SingleInstance, Force |
| 2 | + |
| 3 | + |
| 4 | +; ########################### Copy Commands Button Variables ################################# |
| 5 | +; |
| 6 | +; ######### Networking Tab ####### |
| 7 | +Network_Button_1 = ipconfig /all |
| 8 | + |
| 9 | +; ##################################### GUI Design #################################### |
| 10 | +Gui, Add, Text,, Enter VPN Name |
| 11 | +Gui, Add, Edit, W180 vVPNNAME, VPN |
| 12 | + |
| 13 | +Gui, Add, Text,, Enter Server Address |
| 14 | +Gui, Add, Edit, W180 vVPNADDRESS |
| 15 | + |
| 16 | +Gui, Add, Text,, Enter Pre-Shared Key |
| 17 | +Gui, Add, Edit, W180 vSECRETKEY |
| 18 | + |
| 19 | +Gui, Add, Button, gCopy, COPY |
| 20 | + |
| 21 | + |
| 22 | +Gui, Show, W200 H210, Copy Add VPN Command ; Display GUI |
| 23 | +return ; End of auto-execute section. The script is idle until the user does something. |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +; ################ Copy Button Output ################## |
| 29 | +Copy: ; Enter what the button will do below |
| 30 | + |
| 31 | + |
| 32 | +GuiControlGet, VPNNAME,, %VPNNAME% ; Get the data from the button that was presses |
| 33 | +GuiControlGet, VPNADDRESS,, %VPNADDRESS% ; Get the data from the button that was presses |
| 34 | +GuiControlGet, SECRETKEY,, %SECRETKEY% ; Get the data from the button that was presses |
| 35 | + |
| 36 | + |
| 37 | +Clipboard = Add-VpnConnection -AllUserConnection -Name `"%VPNNAME%`" -ServerAddress %VPNADDRESS% -TunnelType L2tp -EncryptionLevel Optional -AuthenticationMethod PAP -L2tpPsk `"%SECRETKEY%`" -Force -PassThru |
| 38 | + |
| 39 | + |
| 40 | + MsgBox, 32, Copied Command to Clipboard, Add-VpnConnection -AllUserConnection -Name `"%VPNNAME%`" -ServerAddress %VPNADDRESS% -TunnelType L2tp -EncryptionLevel Optional -AuthenticationMethod PAP -L2tpPsk `"%SECRETKEY%`" -Force -PassThru, 2 |
| 41 | + ExitApp |
| 42 | + |
| 43 | + ; Reload the GUI |
| 44 | +return |
| 45 | + |
| 46 | +; Close Button, Exit Script |
| 47 | +GuiClose: |
| 48 | +GuiEscape: |
| 49 | + ExitApp |
| 50 | + |
| 51 | + |
0 commit comments