Home
Page
About
ToolBook
ToolBook
Tips
ToolBook
Projects
ToolBook
Links
Guest
Book


How to create folders and shortcuts using DDE
-- Functions returns false if error occurs. 
-- myFolder - name of folder (group)
-- myShortcut - name of shortcut (program item)
-- myExe - name of exe file
-- myIcon - name of icon

to get createFolder myFolder
        clear sysError
        executeRemote "[createGroup (" & myFolder & ")]" application  "progman" topic "progman"
        if item 1 of sysError <> "Ok"
                myText = "Can't create folder" && myFolder
                request myText
                return false
        end if
        return true
end

to get createShortcut myFolder, myShortcut, myExe, myIcon
        clear sysError
        executeRemote "[showGroup (" & myFolder & ",1)]" application  "progman" topic "progman"
        executeRemote "[replaceItem (" & myShortcut & ")]" application  "progman" topic "progman"
        executeRemote "[addItem (" & myExe & "," & myShortcut & "," & myIcon & ")]" application  "progman" topic "progman"
        if item 1 of sysError <> "Ok"
                myText = "Can't create shortcut" && myShortcut && "in folder" && myFolder
                request myText
                return false
        end if
        return true
end


to get deleteShortcut myFolder, myShortcut
        clear sysError
        executeRemote "[deleteItem (" & myShortcut & ")]" application  "progman" topic "progman"
        if item 1 of sysError <> "Ok"
                myText = "Can't delete shortcut" && myShortcut && "in folder" && myFolder
                request myText
                return false
        end if
        return true
end

to get deleteFolder myFolder
        clear sysError
        executeRemote "[deleteGroup (" & myFolder & ")]" application  "progman" topic "progman"
        if item 1 of sysError <> "Ok"
                myText = "Can't delete folder" && myFolder
                request myText
                return false
        end if
        return true
end

-- For example:
createFolder("CompactBook")

createShortcut("CompactBook", "Russian Cookbook", "d:\rcook.exe", "d:\rcook.ico")

deleteShortcut("CompactBook", "Russian Cookbook")

deleteFolder("CompactBook")


Back to Tips Menu