Jump to content

doubleclick a shortcut


gouwzee
 Share

Recommended Posts

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!!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

I 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.

Link to comment
Share on other sites

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 by MHz
Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...