XP: Call "Connection" Services, Log on to DSL Inte

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Scottt
Newbie
Posts: 3
Joined: Fri Sep 01, 2006 7:51 pm
Location: Alaska USA

XP: Call "Connection" Services, Log on to DSL Inte

Post by Scottt » Fri Sep 01, 2006 8:10 pm

Hello all,

Can anyone help me with a script to enable my Lan connection, & call up the DSL connection from "Network Connections"?

I'm using mouse commands on the start menu now, and, naturally, as my start menu changes the mouse commands become erroneous.

Running XP Professional.

To manually log on to the Internet DSL, I enable the LAN, then click the DSL shortcut to log on to the Service Provider.


Thanks,

Scot

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Sep 01, 2006 8:18 pm

Hi Scott....

From what you have described, this should not be too difficult to do with Macro Scheduler.

There are many here who will gladly help you to debug your scripts. But most prefer to HELP, not to do all the work.

Use the tutorial, read the Help, Check out the samples.
Submit your script, explain what is not working, where you are having problems, etc. And before you know it, YOU will have created a working script to solve your problem.

How to proceed:
Write out the steps that you are taking with the mouse/keyboard.
Turn on the macro recorder.
Follow your steps
Stop the recorder
Edit the script as needed (Read the Help sections for each line).

Strongly suggest you use keystrokes, tabs, sh-tab, etc. vs mouse when you can. May be easier to execute, easier to read.

Good luck, waiting to see how we can help.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Sep 01, 2006 9:16 pm

Some tips:

1. Clicking a shortcut on the start menu, or anywhere else in Windows is just a long winded way of opening a file, or starting an application. Find out what that application or file is and you can avoid all the mouse clicking by starting it directly. You can right click on a shortcut to see what it's target is.

2. See this ole tip 'ere for how to start control panel applets:
http://www.mjtnet.com/forum/viewtopic.php?t=1584

3. Control Panel applets are .cpl files. In XP you can execute them directly. This opens Network Connections: ExecuteFile>ncpa.cpl

So you might do something like this:

ExecuteFile>ncpa.cpl
WaitWindowOpen>Network Connections
SetFocus>Network Connections
..
.. and now send keystrokes as required
.. (no need to use the mouse)
..
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Scottt
Newbie
Posts: 3
Joined: Fri Sep 01, 2006 7:51 pm
Location: Alaska USA

execuing *.cpl-Loging on Inernet DSL

Post by Scottt » Sat Sep 02, 2006 1:32 am

Thanks Mark,

I tried the ExecuteFile>ncpa.cpl and got "Network Connections" up.

I can't seem to get straight to my "MTA DSL" or "Local Area Connection 6" (LAN). though.
I tried:
ExecuteFile>C:\Documents and Settings\All Users\Desktop\MTA DSL
ExecuteFile>C:\Documents and Settings\XP\Desktop\Local Area Connection 6.cpl
with *.cpl on and off.

I did make a Win Global Hotkey for the Shortcuts MTA.. & Local....
I then did:
Let>SK_LEGACY=1
Press LCTRL
Press LALT
Send Character/Text>3
Release LAlt
Release LCTRL
WaitWindowOpen>Local Area Connection 6
WaitWindowClosed>Local Area Connection 6
Wait>1.5

AND THEN FOR THE DSL................

Press LCTRL
Press LALT
Send Character/Text>4
Wait>.1
Release LAlt
Release LCTRL

Wait>.05
WaitWindowOpen>Connect MTA DSL
Remark>MessageModal>After WaitWindow opn MTA DSL, before pres entr
SetFocus>Connect MTA DSL
Press Enter
WaitWindowClosed>Connect MTA DSL
Remark>Wait>2.0

WaitWindowOpen>Connecting MTA DSL...
SetFocus>Connecting MTA DSL...
WaitWindowClosed>Connecting MTA DSL...
Wait>.05

Run Program>C:\Program Files\DU Meter\DUMeter.exe
WaitWindowOpen>DU Meter
MoveWindow>DU Meter,1028,-24
ResizeWindow>DU Meter,150,90
END

Had problems with the Ctrl+Alt commands, and so added:
Let>SK_LEGACY=1
I think it helped!
Macro would freeze at the Ctrl+Alt commands?

Anyway, is there an extension for these "programs" or do they have to be called through the registry?

thanks again,

Scot

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Sep 02, 2006 3:46 am

I am confused about where and when you are having problems. Not sure what code is working and where real comments are.

In any case, I have one observation that may not mean anything:

I usually find it is OK to just use CTRL/ALT and not need to be so specific re Left/Right key. Is this necessary? Maybe this is OK:

Code: Select all

Press CTRL
Press ALT
I don't think you need SK_LEGACY unless you are using Citrix or DOS.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sat Sep 02, 2006 8:06 am

Hi,

You can just type the connection you want into the address bar of the Network Connections window. Try this (manually first):

- Open Network Connections
- In the address bar enter the full name of one of your connections
- Press Enter
- The status window will appear
- Click Properties and the properties open up.

So we now have the basis of a script:

ExecuteFile>ncpa.cpl
WaitWindowOpen>Network Connections
SetFocus>Network Connections
Press Tab
Send>Local Area Connection
Press Enter
WaitWindowOpen>Local Area Connection Status
Press ALT
Send>p
Release ALT
WaitWindowOpen>Local Area Connection Properties

This opens connection properties for a connection. Now, I don't exactly know what you want to do here, and your connection names are different to mine, but this should give you everything you need to complete your script.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Scottt
Newbie
Posts: 3
Joined: Fri Sep 01, 2006 7:51 pm
Location: Alaska USA

Net Connections instead of Cntrl/Alt

Post by Scottt » Sun Sep 03, 2006 4:21 am

Hi Mark & Bob,

Thanks again for the Posts.

I went ahead and called "Network Connections" and worked from that window to accomplish the Log-On & Log-Off tasks.
This seems to work fine.

The old script with the Ctrl/Alt commands still hangs at the Ctrl/Alt spots.
It stops the whole computer, the blinking Macro Icon even stops blinking.
But after 30 to 60 seconds it usually executes the Ctrl/Alt. And the script works.

Anyway, I now have a 1 button task for the old 3 button & Wait scenario. I had to fire up the LAN & the DSL + I run DUmeter to count gigs. (Du meter can't start accurately until the Inet is logged on)

I do still have troubles in other Scripts, with the "WaitWindow" commands. Any tricks?



thanks again,


Scot

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Sun Sep 03, 2006 8:45 am

Troubles with WaitWindowOpen? By default WaitWindowOpen will wait for ever for the window you have specified to appear. So, if your script waits for ever (i.e. appears to hang - it hasn't - it is waiting dutifully) you have either specified a window which never appears or put the command in the wrong place. Ensure the window title is correct, and ensure you use it immediately after some code which causes the new window to appear. Try this example:

Run>notepad.exe
WaitWindowOpen>Untitled - Notepad
SetFocus>Untitled - Notepad
Send>Hello World

Works fine. But this will hang for ever:

Run>notepad.exe
WaitWindowOpen>Untitled -

But you can use a partial match in the window title:

Run>notepad.exe
WaitWindowOpen>notepad*

Now, if you have the opposite problem - the command is not waiting long enough, then that will be because it is finding a matching window that is already present. E.g. the above could find some other window whose title contains the string "notepad" which may not be the window that we actually want to wait for. So it pays to try to be more specific. It could even find a hidden window - Windows is full of them. You could prevent that by setting WF_TYPE to 2:

Let>WF_TYPE=2
WaitWindowOpen>notepad*

For situations where the window doesn't always appear you could set a timeout:

Let>WW_TIMEOUT=30
WaitWindowOpen>notepad*
If>WW_RESULT=FALSE
//timed out
Else
//ok, it exists, set focus to it etc
Endif

I hope that explains how it works. Trust me - WaitWindowOpen is as solid as a rock, has been tried and tested since 1997. If you are having a problem with it, it will be due to some error or consideration in your script. If you have a problem feel free to post your script. First though, I would encourage you to read this:
http://www.mjtnet.com/blog/2006/01/17/h ... on-script/

Also read Scripting Windows for Beginners in the help file.

Also for narrowing down on problems learn how to use the debugger:
http://www.mjtnet.com/blog/2006/05/17/use-the-debugger/

And then if still none the wiser post details here and we'll help you get your script running.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts