QUOTE (Amerigo @ Aug 14 2008, 04:53 PM)

It seems to have gotten caught in a loop where it tries to keep opening WordWeb.
Sorry. My results are different for some reason.
This will use the Ctrl+Alt+w hotkey
CODE
; path to webword directory
$ww_path = @ProgramFilesDir & '\WordWeb'
; WordWeb NoTray executable
$exe_notray = 'wwnotray.exe'
; WordWeb Tray executable
$exe_tray = 'wweb32.exe'
; main window title
$title = '[CLASS:TTHeDi]'
Select
Case WinActive($title)
; nothing to do
Exit
Case ProcessExists($exe_notray) And Not WinActive($title)
; restore and activate the window
WinSetState($title, '', @SW_RESTORE)
WinActivate($title)
Case ProcessExists($exe_tray) And Not WinActive($title)
; run tray exe to activate the window
_RunWordWeb($exe_tray)
Case Else
; no process running so choose $exe_notray or $exe_tray to run
_RunWordWeb($exe_tray)
EndSelect
Exit
Func _RunWordWeb($file)
; check to ensure the file to run is available, else return if not
If Not FileExists($ww_path & '\' & $file) Or $file = '' Then
Return SetError(1)
EndIf
Switch $file
Case $exe_notray
; run no tray exe to show window
Run('"' & $ww_path & '\' & $exe_notray & '"')
If Not @error Then
; wait for the window and then activate it
WinWait($title, '', 5)
WinActivate($title)
EndIf
Case $exe_tray
; run tray exe
Run('"' & $ww_path & '\' & $exe_tray & '"')
If Not @error Then
; wait for hidden tray icon window
WinWait('WordWeb Tray Icon', '', 5)
Sleep(500)
; if the window is not active, then use the hotkey
If Not WinActive($title) Then
WinActivate($title)
Send('^!w')
EndIf
EndIf
EndSwitch
Sleep(500)
; another attempt to activate the window if needed
If Not WinActive($title) Then
WinActivate($title)
EndIf
EndFunc
If you wish, you can run the no tray executable instead by changing the parameter of _RunWordWeb() in the Case Else part which shows a window which behave like a normal window.
before:
CODE
Case Else
; no process running so choose $exe_notray or $exe_tray to run
_RunWordWeb($exe_tray)
EndSelect
after:
CODE
Case Else
; no process running so choose $exe_notray or $exe_tray to run
_RunWordWeb($exe_notray)
EndSelect