home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Windoware
/
WINDOWARE_1_6.iso
/
winutil
/
fbuild14
/
addtopm1.txt
< prev
next >
Wrap
Text File
|
1992-01-29
|
3KB
|
87 lines
' AddToProgMan, for Word for Windows v1.1
'
' Robert M. Ryan, 28 January 1992, v1.4
'
' This is a Word for Windows macro which allows you to add the current document to the
' specified Program Manager Group.
'
' To install this macro, do the following:
'
' 1. open this document in Word for Windows.
' 2. select (i.e. highlight) the entire document and select Edit, Copy (Ctrl-Ins)
' 3. Select "Edit..." from the "Macro" menu
' 4. Type in a macro name (e.g. "AddToProgMan")
' 5. Push the "Ok" button
' 6. Paste the macro in the buffer.
' 7. Close the window, saving changes.
' 8. If you want, assign it to a key
' 9. When you exit, make sure to save changes to the global glossary
'
Sub MAIN
Begin Dialog UserDialog 410, 170
Text 10, 6, 231, 13, "Add Item to Program Manager:"
Text 47, 25, 73, 13, "Filename:"
Text 47, 45, 40, 13, "Title:"
Text 47, 66, 52, 13, "Group:"
Text 47, 88, 40, 13, "Icon:"
CheckBox 135, 112, 139, 16, "Save Changes", .Save
OKButton 105, 135, 88, 21
CancelButton 211, 135, 88, 21
TextBox 135, 22, 262, 18, .FName$
TextBox 135, 43, 262, 18, .Title$
TextBox 135, 64, 262, 18, .Group$
TextBox 135, 85, 263, 18, .Icon$
End Dialog
n$ = LCase$(FileName$(0))
m$ = n$
q$ = Chr$(34)
' remove path from filename
For i = 1 To Len(n$)
If Mid$(n$, i, 1) = "\" Then m$ = Right$(n$, Len(n$) - i)
Next i
' remove extension from filename
i = InStr(m$, ".")
If i > 0 Then m$ = Left$(m$, i - 1)
Dim dlg As UserDialog
dlg.Group$ = GetProfileString$("Add To Group")
If dlg.Group$ = "" Then dlg.Group$ = "Documents"
dlg.Icon$ = GetProfileString$("Add Using Icon")
If dlg.Icon$ = "" Then dlg.Icon$ = "\win\icons\doc.ico"
dlg.FName$ = LCase$(FileName$(0))
dlg.Title$ = m$
On Error Goto NoDialog
Dialog dlg
On Error Goto 0
ChanNum = DDEInitiate("PROGMAN", "PROGMAN")
If ChanNum = 0 Then
MsgBox "Unable to initiate DDE conversation with ProgMan", "Error"
return
Else
window$ = WindowName$()
AppActivate "Program Manager", 1
DDEExecute ChanNum, "[CreateGroup(" + dlg.Group$ + ",6)]" ' create if necessary
DDEExecute ChanNum, "[ShowGroup(" + dlg.Group$ + ",6)]" ' minimize
DDEExecute ChanNum, "[ShowGroup(" + dlg.Group$ + ",1)]" ' restore
cmd$ = "[AddItem(" + dlg.FName$ + "," + q$ + dlg.Title$ + q$ + "," + dlg.Icon$ + ")]"
DDEExecute ChanNum, cmd$ ' add file to group
DDEExecute ChanNum, "[ShowGroup(" + dlg.Group$ + ",6)]" ' minimize
DDETerminate ChanNum ' terminate discussion
Activate window$
End If
If dlg.Save Then
SetProfileString "Add To Group", dlg.Group$
SetProfileString "Add Using Icon", dlg.Icon$
End If
NoDialog:
End Sub