WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Launch a program on the system tray

Keywords: 	Launch a program on the system tray

Question:

Is there a way to launch a program that sits on the system tray so it becomes full screen? The application is a FTP monitor...

Answer:

I am not sure this is going to work for you, but its worth a try.....

------------------------------------

The following script is used only for determining the window name...

allwins = WinItemize()
win = AskItemList("Select Program Name to activate", allwins,
@TAB,@UNSORTED,@SINGLE)
WinActivate(win)
;*or*
WinShow(win)

------------------------------------

After you've found the name of the applications window, add one of the following lines to the script file you are creating.

For example......

WinActivate("FtpNetDrive Monitor")

*OR*

WinShow("FtpNetDrive Monitor")

------------------------------------

If this doesn't work....
You'll need to figure out what EXE the systray icon EXE points to, then launch that EXE with the Run function. Their may be commandline parameters, you are not aware of....

You may be able to find out the name of the EXE that in the Systray, by looking through the list of applications in the following registry subkey:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

------------------------------------

Finally

Contact the developer of this ftp utility and ask if they have any undocumented way to activate the window via the commandline....(using the run command)


Systray Icons on Windows ME/2000/XP

Question:

Does anyone have a script that will access the icons on the systray? I remember seeing one out here that did it quite nicely, but I am unable to find it and did not archive a copy my self. I need to select an icon and right click on it to bring up the menu.

Answer:

The Control Manager extender can do a good job in Windows ME, 2000, and XP I think.. It is a ToobarWindow32 wich the Control Manager extender can read.

Older versions of windows uses a kind of different systray area... and that window was opaque to Winbatch.

The following will activate WinBatch PopMenu on Windows XP, as long as you do not have the "Hide inactive icons" selected in the Taskbar and StartMenu properties.

And this only run on Winbatch 2001 and later.

;RoboScripter
; Made with 
; RoboScripter ver: 28
; CtlMgr ver: 20026
AddExtender("wwctl34i.dll")

;Title: Notification Area
;ID: 0
;Class: ToolbarWindow32
;Level: 4
window1=cWndByWndSpec("Shell_TrayWnd","explorer",3,304,303,40965)
window2=cWndByID(window1,303)
window3=cWndByID(window2,0)
ControlHandle=cWndByID(window3,0)
result=cGetTBText(ControlHandle)
Message("Toolbar Text",StrReplace(result,@tab,@crlf)) 

;Get the index of the button
select1=ItemLocate("WinBatch PopMenu", result, @tab);note ItemLocate is case sensitive
message("",select1)
cClickToolbar(Controlhandle,select1) ;Clicks a toolbar button

exit 

Question:

I am attempting to write a script that will click on the "Local Area Connection" icon in the task bar. Only I am having a problem using ItemLocate, to locate the item in the list because, the connection speed is also part of the icon and that can change. Any ideas on how this can be handled?

Answer:

Yes normally you could use ItemLocate to get the position of the icon, so it can be passed to the cClickToolbar function. However in cases like this where you may not know the exact title, you will need to locate the string by first getting the exact name using the Strindex and StrSUb function, then attempting to locate the item in the list using ItemLocate.
partial_icon_name = "Local Area Connection"

AddExtender("wwctl34i.dll")
window1=cWndByWndSpec("Shell_TrayWnd","EXPLORER",3,304,303,40965)
window2=cWndByClass(window1,`TrayNotifyWnd`)
window3=cWndByClass(window2,`SysPager`)
ControlHandle=cWndByClass(window3,`ToolbarWindow32`)

tbtext=cGetTBText(ControlHandle)

beginptr = StrIndexNC(tbtext,partial_icon_name,0,@FwdScan)
if beginptr == 0
  Message("","Icon not found in Systray")
  exit
Endif
endptr = StrIndexNC(tbtext,@Tab,beginptr,@FwdScan)
if endptr == 0
  ;assume end of list
  len = -1
Else
   len = endptr-beginptr
Endif
iconname = StrSub(tbtext,beginptr,len)
selectitem = ItemLocate(iconname, tbtext, @Tab)

cClickToolbar(Controlhandle,selectitem)     ;Clicks a toolbar button 

Article ID:   W14606
Filename:   Launch a program on the system tray.txt
File Created: 2002:07:12:13:25:46
Last Updated: 2002:07:12:13:25:46