Computer Hope

Microsoft => Microsoft Windows => Windows 3.x/9x/ME => Topic started by: Sebastian42 on April 19, 2010, 09:41:07 AM

Title: batch file in WinMe
Post by: Sebastian42 on April 19, 2010, 09:41:07 AM
Is it possible to write a batch file for WinMe to
1. open the Properties of Task Bar
2. select Toolbars
3. UNtick Quick Launch
4. RE-tick Quick Launch ?
(I KNOW that if the Quick Launch bar has not been populated, this can force it to.)
Title: Re: batch file in WinMe
Post by: Sidewinder on April 19, 2010, 04:37:18 PM
Your profile says WinXP, but you want a batch file for WinME.

Quote
Is it possible to write a batch file for WinMe to
1. open the Properties of Task Bar
2. select Toolbars
3. UNtick Quick Launch
4. RE-tick Quick Launch ?

You might be able to make changes to the registry with a batch file, but I prefer not to mess around with other people's registries. Actually, why can't you do this manually? It's simple enough and probably a lot faster.

This little VBScript may help. Microsoft didn't document the system tray very well so I combined some ideas from various sources.

Code: [Select]
Set objShell = CreateObject("Shell.Application")
Set WshShell = CreateObject("WScript.Shell")

objShell.TrayProperties
WScript.Sleep 1500

WshShell.SendKeys "%Q" 'toggle quick launch
WScript.Sleep 1500

WshShell.SendKeys "Q" 'toggle quick launch
WScript.Sleep 1500

WshShell.SendKeys "A" 'apply the change
WScript.Sleep 5000

Save the script with a VBS extension and run from the command prompt as cscript scriptname.vbs

Quote
(I KNOW that if the Quick Launch bar has not been populated, this can force it to.)
Not aware of this, but I'll take you word for it.

Good luck.  8)
Title: Re: batch file in WinMe
Post by: BC_Programmer on April 19, 2010, 05:08:17 PM
This little VBScript may help. Microsoft didn't document the system tray very well so I combined some ideas from various sources.

Of course  they didn't. there is no such thing as the "system tray". It's called the "taskbar notification area" the confusion comes because so much MS documentation on other subjects calls it the "system tray"... this name actually dates from the Win95 Betas:
http://blogs.msdn.com/oldnewthing/archive/2003/09/10/54831.aspx


Additionally- the tray properties dialog that is shown does not posess the required "Quick Launch" option (nor any option with Q as an accelerator) the Quick launch option that needs to be toggled is in fact in the right-click menu's "toolbar" submenu.

Only thing I can think of would be to write something in C or another language that can call into the windows API and use GetMenu,GetSubMenu, and other such calls to acquire the menu handle of the "toolbars"... option, and then send a emulated WM_MENUSELECT message to the SHELL_TRAYWND. A Tricky prospect, at best.


Title: Re: batch file in WinMe
Post by: Sidewinder on April 19, 2010, 06:34:08 PM
Additionally- the tray properties dialog that is shown does not posess the required "Quick Launch" option (nor any option with Q as an accelerator) the Quick launch option that needs to be toggled is in fact in the right-click menu's "toolbar" submenu.

I went with the OP profile of WinXP where there is in fact a "Show Quick Launch". The script worked beyond my wildest dreams. Took a chance it would work on his. If not so be it.

I still maintain it would be so much quicker and simpler to do something like this manually.

Using the Windows API seems like overkill...like shooting fish in a barrel.

 8)


Title: Re: batch file in WinMe
Post by: Sebastian42 on April 20, 2010, 12:34:18 AM
Sidewinder - sorry about the confusion. My question applies to only WinMe, despite what my profile may say. If I succeed in getting (the equivalent of) a batch file to do this, there is NO doubt that that is simpler than doing it manually. Will respond to other psts when I can.
Title: Re: batch file in WinMe
Post by: Sebastian42 on April 20, 2010, 01:02:45 AM
BC-Programmer - Thanks for the enlightenment about the history of The Systray. I personally KNOW that Quick Launch is accessible in the properties of the TaskBar, rather than of the Systray - that is why I listed Task Bar in #1 of my tasks. Your last paragraph is 'all Greek to me'.
Title: Re: batch file in WinMe
Post by: Sebastian42 on April 20, 2010, 01:12:57 AM
Sidewinder. You may call it VB script, but functionally it appears like a batch file to me. So thank you for actually constructing it, rather than just advising me to use VB script. I will 'try it out' - no doubt it will not succeed at first, but maybe with some tinkering, we can tweak it to co-operate. I however am a total ignoramus about VB script, so no doubt will need further help. I do hope your reference to systray rather than taskbar is not a portent of failure.

In case it is of interest, I want to explain why I would want to 'toggle' the QuickLaunch switch. It is because I HAVE EXPERIENCED that the Quick Launch bar may be empty even though there is a tick for Quick Launch in the TaskBar's Toolbar's submenu. But then removing the tick and re-inserting it is effective at repopulating the Quick Launch bar.
Title: Re: batch file in WinMe
Post by: Sebastian42 on April 20, 2010, 01:26:52 AM
Sidewinder
I saved your script as C:\toggleql.vbs

I wont know if it works, until the Quick Launch bar again remains empty, despite there being content in C:\...path-to-Quick-Launch\Quick launch\
WHEN THAT HAPPENS .... should I call

RUN
then type 'cscript toggleql.vbs'
click on OK

and hope for the best ?

If so, that may indeed NOT be quicker than doing it manually
which is why I asked for a batch file
- that I can leave on the desktop and simply click on when needed.
Title: Re: batch file in WinMe
Post by: BC_Programmer on April 20, 2010, 01:31:18 AM
If so, that may indeed NOT be quicker than doing it manually
which is why I asked for a batch file
- that I can leave on the desktop and simply click on when needed.


create a batch file that contains "cscript toggleql.vbs".

Title: Re: batch file in WinMe
Post by: Sebastian42 on April 20, 2010, 01:53:00 AM
Wow ! It's THAT simple ?
To judge the success, I still have to wait till the situation arises again.
Thank you !
Title: Re: batch file in WinMe
Post by: Sebastian42 on April 30, 2010, 08:20:53 AM
The situation arose where I had cause to use that batch file, but I got an error message : "Input Error: Can not find script file "C:\Data\Batch_Files\toggleql.vbs"  That could be because I created a batch file called toggleql.bat. IN THAT BATCH file is the script you provided. If I change the extension 'bat'  to 'vbs', I get another error message.
I'm at a loss....
Title: Re: batch file in WinMe
Post by: Sebastian42 on June 30, 2010, 04:24:18 AM
I used it again today and it worked !