gouwzee Posted February 25, 2008 Posted February 25, 2008 I have a rasdial (dial-up) connection that oftentimes will return an error when called programmatically. When launched manually, it will always run just fine. I am new at autoit, but I suspect this question must be straightforward: I just want to emulate the manual launching by double-clicking a shortcut to the dial-up connection. Can anybody outline me how that would be written in autoit script? Thanks!!
IvanCodin Posted February 25, 2008 Posted February 25, 2008 This has no error checking but you script at a bare minimum would be like this: #include <process.au3> Run("rasdial C2") Where C2 in the RAS DUN connection nmae you created in the Network Control panel. CC
botanic Posted February 25, 2008 Posted February 25, 2008 I recomend shellexecute instade of run because run can be problematic with some prorams
MHz Posted February 25, 2008 Posted February 25, 2008 I recomend shellexecute instade of run because run can be problematic with some proramsCan you explain these problems so we can learn from the statement made?
gouwzee Posted February 25, 2008 Author Posted February 25, 2008 Can you explain these problems so we can learn from the statement made?Sure: when I use the shellexecute approach (ie. "radial <phonebookname>") I will often receive error 623: phonebook entry does not exist. The helpfile states this error may also occur when another process is using the phonebook entry. I am using a Huawei E220 USB UMTS modem, which has a virtual CD-rom with software auto-installer included. This software often also auto-launches when invoking the RAS connection.The peculiar thing is: when manually launching the dial-up the error never occurs.
gouwzee Posted February 25, 2008 Author Posted February 25, 2008 This has no error checking but you script at a bare minimum would be like this:#include <process.au3>Run("rasdial C2")Thanks IvanCodin. May I assume the process.au3 include is part of the standard autoit libraries?
gouwzee Posted February 25, 2008 Author Posted February 25, 2008 This has no error checking but you script at a bare minimum would be like this:#include <process.au3>Run("rasdial C2")Where C2 in the RAS DUN connection nmae you created in the Network Control panel.CCI now understand that this is actually a scripted shell command. That is not going to work unfortunately. I really want to simulate me hand starting that dial-up session. Auto-it really appears as an "XP GUI macro maker" so it should be easy (feasible at least) to simulate a doubleclick on a shortcut (ie. .lnk) file.
FreeFry Posted February 25, 2008 Posted February 25, 2008 I guess you could perhaps use ShellExecute on the shortcut? that should work
gouwzee Posted February 26, 2008 Author Posted February 26, 2008 I guess you could perhaps use ShellExecute on the shortcut? that should work not sure how that syntax would look like Run("dialup.lnk") doesn't do the job
MHz Posted February 26, 2008 Posted February 26, 2008 (edited) Well here are some examples to try. Something may work. I have automated Rasphone OK before so you can see what is going on with it. ; Automate rasphone FileCreateShortcut(@SystemDir & '\rasphone.exe', @DesktopDir & '\Dialup.lnk') ShellExecute('"' & @DesktopDir & '\Dialup.lnk"') ; or perhaps run shortcut of rasdial FileCreateShortcut(@SystemDir & '\rasdial.exe', @DesktopDir & '\Dialup.lnk', @SystemDir, 'C2') ShellExecute('"' & @DesktopDir & '\Dialup.lnk"') ; or perhaps execute rasdial Run('"' & @SystemDir & '\rasdial.exe" C2', @TempDir, @SW_HIDE) ; or perhaps shellexecute rasdial ShellExecute('"' & @SystemDir & '\rasdial.exe"', 'C2', @TempDir) Edit: Replace "C2" with the connection name. Edited February 26, 2008 by MHz
IvanCodin Posted March 28, 2008 Posted March 28, 2008 Try this. Determine what the actual ras connection name is. I'll assume from your description it's called dialup. Then run this script: CODE#include <Process.au3> $RET = _RunDOS("rasdial dialup") Switch $RET Case 720 MsgBox(16, "RAS Error", "Login script error", 3) Case 680 MsgBox(16, "RAS Error", "No dialtone", 3) Case 678 MsgBox(16, "RAS Error", "There was no answer", 3) Case 677 MsgBox(16, "RAS Error", "A person answered instead of a modem", 3) Case 676 MsgBox(16, "RAS Error", "Line is busy", 3) Case 0 MsgBox(32, "RAS Info", "The RAS connection was successful", 3) Case Else MsgBox(16, "RAS Error", "An unknown error has occured", 3) EndSwitch Let me know if this does the trick for you. CC
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