home *** CD-ROM | disk | FTP | other *** search
- REM Description: Indent first line by 1/2 inch.
- REM Filename: indfirst.wmc
- REM Created by: Steve Wylie - 11/08/93
-
- REM Can't run if no document open
- IF GetDocName$() = "" THEN
- MESSAGE "Please create a new document or open an existing document first."
- STOP
- ENDIF
-
- REM Can't run in a graphic or table frame
- frameType% = GetFrameType()
- IF frameType% <> 0 THEN
- Message "The current frame must be a text frame."
- STOP
- ENDIF
-
- REM Can't run in frame mode
- ret% = ViewEditMode(1)
- IF ret% = 2 THEN
- ret% = ViewEditMode(2)
- BEEP
- STOP
- ENDIF
-
- REM Changed local% to 0 if you want the change to apply globally to the paragraph style.
- local% = 1
-
- REM Save the beginning and end of the selection
- yes% = GetTextOffset(strt%, end%)
- IF strt% = 0 THEN strt% = 4
-
- REM Freeze the screen so that the activity isn't visible
- freeze% = ViewFreezeScreen(1)
-
- REM Count the number of paragraphs
- EditGotoOffset strt%,
- DO
- ret% = GetTextOffset(savestart%, saveend%)
- ParaDown 1,
- ret% = GetTextOffset(start2%, end2%)
- numParagraphs% = numParagraphs% + 1
- LOOP UNTIL end2% >= end% OR end2% = saveend%
-
- REM Go to the beginning of the selection
- EditGotoOffset strt%, 0
-
- GetFrameSize x%, y%, width%, height%
- GetFrameMargins left%, right%, top%, bottom%
-
- lineLength% = width% - (left% + right%)
- REM Change the value from .50 to a different value if you want to use a different indent value.
- adjust% = TO_DP("0.50", 0)
- lineLength% = lineLength% - adjust%
-
- FOR i% = 1 TO numParagraphs%
- REM Get the style information
- GetStyleParagraph first%, left%, right%, above%, below%, align%, location%, span%, hyphen%, numHyph%, keep%, allowBreak%, widow%
-
- first% = first% + adjust%
- if first% > (lineLength% - right%) then first% = lineLength% - right%
-
- REM Redefine the style with the new first indent.
- DefineStyle , local%
- DefineStyleParagraph first%, , , , , , , , , , , ,
- EndDefineStyle 1
-
- REM Go to the next paragraph.
- ParaDown 1,0
- IF GetNextChar$() <> "<Cr>" THEN CharRight 1,0,
- NEXT i%
-
- REM Restore the selection
- EditGotoOffset strt%, 0
- if yes%=1 then EditGotoOffset end%, 1
-
- REM Restore the screen
- freeze% = ViewFreezeScreen(freeze%)
-
- ***** WARNING *****
- This is a WSWin macro file.
- Subsequent data is binary information and should not be modified.