home *** CD-ROM | disk | FTP | other *** search
- ; PERLPOPUP.MNU file.
- ;
- ; This is the Perl menu version of WinEdit's context menu.
- ;
- ; Thanks to Jim Murff for the additions.
- ;
- ; Perl Language specific stuff.
- ;
- ; AutoExec Section is on top here.
- ;
- TAB=@TAB
- CR=@CRLF
- EOL=@CR
- Home=DirHome()
- IntControl(29,@tab,0,0,0) ;Standardize on tabs as delimiters for FileItemize, etc
- ;
- ;=====================================================================
- ;Perl Popup Menu ; Title (do nothing really) You really are in perl mode.
- ; TheFile = strcat(DirHome(),"System\PerlPopup.mnu")
- ; Message("Perl Popup Menu","Edit '%TheFile%' to add features to this Menu.")
- ;=====================================================================
-
- ;
- ;=====================================================================
- Undo ; Undoes the last editing action
- wUndo()
-
- ;
- ;=====================================================================
- Redo ; Redoes the last editing action
- wRedo()
-
- ;
- ;=====================================================================
- _Cut ; Cut the selection and put it on the clipboard
- wCut()
-
- ;
- ;=====================================================================
- Copy ; Copy the selection and put it on the clipboard
- wCopy()
-
- ;
- ;=====================================================================
- Paste ; Insert the clipboard contents
- wPaste()
-
- ;
- ;=====================================================================
- _Insert Conditionals
- if
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- a = wGetColNo()
- wInsLine("if ( xx == yy ) {")
- wInsLine(" ;;")
- wGoToCol( a )
- wInsLine("};")
- wNewLine()
- endif
- drop(a,filext)
-
- unless
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- a = wGetColNo()
- wInsLine("unless ( xx == yy ) {")
- wInsLine(" ;;")
- wGoToCol( a )
- wInsLine("};")
- endif
- drop(a,filext)
-
- if-else
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- a = wGetColNo()
- wInsLine("if ( xx == yy ) {")
- wInsLine(" ;;")
- wGoToCol( a )
- wInsLine("}")
- wInsLine("else {")
- wInsLine(" ;;")
- wGoToCol( a )
- wInsLine("};")
- endif
- drop(a,filext)
-
- unless-else
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- a = wGetColNo()
- wInsLine("unless ( xx == yy ) {")
- wInsLine(" ;;")
- wGoToCol( a )
- wInsLine("}")
- wInsLine("else {")
- wInsLine(" ;;")
- wGoToCol( a )
- wInsLine("};")
- endif
- drop(a,filext)
-
- ;
- ;=====================================================================
- Insert Loops
- for
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- a = wGetColNo()
- wInsLine("for ( $i=1; i <= yy; $i++) {")
- wInsLine(" ;;")
- wGoToCol( a )
- wInsLine("};")
- endif
- drop(a,filext)
-
- foreach
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- a = wGetColNo()
- wInsLine("foreach $var (list) {")
- wInsLine(" ;;")
- wGoToCol( a )
- wInsLine("};")
- endif
- drop(a,filext)
-
- do-while
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- a = wGetColNo()
- wInsLine("do {")
- wInsLine(" ;;")
- wGoToCol( a )
- wInsLine("} while (xx == yy);")
- endif
- drop(a,filext)
-
- while
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- a = wGetColNo()
- wInsLine("while ( xx==yy ) {")
- wInsLine(" ;;")
- wGoToCol( a )
- wInsLine("};")
- endif
- drop(a,filext)
-
- ;
- ;=====================================================================
- Insert Misc
- cond-op (?:)
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- wInsString("test_expr ? if_true_expr : if_false_expr;")
- endif
- drop(filext)
-
- list-variable (@)
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- wInsString("my(@list) = ( str1, str2 );")
- endif
- drop(filext)
-
- hash-variable (%)
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- a = wGetColNo()
- wInsLine("my(%%hash) =")
- wInsLine("{")
- wGoToCol( a+3 )
- wInsLine( "key1 => val1")
- wInsLine( "key2 => val2")
- wGoToCol( a )
- wInsLine("};")
- endif
- drop(a,filext)
-
- Subroutine
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- a = wGetColNo()
- wInsLine("sub funcName")
- wInsLine("{")
- wGoToCol( a+3 )
- wInsLine("# sub BODY")
- wGoToCol( a )
- wInsLine("} #end sub funcName")
- endif
- drop(a,filext)
-
- Subroutine w/prototype
- filext = strupper(FileExtension(wGetFileName()))
- if filext=="PL" || filext=="PM" ; Check to be sure.
- a = wGetColNo()
- wInsLine("sub funcName($$)")
- wInsLine("{")
- wGoToCol( a+3 )
- wInsLine("# sub BODY")
- wGoToCol( a )
- wInsLine("} #end sub funcName")
- endif
- drop(a,filext)
-
- ;
- ;=====================================================================
- _Properties
- wProperties()
-
- ;
- ;=====================================================================
- _File
- New \ ^N
- wFileNew()
-
- Open Selected File \ ^F ; Open selected file
- name = wGetWord()
- length = strlen(name)
- if length==0 then goto DONE
- b = FileLocate(name)
- if b == "" then Message("Open selected file","Cannot find %name%")
- if b == "" then goto DONE
- wFileOpen(b)
- :DONE
- drop(name,length,b)
-
- Open \ ^O
- wFileOpen()
-
- Close \ ^{F4}
- wWinClose()
-
- Print \ ^P
- wPrintDirect()
-
- _FTP Open
- wFtpOpen()
-
- FTP Save
- wFtpSave()
-
-
- ;
- ;=====================================================================
- _How do I?... ; Learn about using scripts
- Customize Menus ; Menu file reference
- helpfile = strcat(DirHome(),"Help\Windows Interface Language.hlp")
- WinHelp(helpFile, "PartialKey", "Menu Files")
-
- Write Macro Scripts ; WIL scripting language reference
- helpfile = strcat(home,"Help\Windows Interface Language.hlp")
- WinHelp(helpFile, "PartialKey", "Tutorial")
-
- Customize this menu... ; Manage WinEdit Popup menu
- TheFile=strcat(DirHome(),"System\PerlPopup.mnu")
- WFileOpen(TheFile)
- Drop(TheFile)
- ;
- ;=====================================================================
-
-