www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  Scripting    Useful jscript to edit text strings copied into for example KeyWords field
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Posted
This script can be used to edit a text line that has been put/copied into a field and, as you save the record, insert an Entry Mark instead of “comma”, “semicolon”, "carriage return" or “line feed” in for example a KeyWord list. Could be altered/developed for other purposes.

// Use replace options to edit text boxes with unwanted text/appereance:
// replace(/; /g, "\u001F") replaces semicolon + space to Entry Mark Separator
// replace(/\, /g,"\u001F") replaces comma + space to Entry Mark Separator
// replace(/\r/g,"\u001F") replaces Line Feed (LF) to Entry Mark Separator
// to replace different signs at the same time put an paranthesis around the sign(s) you want to replace
// In the following jscript, semicolon + space, comma + space, semicolon, comma, carriage return and line feed are replaced with an Entry Mark Separator.

function onRecordSave()
{
var KW1 = Form.boxes("KW").content;
var KW2 = KW1.replace(/(; )|(\, )|(Wink|(,)|(\r)|(\n)/g,"\u001F");
Form.boxes("KW").content = KW2;
}

Jscript created by Nils-Erik Engström, Falun, Sweden


NEEngstrom
 
Posts: 40 | Location: Falun, Sweden | Registered: Tue September 17 2002Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
How come you're using \u0001F instead of the Application.entrySeparator constant?


Peter Tyrrell, MLIS
Senior Consultant
Andornot Consulting Inc.
http://www.andornot.com/about/developerblog
 
Posts: 179 | Location: Vancouver, BC, Canada | Registered: Thu September 20 2001Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
I earlier asked for help to make a script about changing "comma" to "Entry Mark" but got no responses.

The only reson why I used \u0001F is that I saw some correspondance where \u0001F were used to search for Entry Marks. I agree that it would be as good to use Application.entrySeparator instead.

This means that function onRecordSave()
{
var KW1 = Form.boxes("KW").content;
var KW2 = KW1.replace(/(; )|(\, )|(Wink|(,)|(\r)|(\n)/g,Application.entrySeparator);
Form.boxes("KW").content = KW2;
}

would function as gtood as my first distributed script.


NEEngstrom
 
Posts: 40 | Location: Falun, Sweden | Registered: Tue September 17 2002Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  Scripting    Useful jscript to edit text strings copied into for example KeyWords field