home *** CD-ROM | disk | FTP | other *** search
- ; Set up useful variables
- crlf = StrCat(Num2Char(13), Num2Char(10))
- tab = Num2Char(9)
-
-
- ; Define dialog box format
- AddItemFormat=`WWWDLGED,4.0`
-
- AddItemCaption=`Add Item`
- AddItemX=86
- AddItemY=30
- AddItemWidth=158
- AddItemHeight=211
- AddItemNumControls=7
-
- AddItem01=`4,6,40,DEFAULT,STATICTEXT,DEFAULT,"&Program:"`
- AddItem02=`48,6,74,140,FILELISTBOX,prog,DEFAULT`
- AddItem03=`4,150,40,DEFAULT,STATICTEXT,DEFAULT,"&Description:"`
- AddItem04=`48,150,94,DEFAULT,EDITBOX,desc,""`
- AddItem05=`8,170,66,DEFAULT,CHECKBOX,runmin,"&Run minimized",1`
- AddItem06=`8,190,66,DEFAULT,PUSHBUTTON,DEFAULT,"&OK",1`
- AddItem07=`84,190,66,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",0`
-
-
-
-
- ; See if anyone respondes to a "Progman" DDE request
- channel = DDEInitiate("Progman", "Progman")
- if channel !=0 then goto top ; Somebody did. Goody.
-
- ; Nobody home at Progman DDE request, so start program manager
- Run("progman.exe", "")
- channel = DDEInitiate("Progman", "Progman")
- If channel == 0 Then Message("DDE Error","Could not start Progman DDE")
- then exit
-
-
-
-
- :top
- attop = @TRUE
- action = TextSelect("DDE", "Show Groups/Items|Add Group|Delete Group|Add Item|Delete Item", "|")
- If action == "" Then Goto top
- attop = @FALSE
-
- If action == "Add Group" Then Goto addgroup
- If action == "Delete Group" Then Goto delgroup
-
- groups = DDERequest(channel, "Groups")
- groups = StrReplace(groups, crlf, tab)
-
- :selgroup
- group = StrUpper(ItemSelect("Select a program group", groups, tab))
- If group == "" Then Goto selgroup
- rc = DDEExecute(channel, "[CreateGroup(%group%)]")
- If rc == "" Then errmsg="ShowGroup? DDE"
- then Goto error
-
- If action == "Add Item" Then Goto additem
- If action == "Delete Item" Then delflag=1
- Then Goto showdelitem
- if action == "Show Groups/Items" then delflag=0
- then goto showdelitem
- Goto top
-
- :addgroup
- group = AskLine("Add group", "Enter name of new group", "")
- If group == "" Then Goto addgroup
- rc = DDEExecute(channel, "[CreateGroup(%group%)]")
- If rc == "" Then errmsg="CreateGroup"
- then Goto error
- Goto addgroup
-
- :delgroup
- groups = DDERequest(channel, "Groups")
- groups = StrReplace(groups, crlf, tab)
- group = StrUpper(ItemSelect("Select a group to delete", groups, tab))
- If group == "" Then Goto delgroup
- ok = AskYesNo("Delete Group", "Really delete '%group%'?")
- If !(ok) Then Goto delgroup
- rc = DDEExecute(channel, "[DeleteGroup(%group%)]")
- If rc == "" Then errmsg="DeleteGroup"
- then Goto error
- Goto delgroup
-
- :additem
- prog = "*.*"
- desc = ""
- runmin = 0
- AddItemCaption = `Add Item to '%group%'`
- Dialog("AddItem")
- If !(FileExist(prog)) Then Goto additem
- prog = StrUpper(StrCat(DirGet(), prog))
- rc = DDEExecute(channel, "[AddItem(%prog%,%desc%,,,-1,-1,,,%runmin%)]")
- If rc == "" Then errmsg="AddItem"
- then Goto error
- Goto additem
-
-
- :showdelitem
- entries = DDERequest(channel, group)
- If (entries == "***NACK***" || entries=="") Then Message(group, "Empty Group")
- then Goto top
- entries = StrReplace(entries, crlf, tab)
- entries = ItemRemove(1, entries, tab)
- n = ItemCount(entries, tab)
- If n == 0 Then Message(group, "Empty group")
- Then Goto top
-
- items = ""
-
- i = 0
- :dnextitem
- i = i + 1
- item = ItemExtract(i, entries, tab)
- comma = StrIndex(item, ",", 1, @FWDSCAN)
- item = StrSub(item, 2, comma - 3)
- items = StrCat(items, item, tab)
- If i < n Then Goto dnextitem
-
- :delitem2
- if delflag==1 then delmsg="Select an item to delete from %group%"
- else delmsg="Items in %group%"
- item = ItemSelect(delmsg, items, tab)
- if delflag==0 then goto selgroup
- If item == "" Then Goto delitem2
- ok = AskYesNo(item, "Really delete this item from %group%?")
- If !(ok) Then Goto delitem2
- DDEExecute(channel, "[DeleteItem(%item%)]")
- i = ItemLocate(item, items, tab)
- items = ItemRemove(i, items, tab)
- If ItemCount(items, tab) == 0 Then Message(group, "Empty group")
- Then Goto top
- Goto delitem2
-
- :error
- if !IsDefined(errmsg) then errmsg="Unknown DDE"
- Message("DDE Error", "%errmsg% operation unsuccessful")
-
- :cancel
- If attop == @FALSE Then Goto top
- If IsDefined(channel) Then DDETerminate(channel)
-