stevemarks59
Technical User
My OS is Windows XP Pro SP3
How can I combine these two VBScripts, StartYahoo.vbs and MinYahoo.vbs into one VBScript,
StartYahooMin.vbs without getting an "Illegal Assignment 'shell" Error from the line below?
These two scripts when run as separate vbs files work fine.,
StartYahoo.vbs:
MinYahoo.vbs:
But produces an error when combined into one vbs file,
StartYahooMin.vbs:
Windows Script Host Error:
-----------------------------
Script: C:\Program Files\Yahoo!\Messenger\StartYahooMin.vbs
Line: 17
Char: 1
Error: Illegal assignment: 'shell'
Code: 800A01F5
Source: Microsoft VBScript runtime error
The line above producing the error is in BOLD type.
Thank you and I will appreciate your help.
NOTE:
I realize I can just call "StartYahoo.vbs" from code added to the beginning of
MinYahoo and that is what I currently do using this:
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.Run """C:\Program Files\Yahoo!\Messenger\Y\StartYahooVBS.vbs""", True
How can I combine these two VBScripts, StartYahoo.vbs and MinYahoo.vbs into one VBScript,
StartYahooMin.vbs without getting an "Illegal Assignment 'shell" Error from the line below?
Code:
set shell = createobject("wscript.shell"
These two scripts when run as separate vbs files work fine.,
StartYahoo.vbs:
Code:
'START Yahoo Messenger
sub shell(cmd)
dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run(cmd)
Set objShell = Nothing
end sub
shell """C:\Program Files\Yahoo!\Messenger\YahooMessenger.exe"""
MinYahoo.vbs:
Code:
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.popup "MINIMIZE Yahoo Messenger", 5
'MINIMIZE Yahoo Messenger
[b]set shell = createobject("wscript.shell")[/b]
shell.AppActivate "Yahoo! Messenger"
wscript.sleep 1000
success = shell.appactivate("Yahoo! Messenger")
if success then shell.sendkeys "% r" '...restore
wscript.sleep 1000
success = shell.appactivate("Yahoo! Messenger")
if success then shell.sendkeys "% n" '...minimize
wscript.sleep 1000
success = shell.appactivate("Yahoo! Messenger")
if success then shell.sendkeys "% n" '...minimize
But produces an error when combined into one vbs file,
StartYahooMin.vbs:
Code:
'START Yahoo Messenger
sub shell(cmd)
dim objShell
Set objShell = WScript.CreateObject( "WScript.Shell" )
objShell.Run(cmd)
Set objShell = Nothing
end sub
shell """C:\Program Files\Yahoo!\Messenger\YahooMessenger.exe"""
wscript.sleep 25000
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.popup "MINIMIZE Yahoo Messenger", 5
'MINIMIZE Yahoo Messenger
[b]set shell = createobject("wscript.shell")[/b]
shell.AppActivate "Yahoo! Messenger"
wscript.sleep 1000
success = shell.appactivate("Yahoo! Messenger")
if success then shell.sendkeys "% r" '...restore
wscript.sleep 1000
success = shell.appactivate("Yahoo! Messenger")
if success then shell.sendkeys "% n" '...minimize
wscript.sleep 1000
success = shell.appactivate("Yahoo! Messenger")
if success then shell.sendkeys "% n" '...minimize
Windows Script Host Error:
-----------------------------
Script: C:\Program Files\Yahoo!\Messenger\StartYahooMin.vbs
Line: 17
Char: 1
Error: Illegal assignment: 'shell'
Code: 800A01F5
Source: Microsoft VBScript runtime error
The line above producing the error is in BOLD type.
Thank you and I will appreciate your help.
NOTE:
I realize I can just call "StartYahoo.vbs" from code added to the beginning of
MinYahoo and that is what I currently do using this:
Set WSHShell = CreateObject("WScript.Shell")
WSHShell.Run """C:\Program Files\Yahoo!\Messenger\Y\StartYahooVBS.vbs""", True