Login | |
|
 |
RE: What is the difference between 'Parent' and 'Parent... - 10/29/2005 8:42:43 AM
|
|
 |
|
| |
Cybex
Posts: 412
Score: 0
Joined: 9/14/2005
From: Florida
Status: offline
|
What? Please restate your questions with a few verbs, nouns, and other grammar type items added in to help make it a complete coherent question. Cybex
|
|
| |
|
|
|
 |
RE: What is the difference between 'Parent' and 'Parent... - 10/29/2005 10:32:38 AM
|
|
 |
|
| |
TNO
Posts: 1302
Score: 12
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
1) What is the difference between 'Parent' and 'ParentFolder' In Shell.Application object? http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/objects/folder/folder.asp?frame=true Parent is not currently implemented. (And now with VB.NET it probably never will be). 2)Why the next two lines work? Set shellapp= WScript.CreateObject("shell.application") WScript.Echo shellapp.NameSpace("f:\windows").Items.Item.Path And these two, don't? Set shellapp= WScript.CreateObject("shell.application") WScript.Echo shellapp.NameSpace(0).Items.Item.Path Change NameSpace(0) to NameSpace(1) and go from there. For whatever reason, the first element in the array is undefined. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Note: NameSpace(0).Items don't get into the habit of handling arrays like this or you may run into trouble in the future. This method is better suited for JScript than VBScript
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: What is the difference between 'Parent' and 'Parent... - 10/29/2005 6:45:07 PM
|
|
 |
|
| |
TNO
Posts: 1302
Score: 12
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
If you want the path of the Desktop why not use this: set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") A namespace is simply the location where a set of classes are stored. I usually think of this as an array. Which may or may not be a good definition. Another reason I think of this as an array is because of the vbscript semantics for Arrays: NameSpace(0).
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: What is the difference between 'Parent' and 'Parent... - 10/29/2005 7:13:16 PM
|
|
 |
|
| |
TNO
Posts: 1302
Score: 12
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
About array semantics: Arrays in vbscript look like this: Dim A A = Array(10,20,30) now if I wanted to get the last number "30" I would do this: B = A(2) ' B is now 30 So to get a value in the array you would do this A(#). The # being which value you want. So when I see NameSpace(0), The first thing I think is (this is the first value in the NameSpace array). ---------------------------------------- quote:
I'll need more explanation about Namespace. A quick quote from microsoft: quote:
So what is a namespace? In WMI, you work with things called classes. Classes are virtual representations of real, live things; for example, there is a Win32_Service class that represents all the services on a computer. A namespace is simply the location where a set of classes are stored; in this case, the Win32_Service class is stored in the root\cimv2 namespace.
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: What is the difference between 'Parent' and 'Parent... - 10/30/2005 3:30:45 AM
|
|
 |
|
| |
Snipah
Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
|
If you're automatiing scripts for different environments where installations are not standard...and you happen to need to copy something to the Windows folder you can hardcode the path, but if you happen to have a system where Windows is installed on the D-drive with the name "Windoos", you need to call the path as secure as possible...then you need to call the namspace with the (2)....
_____________________________
For more information, please see the "Read me First" topic. http://www.visualbasicscript.com
|
|
| |
|
|
|
 |
RE: What is the difference between 'Parent' and 'Parent... - 10/30/2005 8:46:07 AM
|
|
 |
|
| |
TNO
Posts: 1302
Score: 12
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
quote:
But this objectes and classes thing is new to me. From the world of C++ I'm sure you've used objects: "Objects work so well because they act just like real life objects- objects have properties and methods. So if we were talking about a lamp, a property of it may be its height or width, say 12cm. A method of it may be to shine (an action). And when it's shining, its brightness property would be of a greater value than when it wasn't." Classes are like generic objects. Think of it like this: Object: Raven Object: Canary Object: Ostrich Class: Birds So a class can create objects with a group of properties and methods. A namespace is simply the location where a set of classes are stored.
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
 |
RE: What is the difference between 'Parent' and 'Parent... - 10/30/2005 8:17:16 PM
|
|
 |
|
| |
TNO
Posts: 1302
Score: 12
Joined: 12/18/2004
From: thenewobjective.com
Status: offline
|
I couldn't have said it better: quote:
In Windows 95 and later, the file system is just one possible place to store and search for information. As a result, the pre-Win95 hierarchy of files and directories no longer adequately describes the possible objects that you can now access in Windows. New types of folders such as the Recycle Bin, My Documents, and Printers forced the adoption of a new programming interface. In this new programming interface, Folder objects represent Windows shell folders that contain files or references to other types of objects. (The Folder object in the Windows Shell object model isn't related to the Folder object in the File System Object—FSO—object model. The objects simply share the same name.) Because files no longer solely define a folder's content, more general objects called FolderItem objects represent the items in a folder. A FolderItem can be a file or a chunk of data that represents, for example, a printer or deleted file. A collection called FolderItems represents all the FolderItem objects in a folder. Because a folder is essentially a container that holds data, you can use a common set of methods and properties (i.e., the Folder object's methods and properties) to access many different types of objects. As a container of data, a folder is able to describe itself in terms of name, title, path, and content. The content can vary widely depending on a folder's particular role. For this reason, each folder implements a special functionality: the ability to enumerate child items (i.e., FolderItem objects). Each child item, in turn, has fixed properties and methods that you use to manipulate it. Here's a look at how you use the methods and properties of the Folder and FolderItem objects. ... You typically don't create instances of the Folder object directly. Instead, use the NameSpace method with a pathname or virtual folder ID to create instances. ... After you create an instance of the Folder object, you can use its properties and methods. Quoted from: http://www.windowsitpro.com/Article/ArticleID/15847/15847.html?Ad=1
_____________________________
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|