Jump to content
Sign in to follow this  
Dk3

Help

Recommended Posts

Dk3

Hello everyone.

I just got this script because my cousing told me to look for it, because he couldn't solve my problem.

I would like to ask you how to perform the following operation.

In Windows (XP) Network Connections I have 4 connections. I want to do the following action :

If my internet connection doesn't work, I want to make a program/script which would automatically go to the Network Connections window and "REMOVE FROM BRIDGE" (requires right-click) on a specific connection. After 30 seconds I would love this program to move slightly up where the connection will now locate and again right-click and press "ADD TO BRIDGE".

Is this possible?

- TCK

Share this post


Link to post
Share on other sites
rudi

Hello everyone.

I just got this script because my cousing told me to look for it, because he couldn't solve my problem.

I would like to ask you how to perform the following operation.

In Windows (XP) Network Connections I have 4 connections. I want to do the following action :

If my internet connection doesn't work, I want to make a program/script which would automatically go to the Network Connections window and "REMOVE FROM BRIDGE" (requires right-click) on a specific connection. After 30 seconds I would love this program to move slightly up where the connection will now locate and again right-click and press "ADD TO BRIDGE".

Is this possible?

- TCK

I'd search the hierarchical online help (CMD box) of the windows command line tool "NETSH.EXE", up to now I just used it to alter fixed IP / DHCP / DNS settings and such stuff, but I imagine that your goal might be possible with it as well.

As for your asking to do certain mouse clicks and mouse moovments: Of course this is possible with autoit, even though not the beautiful solution:

Search the help file for the Mouse* topics.

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
Dk3

Thanks for the answer!

I'm quite new to programming so if I'll come across any difficulties I'll post them here ASAP.

- TCK

Share this post


Link to post
Share on other sites
martin

Hello everyone.

I just got this script because my cousing told me to look for it, because he couldn't solve my problem.

I would like to ask you how to perform the following operation.

In Windows (XP) Network Connections I have 4 connections. I want to do the following action :

If my internet connection doesn't work, I want to make a program/script which would automatically go to the Network Connections window and "REMOVE FROM BRIDGE" (requires right-click) on a specific connection. After 30 seconds I would love this program to move slightly up where the connection will now locate and again right-click and press "ADD TO BRIDGE".

Is this possible?

- TCK

To do it the way you asked needs something like this

Local $RUNDLL32 = @SystemDir & "\rundll32.exe"
Run($RUNDLL32 & " shell32.dll,Control_RunDLL ncpa.cpl");

WinWaitActive("Network Connections")
$CPSize = WinGetPos("")
WinMove("Network Connection","",$CPSize[0],$CPSize[1],300,300);set to some size so that it is always the same and the icons are in the same positions.

MouseClick("right",$CPsize[0] + 280, $CPsize[1] + 140);change 280,140 to get the correct position
Sleep(50)
Send("!r");send alt and change the letter to whatever the menu shortcut letter is.
Sleep(100);experiment to see how long is needed.
MouseClick("right",$CPsize[0] + 280, $CPsize[1] + 140);change 280,140 to get the correct position
Send("!r");send alt and change the letter to whatever the menu shortcut letter is.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Paulie

I think you can do it with ControlClick()

#include <GUIListView.au3>
Run(@ComSpec & " /c" & "explorer.exe ::{7007ACC7-3202-11D1-AAD2-00805FC1270E}","",@SW_HIDE)
Do
Sleep(100)
Until WinExists("Network Connections")
$Win = WinGetHandle("Network Connections")
$Hwnd = ControlGetHandle($win, "", "[CLASS:SysListView32; INSTANCE:1]") ;GetListview Handle
_GUICtrlListView_SetView($Hwnd,0)
$idx = _GUICtrlListView_FindText($Hwnd, "Local Area Connection")
Dim $Pos[2] = [_GUICtrlListView_GetItemPositionX ($Hwnd,$idx),_GUICtrlListView_GetItemPositionY ($Hwnd,$idx)]
ControlClick($Win,"", $Hwnd, "Right", 1, $Pos[0]+1, $Pos[1]+1)

This will open the menu, then i guess you can Send() then hotkey to open the item.

I can't figure out how to interact with menus

Edited by Paulie

Share this post


Link to post
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
Sign in to follow this  

×