Previous Topic: AddItem - Add an IconNext Topic: CreateLink - Create a Shortcut


CreateGroup - Create a New Group or Activate an Existing Group

Valid on Windows only

The CreateGroup function creates a new group or activates the window of an existing group.

Function format:

CreateGroup (name as String) as Boolean
CreateGroup (name as String, 
	offset as Integer) as Boolean
name

Identifies the group name.

offset

One of:

On successful completion, the function returns TRUE; otherwise, returns FALSE.

Example:

This example creates an icon group named DMS Test with an icon to the script editor. This example adds a shortcut on the desktop. The icon group and the shortcut are removed.

Rem
' determine location of dmsedit.exe
Dim hkey, dummy As Integer
Dim dmseditPath As String

hkey = RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE\ComputerAssociates\DMScript\DMSEdit")
If hKey = 0 Then
MessageBox("Can not open DMSEdit-key", "Desktop Management Scripting", MB_OK + MB_ICONEXCLAMATION)
SetStatus(1)
Exit
End If

If Not(RegQueryVariable(hkey, "dmseditInstalledAt", dmseditPath, dummy) = REG_STRING) Then
MessageBox("dmseditInstalledAt not found or invalid", "Desktop Management Scripting", MB_OK + MB_ICONEXCLAMATION)
SetStatus(2)
Exit
End If

RegCloseKey(hkey)

' Now Create group and icons
If Not(CreateGroup("DMS Test", LNK_PROGRAMS)) Then
MessageBox("Can not create icon group", "Desktop Management Scripting", MB_OK + MB_ICONEXCLAMATION)
SetStatus(3)
Exit
End If

If Not(AddItem("DMS Editor", dmseditPath+"\dmsedit.exe","","", "DMS Test",FALSE,)) Then
MessageBox("Failed to install dmsedit at icon group", "Desktop Management Scripting", MB_OK + MB_ICONEXCLAMATION)
SetStatus(4)
Exit
End If

if Not(CreateLink("DMS Editor", dmseditPath+"\dmsedit.exe","","", "",LNK_NORMAL, LNK_DESKTOP)) Then
MessageBox("Failed to install dmsedit at desktop", "Desktop Management Scripting", MB_OK + MB_ICONEXCLAMATION)
SetStatus(5)
Exit
End If

MessageBox("Icons and shortcut has been created, press OK to delete them again","Desktop Management Scripting: Icon Confirm", MB_OK + MB_ICONINFORMATION)

'Delete shortcut 
if Not(DeleteItem("DMS Editor", "", LNK_DESKTOP)) Then
MessageBox("Failed to deinstall dmsedit from desktop", "Desktop Management Scripting", MB_OK + MB_ICONEXCLAMATION)
SetStatus(6)
Exit
End If

if Not(DeleteGroup("DMS Test", LNK_PROGRAMS)) Then
MessageBox("Failed to delete icon group", "Desktop Management Scripting", MB_OK + MB_ICONEXCLAMATION)
SetStatus(7)
Exit
End If