ExtEdit.vbs is a WSH script that greatly simplifies editing Wikipedia pages with external editor.

It's a helper application as described on meta:Help:External editors.


How it works

edit

Next to edit this page link you have a new link.

You click on it and your browser calls ExtEdit, which gets article code from server, puts it into a file on your disk and opens it in your editor.


While in editor you press a key to call ExtEdit, which submits your text to the server as a preview in your browser.


You launch as many previews as needed, when you're finally satisfied you simply press «Save».


Why use it

edit
  • to edit with comfort — in a big editor window with some syntax highlighting
  • for some advanced text operations — e.g. a lot of search and replaces
  • for offline editing; of course, either the page is rarely edited or you put {{inuse}} first
  • for creating new articles


Installation

edit

Download ExtEdit.vbs:

  • directly from my site: ExtEdit.vbs
  • or go to this page, copy the code from textarea and create a local file ExtEdit.vbs yourself.
If you have antivirus software, it will give you a warning when you download and/or execute the script, since all WSH scripts are potentially dangerous. Simply instruct your antivirus to «always allow this script». You're welcome to look at the script code to make sure it does only what it's supposed to do.


Associate .wiki extension with your external editor software.


Configure your browser to call ExtEdit.vbs for application/x-external-editor :

    • FireFox: see Manual:External editors
    • Internet Explorer: there is probably a way to do it properly in IE by modifying registry … For now simply run ExtEdit.vbs, after your permission it will asscociate itself with .php files; it's not a proper way but it works.
    • Opera: click the link below, in «Download file» dialog click «Change», then select «Open with other application», click «Choose» and point to ExtEdit.vbs. Later you can change this in Preferences → Advanced → Downloads


Now click on Wikipedia:Sandbox&externaledit=true and the code should open in your external editor.


Add external edit link to all pages: add to your monobook.js:

//add ExtEdit link 
addOnloadHook(function(){
  var editTab = document.getElementById('ca-edit');
  if (!editTab) return;
  addPortletLink('p-cactions', editTab.firstChild.href   '&externaledit=true',
  '→', 'ca-exted', 'Edit with External Editor ',, editTab.nextSibling);
})


Set up your external editor to call ExtEdit.vbs as an external utility for .wiki files.

Details

edit

When the script is called from the browser, it:

  • recognizes the .php extension of input file
  • analyses the control file index.php
  • requests the page wiki code from MediaWiki server
  • saves it to local disk as .wiki file
  • (if the same .wiki file already exists, it's moved into .\backup subfolder)
  • creates additional .wiki.info file with the page address and LastModified date
  • runs .wiki file (which should open it in your associated editor)


When the script is called from your editor, it:

  • recognizes .wiki extension
  • reads .wiki.info file
  • generates a submit form
  • sumbits the form to MediaWiki server in your browser


If .wiki.info does not exists the script assumes the text to be a new article and it's address is extracted from the 1st line of your .wiki file in html comments, for example:

<!--http://en.wikipedia.org/wiki/User:Alex Smotrov/Draft-->

Edit conflicts

edit

The script saves wpEdittime (Last Modified Date) of the article into .wiki.info file and then uses it in the preview submit form. So if somebody edited the same article by the time you hit «Save» button, MediaWiki server should warn you about edit conflict.

Preview

edit

The script has two different methods for generating a preview:

  • useIEpreview = true (by default):

use Internet Explorer object, then reuse it for next previews. This method makes subsequent previews much faster.

  • useIEpreview = false:

create temporary .htm file, then launch it in your default browser.


Parameters

edit

You can find some other parameters in the beginning of ExtEdit code.



External Editor

edit

Your external editor should support UTF-8.

Other possible features:

  • wiki syntax highlighting
  • easy way to insert some special characters and wiki markup

Right now I'm using free editor Notepad . After some setup it becomes more or less adequate:

  • userDefineLang.xml — syntax highlight file, put it next to notepad .exe (not perfect but I doubt it can be improved much). [Note: Only works with a while background style, such as the Default Notepad style]
  • MediaWiki.api — an example of «quick inserts» list which is called by Ctrl-Enter, put it into .\plugins\APIs
  • Go to menu Run → Run, insert your_path\ExtEdit.vbs $(FULL_CURRENT_PATH), click Save, choose a hot key (for example F12), press Ok.


To enter often used special characters you can also edit you keyboard layout (you will be able to use it in your browser too!) with Microsoft Keyboard Layout Creator (free download afer Windows Validation).


Comments about some other text editors: