;;Program manager WBT script.  Adding/Deleting/Showing Program Manager Groups and Icons.  

                    ;;Written February 1994  by Wilson WindowWare, Inc.  
                    ;;Modifed July 1995

;;Call Progman.wil
;;Syntax of commands:
;;    Call("progman.wil", "AddGroup 'Group Title'")
;;        (             , "DelGroup 'Group Title'")
;;        (             , "AddIcon 'Group Title' 'File and Path' 'Icon Description' 'wrk dir'")
;;        (             , "DelIcon 'Group Title' 'Icon Description'")
;;        (             , "ShowGroup 'Group Title' ShowCommand")
;;        (             , "ReplaceItem 'Group Title' 'Icon Description'")
;;        (             , "Reload 'Group Title'")
;;        (             , "IconDump 'Group Title''Icon Description' 'variable name'")
;;        (             , "ProgBuild 'Group Title''variable name'")
;;    Call("progman.wil", "AddNewData '%grptitle%', '%data%'")

 
;;Show command is an integer which specifies the action Program Manager is to perform on the group window.
;;        VALUE          ACTION
;;          1               Restores group to its original size and position.
;;          2               Displays group as an icon.
;;          3               Displays group as a maximized window.
;;          6               Minimizes the group window.
;;                                 


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Display(5, "Progman.Wil Test Run", "Progman.wil will show the main group in various display modes.")


Call("Progman.wil", "ShowGroup 'Accessories' 1 ")
delay(2)
Call("Progman.wil", "ShowGroup 'Accessories' 2 ")
delay(2)
Call("Progman.wil", "ShowGroup 'Accessories' 3 ")
delay(2)
Call("Progman.wil", "ShowGroup 'Accessories' 6 ")                         
delay(2)
Call("Progman.wil", "Reload ")
delay(2)
exit

Display(5, "Progman.Wil Test Run",  "Progman.wil will now add a group, an icon, and then replace the icon.")

Call("progman.wil", "ADDGroup 'Group One' ")
delay(2)
Call("Progman.wil", "AddIcon 'Group One' 'C:\windows\clock.exe' 'tick tock' ")
delay(2)
Call("Progman.wil", "ReplaceItem 'Group One' 'tick tock'")
delay(2)
Call("Progman.wil", "AddIcon 'Group One' 'C:\WINDOWS\NOTEPAD.EXE' 'Notepad' ")
delay(2)

Message("IconDump Test Run", "By passing a groupname and icon, this command can return the icons syntax.") 
Call("progman.wil", "Icondump 'Group One' 'Notepad' 'fred'")
fred=StrReplace(fred,'"','')        ;;replace quotes with null-string.
Display(4,"Dump of icon from group:%grptitle%", fred)

Call("progman.wil", "DelIcon 'Group One' 'Notepad'")
delay(1)
Call("progman.wil", "DelGroup 'Group One' ")
delay(1)
 
Message("Progbuild Test Run", "This option displays a list box of groups. %@crlf% Select a group and its icon information will be displayed. %@crlf% Select an icon title and the syntax will be returned.")
Call("progman.wil", "Progbuild 'joan'")
Display(4,"Dump of Progbuild from group:%grptitle%", joan)

delay(2)
;Clipput(joan)    ;;Put the string into the clipboard using ClipPut.
                  
;;;
;;;To break the syntax into pieces use the following code.

joan=StrReplace(joan,'"','')           ;;replace quotes with null-string.
icondesc= ItemExtract( 1, joan, ",")    ;;extract each of the items.
Cmdline = ItemExtract( 2, joan, ",")
wrkdir  = ItemExtract( 3, joan, ",")
icofile = ItemExtract( 4, joan, ",")
xpos    = ItemExtract( 5, joan, ",")
ypos    = ItemExtract( 6, joan, ",")
index   = ItemExtract( 7, joan, ",")
hotkey  = ItemExtract( 8, joan, ",")
minimize= ItemExtract( 9, joan, ",")

dadata=StrCat('desc=',icondesc, @crlf, 'cmdline=',cmdline, @crlf, 'wrkdir =',wrkdir, @crlf, 'icofile=',icofile,@crlf, 'xpos=',xpos, @crlf,  'ypos=',ypos, @crlf,  'index=',index, @crlf, 'hotkey =',hotkey,@crlf,  'minimize=',minimize)   
message("Icon Syntax Information", dadata)

;;Put the parts back together in proper order.
data=StrCat(cmdline,',',icondesc,',',icofile,',',index,',',xpos,',',ypos,',',wrkdir,',',hotkey,',',minimize)
;Call("progman.wil", "AddNewData '%grptitle%', '%data%'") 


Message("DDETEST.WBT EXAMPLE", "That's all folks..")
