Sign in to follow this  
Followers 0
/dev/null

how to start a tray application

5 posts in this topic

Hi,

is it possible to start an application (enlarge the window and bring it to the front)

that sits in the system tray? Using keystrokes or mouse clicks does not work, as

I don't know the exact position of the tool (which might even change). I searched

the forum and docs, but could not find a hint.

Acutally I want to start the "Wireless Network Connections" tool from WinXP, which shows me the available WLANs.´

If it's not possible to start a tray application, is there another way to start the

WinXP "wireless network connections" tool?

Thanx

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites



Until a better solution is found (assumes XP SP2):

$title = "Network Connections"
$adapter = "Wireless Network Connection"

Run("control.exe ncpa.cpl")
WinWait($title)
ControlListView($title, "", "SysListView321", "Select", ControlListView($title,"","SysListView321","FindItem",$adapter) )
WinWaitActive($title)
ControlSend($title, "", "SysListView321", "+{F10}v")
WinClose($title)


Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Until a better solution is found (assumes XP SP2)

Works great. Thanx!


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

G'day!

Until a better solution is found (assumes XP SP2):

$title = "Network Connections"
$adapter = "Wireless Network Connection"

Run("control.exe ncpa.cpl")
WinWait($title)
...
I tried to make nearly the same - it is necessary to change one of the option in LAN adapter. My code is very similar to your but I've wrote it without any assistance :( :

$titleN = "Network and Dial-up Connections"
$LAN = "Local Area Connection"
$LANP = "Local Area Connection Properties"

Run("control ncpa.cpl")

$t=WinWait($titleN, "", 60)
If $t = 0 Then
  MsgBox(0, "Error", "Timeout!")
  Exit
EndIf

WinWait($titleN)
Sleep(500)
WinActivate($titleN)

ControlListView($titleN, "", "SysListView321", "Select", ControlListView($titleN, "", "SysListView321", "FindItem", $LAN))
If @error = 1 Then
  MsgBox(0, "Error", "Not selected!")
  Exit
EndIf

WinActivate($titleN)
$t=ControlSend($titleN, "", "SysListView321", ""+{F10}r"")
If $t = 0 Then
  MsgBox(0, "Error", "Can't to send!")
  Exit
EndIf

$t=WinWait($LANP, "", 10)
If $t = 0 Then
  MsgBox(0, "Error", "Timeout!")
  Exit
EndIf

WinSetState($LANP, "", @SW_HIDE)
ControlSend($LANP, "", "SysListView321", "NWLink Net{Space}{Space}")
ControlSend($LANP, "", 1, "{Space}")
WinClose($titleN)

What trouble: sometime after selecting $LAN don't make next ControlSend (must to send "+{F10}r" to select P&roperties) and I've get timeout for opening $LANP. Look like ControlSend sometime send characters as if $LAN was NOT selected (as if I click right mouse button on empty space into "Network and Dial-up Connections" window). Or sometime this characters was send as if into "emptiness" - absolutely nothing happen after selection :( .

If I try to run script (or compiled exe, it is unimportant) few times one after another - it's works. But if machine is relatively heavy loaded (and if when my script run from startup folder after booting) - I've get this trouble - missed "+{F10}r" characters after selection $LAN. I tried to change "+{F10}r" on equivalent (for me) "!fr" - without success. Where I'm wrong?

TIA,

Sergei

Share this post


Link to post
Share on other sites

G'day!

Hmm, nobody know? Seem I've find some workaround by setting more delay between sent keystrokes and plus minimizing all windows before run NCPA.CPL:

Opt("SendKeyDelay", 100)
...
WinMinimizeAll()
Sleep(100)
Run("control ncpa.cpl")
...

Today my script with this additions (running from autostart) perfectly work while Windows booting - it was 1st time :(

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  
Followers 0