REM Description: Fix corrupt WSWin document via conversion REM WSWin Macro File: fixdoc.wmc REM Author: Rich Zuris, 76702.520@compuserve.com REM Created: 3/24/95 'Mastersoft text converters, from/to WSWin DECLARE FUNCTION w4wf Lib "w4w37f.dll" (from$, to$, ver$, unused$, callback%) As Word DECLARE FUNCTION w4wt Lib "w4w37t.dll" (from$, to$, ver$, unused$, callback%) As Word 'Windows APIs DECLARE FUNCTION GetTempFileName Lib "kernel" (path%, prefix$, unique As WORD, buf$) As Word DECLARE FUNCTION GetPrivateProfileString Lib "kernel" (app$, key$, def$, ret$, size As Word, ini$) As Word 'Local procedure DECLARE FUNCTION ShowError% (rc%, orig$, from$, to$) 'Get last path and extension used by FileOpen SHARED path$, ext$, filter$ path$ = Space$(255) ext$ = Space$(255) filter$ = Space$(255) If GetPrivateProfileString("SessionInfo", "OpenDlgPath", "", path$, 255, "wsw.ini") Then 'If path found in INI file, ensure it ends with a backslash If Right$(path$, 1) <> "\" Then path$ = path$ + "\" End If If 0 = GetPrivateProfileString("SessionInfo", "OpenDlgExt", "", ext$, 255, "wsw.ini") Then 'If no extension found in INI file, see if there's a filter rc% = GetPrivateProfileString("SessionInfo", "OpenDlgFilter", "", filter$, 255, "wsw.ini") If filter$ = "Templates" Then ext$ = "*.wst" Else ext$ = "*.wsd" End If End If 'Get file to repair file$ = GetFileBox$(path$ + ext$, "Select a Document to Repair") If file$ = "" Then Beep Stop End If 'Get name for Mastersoft intermediate file SHARED temp$ temp$ = Space$(255) rc% = GetTempFileName(0, "WSW", 0, temp$) 'Convert from WSWin format to Mastersoft format rc% = w4wf(file$, temp$, "1", "", 0) 'If conversion successful, convert back to WSWin format ' Otherwise, report the error returned by Mastersoft If 0 = ShowError%(rc%, file$, file$, temp$) Then rc% = w4wt(temp$, file$, "1", "", 0) rc% = ShowError%(rc%, file$, temp$, file$) End If 'Delete temp file If Access(temp$, 0) Then Kill temp$ 'Attempt to open file; if successful, report success If 0 = rc% Then FileOpen file$ If LCase$(GetDocName$()) = LCase$(file$) Then rc% = MessageBox(file$ + " fixed successfully, though styles may be lost.", "FixDoc Macro", 64) End If End If Stop ' 'Purpose: ' Display a message for a given Mastersoft error code 'Returns: ' 1 if error occurred, otherwise 0 ' Function ShowError% (rc%, orig$, from$, to$) 'Return codes 0 and 12 indicate the conversion was successful If rc% = 0 Or rc% = 12 Then ShowError% = 0 Else Select Case rc% Case 1, 2 'Use source filename for these errors file$ = from$ Case 3, 4, 10 'Use destination filename file$ = to$ Case Else 'Use original (WSWin) filename file$ = orig$ End Select Select Case rc% Case 1, 3 msg$ = "Could not open " + file$ Case 2 msg$ = "Could not read from " + file$ Case 4 msg$ = "Could not write to " + file$ Case 5 msg$ = "An internal error occurred while converting " + file$ Case 8 msg$ = "Not enough memory to convert " + file$ Case 9 msg$ = "Converter doesn't recognize " + file$ + " as a WSWin document." Case 10 msg$ = "Not enough disk space for temporary file " + file$ Case 11 msg$ = file$ + " is too large to convert" Case 15 'only applies to 1-2-3 files msg$ = file$ + " is password-protected" End Select rc% = MessageBox(msg$, "FixDoc Macro", 48) ShowError% = 1 End If End Function  ***** WARNING ***** This is a WSWin macro file. Subsequent data is binary information and should not be modified. # MF # 1.0None845194182L|p-3 8  8  8  8X 8X"   8"" 8Z  8Z 8   8   8! 8!&"  8&&  8&( 8() 8).  8./ 8/2 8250  8507 878 88;  8;<' 8<>  8>@ 8@@0    8@0B"         8BF( 8FP   8PR 8RT 8TT 8T U   8UV  8VV 8V V 8VW  # !# "#$ 8WX  8XZ  8Z]% 8]] 8] ^ %' % '( 8^_"+* )+ 8_`& %,- 8`a"/. )/ 8ab& %!01 8bc"32 )3 8cd& %456 8de"87 )8 8ef& %9:; 8fg"=< )= 8gh& %>?@ 8hi"CA"DCB )D 8ij& %"EF 8jk"HG )H 8kl& %IJK 8lm"ML )M 8mn& %NOP 8no"RQ )R 8orVTWUS)VWX 8rs 8sv[~zZZZZZZZZZZZZZZZZZZZ.G:.G:.G: .G:-.G:5.G:;.G:A.G:N.G:^.G: l.G: z.G: .G: .G: .G:.G:.G:.G:.G:.G:.G:.G:.G:.G:.G:.G:.G:.G:.G:.G:.G:.G:.G: .G:!.G:".G:#.G:$.G:%.G:&.G:'/G:( /G:)/G:*/G:+/G:,"/G:-(/G:.-/G:/3/G:06/G:1;/G:2@/G:3B/G:4E/G:5J/G:6N/G:7T/G:8Y/G:9`/G::g/G:;l/G:<o/G:=w/G:>y/G:?{/G:@/G:A/G:B/G:C/G:D/G:E/G:F/G:G/G:H/G:I/G:J/G:K/G:L/G:M/G:N/G:O/G:P/G:Q/G:R/G:S/G:T/G:U0G:V 0G:W0G:X$0G:Y10G:Z:0G:[G0G:\P0G:]X0G:^`0G:_h0G:`q0G:av0G:b{0G:c0G:d0G:e0G:f0G:g0G:h0G:i0G:j0G:k0G:l0G:m0G:n0G:o0G:p0G:q0G:r0G:s0G:t0G:u0G:v0G:w0G:x0G:y1G:z1G:{1G:|1G:}qq+q+ qqqq qB%q2q 8q <q Aq Iq SqBXqeqB uq~q q qq qBq q q q qq q @q q q @q @q @q )q+qq q qq q q$q )q /q4q+Bq+Pq+Sq+]q cq iq oquq {qq #qq+qq q qq qq+q q q qq qqq+q q q qq qq!q+-q2q+:q+Bq Hq &Tq+rq xq ~q q qqq @qq q q+qq qqq+q q qqqqqq q q qq+q,q$q*q 0q,6q<qBqA.Kq Qq 3Xq^q 0jq pq vq |q q q qq5q+q+q+@q q qq q  q q  q qq$q+q+ q"q(q.q4q:q+<q+>qHDqzJq Pq+Rq+Tq+ Wq]qcqiqoquq6{q q+q qHqnq+q qqq+q q+qqq+&q ,q+.q4q:q+Zq `q+ bq(hqVnq+q+q q qhqq+q q+ qqq+q q+"q(q.q+Gq Mq9Xq+gq+0jq pqvq |q~q????01CANCELERRORNUM[T1] W4WF"w4w37f.dll"FROM$TO$VER$UNUSED$CALLBACK%W4WT"w4w37t.dll"GETTEMPFILENAME"kernel"PATH%PREFIX$UNIQUEBUF$GETPRIVATEPROFILESTRINGAPP$KEY$DEF$RET$SIZEINI$SHOWERROR%RC%ORIG$PATH$EXT$FILTER$SPACE$255[T2][T3][T4][T5][T6][T7][T8][T9][T10][L1]"SessionInfo""OpenDlgPath""""wsw.ini"[T11][T12][T13][T14][T15][L2]RIGHT$[L3]"\"[T16][T17][T18][L4][T19][L5]"OpenDlgExt"[T20][T21][T22][T23][T24][T25][L6]"OpenDlgFilter"[T26][T27][T28][T29][T30][T31][L7]"Templates"[L8]"*.wst""*.wsd"FILE$GETFILEBOX$"Select a Document to Repair"[T32][T33][T34][T35][L9][L10]TEMP$[T36][T37][T38]"WSW"[T39][T40][T41][T42]"1"[T43][T44][T45][T46][L11][T47][L12][T48][T49][T50][T51]ACCESS[L13][T52][T53][T54][L14][L15][L16]FILEOPEN[T55]LCASE$[L17]GETDOCNAME$[T56][T57][T58][T59][T60][T61][L18]MESSAGEBOX" fixed successfully, though styles may be lost.""FixDoc Macro"64[T62][T63][T64][T65]RC%ORIG$FROM$TO$ [L19]012[T66][T67][L20][T68][L21]12[L22][L23]FILE$3410[L24][L25][T69][L26][L27][L28]MSG$"Could not open "[T70][L29][L30]"Could not read from "[T71][L31][L32]"Could not write to "[T72]5[L33][L34]"An internal error occurred while converting "[T73]8[L35][L36]"Not enough memory to convert "[T74]9[L37][L38]"Converter doesn't recognize "" as a WSWin document."[T75][T76][L39][L40]"Not enough disk space for temporary file "[T77]11[L41][L42]" is too large to convert"[T78]15[L43][L44]" is password-protected"[T79]MESSAGEBOX"FixDoc Macro"48[T80][T81][T82]