cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

ACL to convert curly quote to straight quote on save

Regular Member

ACL to convert curly quote to straight quote on save

Our editors are copying from Word and pasting into AE regularly. The Word documents they are working with are produced by a variety of external sources anduse the full spectrum of quotes. Does anyone have a snippet of ACL that can be run on save (XML)to convert all quotes to simple straight quotes?


Thanks for your help all!
Ashley

Tags (2)
2 REPLIES 2
Highlighted

EXTERNAL: ACL to convert curly quote to straight quote on save

No code at all solution:
The first thing to do is turn off "replace straight quotes with smart quotes" in Word Auto Correct (and check the AutoFormat tab also).
Then, click on replace, select a left quote in what to replace
Put a straight quote in the replace with field.
Click on replace all. The select a right quote and repeat.
Then save your word document, This is from Outlook but Word has the same thing:

[cid:image001.png@01CD5543.2DC816F0]

Possible ACL solution (untested):
Or, you might try entering this on the AE command line. No guarantee and if it causes you PC to melt into a puddle of green slime please send pictures.:
sub '[״]"
sub '[˝]"

-Andy
\ / Andy Esslinger LM Aero - Tech Order Data
_____-/\-_____ (817) 279-0442 1 Lockheed Blvd, MZ 4285
\_\/_/ (817) 777 3047 Fort Worth, TX 76108-3916
Highlighted

RE: ACL to convert curly quote to straight quote on save

I had this same issue a few years ago and solved it by adding a callback function whenever a paste is done in arbortext. This may look convoluted and could probably be simplified but it works. I put this line in the instance.acl of the document:


doc_add_callback( current_doc(), 'paste', 'paste_callback');


and the function is this:


function paste_callback( doc, default, op )
{
if ( op == 1 )
{
# returning the -1 aborts the paste operation which is what we want since
# sub_quote will do it instead
sub_quote;
return -1;
}
else if ( op == 2 )
{
# this is where processing occurs

return 0;
}
}


which calls this:


#THIS ALIAS WILL SUBSTITUTE STRAIGHT QUOTES FOR CURLY QUOTES ON PASTE OPS
alias sub_quote {
if (buffer_doc(_APT_DRAGDROP_PASTEBUF) != -1) {
if (buffer_empty(_APT_DRAGDROP_PASTEBUF) == 0) { #Then we have a drag/drop op
set paste = _APT_DRAGDROP_PASTEBUF;
paste;
set paste=default;
return;
}
} else {
buffer_clipboard_contents($oldtxt);
}
$newtxt = java_static('id.lso.gems.epic.EpicUtil', 'subCurlyQuotes', $oldtxt);
insert_buffer($newtxt, 1, default,0);
#set pendingdelete=on;
if (length($newtxt) > 0) {
paste; #testbuf;
} else {
message_box("Paste buffer is empty. Please select text you wish to copy and try again.", 0);
}
set paste=default;
}


The java function is:


public static String subCurlyQuotes(String selectedText) {
selectedText = selectedText.replaceAll(String.valueOf('\u201C'), "");
selectedText = selectedText.replaceAll(String.valueOf('\u201D'), "");

return selectedText;
}

Announcements