Getting workspace name from a DS macro 
Author Message
 Getting workspace name from a DS macro

I can't find a property in any of the Developer Studio Objects that will
tell me the name of the open workspace (dsw file).

Am I missing something?



Mon, 03 Feb 2003 03:00:00 GMT  
 Getting workspace name from a DS macro
Unfortunately its not possible to get workspace name using VC++ object
model properties/methods. Try the following after installing the Windows
Script Host

Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("USER")
MsgBox WshSysEnv("$(WkspName)")

Or use GetEnv and query for this variable, not sure if it works. If you go
to Tools->Customize->Tools tab, you will see that for a tool argument you
can click on the triangle button and then select Workspace Name, it
resolves to $(WkspName).

Alternatively, you can always write a bat file that will take the first
argument as $(WkspName) and then create a file, this file can be then
opened by a macro/add-in. The bat file should be first added to the Tools
menu and then called upon using ExecuteCommand "UserTool8" (the number
dependends on the position of the bat file in the Tools menu).



Mon, 03 Feb 2003 03:00:00 GMT  
 Getting workspace name from a DS macro


Quote:

>I can't find a property in any of the Developer Studio Objects that will
>tell me the name of the open workspace (dsw file).

>Am I missing something?

If you were writing an add-in instead of a macro, you could use the
registry to find the answer, since the current workspace is almost
always in the registry:
HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Recent File List
Then look at the value for the "Project1" key.

(This may not work if you have multiple copies of DevStudio running
at the same time.)

--
 - Katy

Katy Mulvey             Please post replies to the newsgroup, thanks!
ORMEC Systems           Check out the VC++ FAQ: http://www.mvps.org/vcfaq
http://www.ormec.com    MVP/VC++  http://support.microsoft.com/support/mvp



Fri, 07 Feb 2003 03:00:00 GMT  
 Getting workspace name from a DS macro

Quote:
> model properties/methods. Try the following after installing the Windows
> Script Host

> Set WshShell = WScript.CreateObject("WScript.Shell")
> Set WshSysEnv = WshShell.Environment("USER")
> MsgBox WshSysEnv("$(WkspName)")

> Or use GetEnv and query for this variable, not sure if it works. If you go
> to Tools->Customize->Tools tab, you will see that for a tool argument you
> can click on the triangle button and then select Workspace Name, it
> resolves to $(WkspName).

Did this work for you?  It certainly doesn't work for me.  For that matter,
WScript.CreateObject isn't accepted by the VBScript in Visual C++.  Set
WshShell = CreateObject("WScript.Shell") is.

As far as I can tell $(WkspName) is not really an environment variable, but
just a notice to Visual C++ to expand the workspace name inline on the
tool's arguments list.

The Windows Script Host IS installed.

Joshua Jensen
Author, Workspace Whiz! - A Visual Studio Add-in
http://workspacewhiz.com/



Fri, 07 Feb 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Repost:VC++ DS macro problem

2. VC++ DS macro problem

3. DS==SS vs DS!=SS in a DLL

4. key shortcut or macro for changing workspace view

5. Macro or AddIn to control Workspace Window

6. Help...Getting the font file name from the typeface name

7. Help...Getting the font file name from the typeface name

8. Getting Universal Name From Path Name

9. getting CDB file name from Table name

10. workspace name

11. Valid VC++ Project/Workspace Name Syntax

12. change the name of the project / or workspace

 

 
Powered by phpBB® Forum Software