// VEDITPDF.VDM - Open the VEDIT manual .PDF files using the associated // program, typically Adobe Reader. // // Originally by: Greenview Data, Inc. // Last change: 12/19/01 // // 2010-03-25 PL - Call Adobe Reader without using DOS shell // 2010-03-27 PAR - Minor editing to emohasize similarity with aspell.vdm // // Requires: VEDIT 6.00 or later. // // From VEDIT: Select {HELP, VEDIT manual}. // // Description: Open the VEDIT60.PDF or VPLUS60.PDF file by calling Adobe Reader or // by shelling out to the associated program. // // #104 = 0 // "0" - display help message // Can be patched by this macro if (#103==1) { Reg_Set(103,"vedit60.pdf") Reg_Set(105,"VEDIT 6.0 User's Manual") } else { Reg_Set(103,"vplus60.pdf") Reg_Set(105,"VEDIT 6.0 Macro Language Reference Manual") } if (!File_Exist("|(HOME)\|@(103)")) { if (#103==1) { Reg_Set(103,"vedit52.pdf") Reg_Set(105,"VEDIT 5.2 User's Manual") } else { Reg_Set(103,"vplus52.pdf") Reg_Set(105,"VEDIT PLUS 5.2 Macro Language Reference Manual") } if (File_Exist("|(HOME)\|@(103)")) { Reg_Set(105,"\n\nPlease note that this is an older version 5.2 manual which is\nnot completely up-to-date.",APPEND) } else { Alert() #120 = Dialog_Input_1(120,'`ERROR - Opening VEDIT manuals`, `Sorry, but it appears that the VEDIT manual ".PDF" files have not been installed on your computer. If desired, you can download them now from our Website. You will have to manually unzip the downloaded files into your VEDIT directory and then select this function again.`, `[&Cancel]`,`[Download]`',APP+CENTER,0,0) if (#120==0 || #120==1) { Return } Call("SETUP-HTTP") Sys(`|@(106) http://www.vedit.com/proddownload.htm#manuals`,#106) Return } } if (#104==0) { #120 = Dialog_Input_1(104,"`Open VEDIT manuals (test)`, `This will open the following VEDIT manual with Adobe Reader: |@(105) This function will only work if Adobe Reader is installed. If you do not have the Adobe Reader, it is available free of charge from the Adobe web site (www.adobe.com).`, `[]Don't show this message again`, `[&Open]`,`[&Cancel]`",APP+CENTER,0,0) if (#120==0 || #120==2) { Return } if (#104) { Call("PATCH") } } // // Launch Adobe Reader // That is to say, Launch Adobe Reader by first fetching it from the Windows registry. // (similarly to ASPELL.VDM) Then pass one of the parameter strings "vedit60.pdf" or // "vplus60.pdf" to the Adobe Reader program. Note that as per the previous subroutine T-reg 103 contains // one of these two strings, depending on N-reg 103, which is set by the Vedit {Help, } // menu command. // :LAUNCH ADOBE READER: if (Is_WinNT) { //If WinNT/2000... Reg_Set(#51=Reg_Free," ") // #51 = Base directory of the Adobe Reader program. if (Registry_Get_Item(#51,"HKEY_CLASSES_ROOT\Software\Adobe\Acrobat\Exe\(Default)") > 0) { Reg_Set(#52=Reg_Free," ") Reg_Set(#52,' "',APPEND) // #52 = T-register for the "Project strings", that is to say the parameters // to be passed to the Adobe Reader program. Reg_Set(#52,HOME,APPEND) Reg_Set(#52,"\",APPEND) Reg_Set(#52,@(103),APPEND) Reg_Set(#52,'"',APPEND) System(`|@(#51) |@(#52)`, NOWAIT) // Launch the Adobe Reader program. // From Appendix D - String Arguments of the Vedit Macro Language Manual: // |@(r) Use text register r as a portion of the string within a string constant. // Only supported for search and replace strings, filenames and in selected // other commands. Statline_Message(@(#51)) // debug } else { System(`"|(HOME)\|@(103)"`,DOS+SIMPLE+NOWAIT) Statline_Message("Using associated app") // debug } Reg_Empty(#51) // comment out for Rejto diagnostics only ! Reg_Empty(#52) // comment out for Rejto diagnostics only ! } else { System(`start "|(HOME)\|@(103)"`,DOS+SIMPLE+NOWAIT) Statline_Message("Opening PDF file") // debug } Return // // SETUP-HTTP - Set @106 with best shell command to run the current // web-browser. Set #106 with any needed Sys() options. // :SETUP-HTTP: Registry_Get_Item(106,"HKEY_CLASSES_ROOT\http\shell\open\command\") if (Reg_Size(106)<5) { Reg_Set(106,"start ") #106 = 0 //No options for Win95/98/ME if (Is_WinNT) { //In WinNT/2000... #106 = DOS+SUPPRESS+SIMPLE //"start" only works from cmd box } return } // // Strip any command options specified in the registry. Needed for Opera. // #106=Buf_Num Buf_Switch(NAB) Buf_Empty(OK) Reg_Ins(106) Replace("/|M|>","",BEGIN+NOERR) BOF Reg_Copy(106,1) Buf_Quit(OK) Buf_Switch(#106) #106 = 0 //No Sys() options needed return // // PATCH - Save "[ ] Don't display again" option into this macro. // :PATCH: #108 = Buf_Num #107 = Buf_Free(EXTRA) Buf_Switch(#107,EXTRA) //Open veditpdf.vdm in an extra buffer // // Try to find the source file of this running macro. // if (File_Exist("veditpdf.vdm")) { File_Open("veditpdf.vdm",FORCE+OVERWRITE) } else { if (File_Exist("|(USERMACRO)/veditpdf.vdm")) { File_Open("|(USERMACRO)/veditpdf.vdm",FORCE+OVERWRITE) } else { if (File_Exist("|(MACRO)/veditpdf.vdm")) { File_Open("|(MACRO)/veditpdf.vdm",FORCE+OVERWRITE) } else { Goto PATCHDONE }}} // // Replace old "#104 =" value with new one. // if (Search("|<#104 = |D",BEGIN+ADVANCE+NOERR)) { Del_Char(-1) Num_Ins(#104,LEFT+NOCR) File_Save(NOMSG) //Save new value into source macro } :PATCHDONE: Buf_Quit(OK) //Close the temp buffer Buf_Switch(#108) //Switch back to original buffer return