alimc83 Posted December 8, 2005 Report Share Posted December 8, 2005 Hi I'm trying to get the replace substring command to work. The macro I'm attempting should highlight a line of text, copy it, then paste it replacing the text ":|b" and "|c" with spaces. As is, the program highlights the text and adds it to the clipboard, (I can't really determine whether or not it pastes because everything happens so quickly), yet I can't get it to replace any text . So far here is the script that I've been working on: <TEXTTYPE:<SHIFTD><END><SHIFTU>><CLIPC><TVAR2:01:03:><TMVAR2:21:01:01:001:000:: ><CLIPP> Any help is appreciated Quote Link to comment Share on other sites More sharing options...
kevin Posted December 9, 2005 Report Share Posted December 9, 2005 Here is your macro in the Scripting language. Comments are mine: Text Type: <SHIFTD><END><SHIFTU> // highlight the text in a field Clipboard Copy // Copy it to the clipboard Variable Set String %T1% from Clipboard // Put the content of the clipboard into variable T1 Replace ": " with " " in %T1% // Replace ': ' with ' ' in T1 Clipboard Paste // Paste the content of the clipboard to the field After the second to last macro command runs you have what you want in T1. You could check this by adding a Text Box Display to display the content of T1. The problem with the macro comes in the last line. You paste the content of the clipboard into the field. The clipboard has never been altered. It contains the original content of the field that was copied to the clipboard. Try this: Text Type: <SHIFTD><END><SHIFTU> Clipboard Copy Variable Set String %T1% from Clipboard Replace ": " with " " in %T1% Text Type: %T1% or this: Text Type: <SHIFTD><END><SHIFTU> Clipboard Copy Variable Set String %T1% from Clipboard Replace ": " with " " in %T1% Variable Modify String: Save %T1% to Clipboard Clipboard Paste You should also look at the replacement text. It looks like you are replacing : but not ':|b' and '|c'. To replace two strings you will need to 'Replace' commands. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.