salnet Posted September 15, 2013 Share Posted September 15, 2013 (edited) Hello folks, thank you for this board, I've been a long-time reader and learned a lot about AutoIt, but today I've to ask a question. I am about to read some variables and connect them in a Run-string, but due to complexibility I fail. First two row read the variables - variables are saved; I can read them with a message box or something else. But if I insert the variables into the Run function, I can't get them to work. I tried diefferent ways as you can see, but I think there is only a syntax-problem I slighty miss. $vpnconnectusername = ENVGET("USERNAME") $vpnconnectpassword = InputBox("Passwortabfrage", "Bitte geben Sie Ihr Windows-Anmeldekennwort ein:", "", "*") Run(@ComSpec & " /c " & 'rasdial unserVPN $vpnconnectusername $vpnconnectpassword /Phonebook:res\unserVPN.pbk', "", @SW_HIDE) $vpnconnectusername = ENVGET("USERNAME") $vpnconnectpassword = InputBox("Passwortabfrage", "Bitte geben Sie Ihr Windows-Anmeldekennwort ein:", "", "*") Run(@ComSpec & " /c " & 'rasdial unserVPN" & $vpnconnectusername & $vpnconnectpassword & "/Phonebook:res\unserVPN.pbk', "", @SW_HIDE)$vpnconnectusername = ENVGET("USERNAME") $vpnconnectpassword = InputBox("Passwortabfrage", "Bitte geben Sie Ihr Windows-Anmeldekennwort ein:", "", "*") Run(@ComSpec & " /c " & 'rasdial unserVPN " & $vpnconnectusername & " " & $vpnconnectpassword & " /Phonebook:res\unserVPN.pbk', "", @SW_HIDE)$vpnconnectusername = ENVGET("USERNAME") $vpnconnectpassword = InputBox("Passwortabfrage", "Bitte geben Sie Ihr Windows-Anmeldekennwort ein:", "", "*") Run(@ComSpec & " /c " & 'rasdial unserVPN' & $vpnconnectusername & $vpnconnectpassword & '/Phonebook:res\unserVPN.pbk', "", @SW_HIDE)$vpnconnectusername = ENVGET("USERNAME") $vpnconnectpassword = InputBox("Passwortabfrage", "Bitte geben Sie Ihr Windows-Anmeldekennwort ein:", "", "*") Run(@ComSpec & " /c " & 'rasdial unserVPN ' & $vpnconnectusername & ' ' & $vpnconnectpassword & ' /Phonebook:res\unserVPN.pbk', "", @SW_HIDE) Thanks in advance for any help to solve this. Kind regards salnet Edited September 15, 2013 by salnet Link to comment Share on other sites More sharing options...
water Posted September 15, 2013 Share Posted September 15, 2013 Can you replace " /C " (Close) with " /K " (keep) so the DOS window stays open? Might give you better error information. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
salnet Posted September 15, 2013 Author Share Posted September 15, 2013 Ah, thanks a lot water. wWith the K-switch I found a missing space. Link to comment Share on other sites More sharing options...
Valuater Posted September 15, 2013 Share Posted September 15, 2013 Maybe try ShellExecute () also because it allows a perimeter for arguments/variables 8) Link to comment Share on other sites More sharing options...
water Posted September 15, 2013 Share Posted September 15, 2013 Ah, thanks a lot water. wWith the K-switch I found a missing space. Glad you got it working My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
salnet Posted September 20, 2013 Author Share Posted September 20, 2013 Regarding to my solved problem above I got another question. I want to inform my users, if a connection was established or not. This way I am doing this at the moment: $vpnconnectusername = ENVGET("USERNAME") $vpnconnectpassword = InputBox("Password", "Enter your Login-Password:", "", "*") Local $vpnconneting = Run(@ComSpec & " /C " & ' rasdial myVPN ' & $vpnconnectusername & ' ' & $vpnconnectpassword & ' /Phonebook:res\myVPN.pbk', "", @SW_HIDE) Local $vpnconnetingping = Ping("192.168.14.31", 250) If $vpnconnetingping = 1 Then DriveMapAdd ("L:", "\\mydomain.local\Departments") DriveSetLabel ("L:", "Departments") DriveMapAdd ("R:", "\\mydomain.local\Apps") DriveSetLabel ("R:", "Apps") DriveMapAdd ("H:", "\\wvgw.local\dfs\Homes\" & $vpnconnectusername) DriveSetLabel ("H:", "Home") MsgBox(0, "Success", "Connection successful.") Else MsgBox(0, "Error!", "Connection NOT successful: " & @error) EndIf But is won't work. Regardless if the users the input of the password or the connection wasn't established by any reason, the user gets the success-message. Can anybody help me with this? Kind regards salnet Link to comment Share on other sites More sharing options...
water Posted September 20, 2013 Share Posted September 20, 2013 Shouldn't it be If $vpnconnetingping > 0 Then because Ping returns the roundtrip time. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
salnet Posted September 20, 2013 Author Share Posted September 20, 2013 OK, you are right. I changed this. But it still show the incorrect messagebox. Link to comment Share on other sites More sharing options...
water Posted September 20, 2013 Share Posted September 20, 2013 What's the value of Ping and @error after you called function Ping? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now