How to insert text anywhere in a text body

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
Claudiu
Posts: 32
Joined: Fri Aug 07, 2009 10:16 am

How to insert text anywhere in a text body

Post by Claudiu » Thu Jan 13, 2011 1:32 am

Hi,

I have a form that is filled with an article and i need to insert somehow into this body a specific text.
The text can be either inserted from the clipboard or from the database file.
Also the text needs to be inserted in the article ANYWHERE but the beginning or the end of the article

i found a thread where some indications have been made about making this work. the thread is this http://forum.imacros.net/viewtopic.php?f= ... t=0#p32212

Thing is with the thread above is that the solution shown, didn't work for me; as in no text has been inserted nowhere in the article.

Below you can see the code lines that i've tried and which failed to insert my specific text.

Code: Select all

macro3 = macro3 + "DS CMD=KEY X=535 Y=331 CONTENT={{!CLIPBOARD}}"    + vbNewLine
macro3 = macro3 + "DS CMD=KEY X=535 Y=331 CONTENT=#PASTE#Text<SP>Here"    + vbNewLine
macro3 = macro3 + "DS CMD=KEY X=535 Y=331 CONTENT=Text<SP>Here"    + vbNewLine
scripts tested on iMacros browser 7.12.1109. I'm using the trial version(if it has to do with this please let me know).

I'll explain below each line from the code above:
-for the clipboard to work, i copied a title of a file from the desktop and the ran the vbs script
-for the #paste# and the line underneath it, i expected the Text<SP>Here to be inserted
-the coordinates are a random place, somewhere inside the form that is filled with the article.


to make it easier to understand, below are the steps that my macro has to do.
1. insert insert article into a form - problem solved
2. insert specific text somewhere into the article , anywhere but the beginning or end of the article - problem that i need help with
Tom, Tech Support
Posts: 3601
Joined: Mon May 31, 2010 4:59 pm

Re: How to insert text anywhere in a text body

Post by Tom, Tech Support » Mon Jan 24, 2011 5:30 pm

Hi Claudiu,

Below is a variation of the FillForm demo macro that installs with iMacros. I modified it to insert the contents of the clipboard into the middle of the textarea field.

Code: Select all

VERSION BUILD=7121109
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://www.iopus.com/imacros/demo/v6/f1/form.asp
SIZE X=796 Y=869
'We use quotation marks for a content with spaces
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:TestForm ATTR=NAME:Name CONTENT="Tom Tester"
'We manually changed the TAG command from using the postion of a value (e. g. "2") 
'to using its real name, e. g. "Pizza"
TAG POS=1 TYPE=SELECT FORM=NAME:TestForm ATTR=NAME:main CONTENT=$Pizza
TAG POS=1 TYPE=SELECT FORM=NAME:TestForm ATTR=NAME:drink CONTENT=$Water
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:TestForm ATTR=NAME:C7&&VALUE:ON CONTENT=YES 
'If you want to select more than one, use a colon (:)
TAG POS=1 TYPE=SELECT FORM=NAME:TestForm ATTR=NAME:dessert CONTENT=$"Apple Pie":$Fruits 
TAG POS=1 TYPE=INPUT:RADIO FORM=NAME:TestForm ATTR=NAME:Customer&&VALUE:Yes CONTENT=Yes 
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:TestForm ATTR=NAME:Reg_code CONTENT=demo123 
'In a quoted content, we can use \n for a new line, \t for tab and \" for literal quotes
TAG POS=1 TYPE=TEXTAREA FORM=NAME:TestForm ATTR=NAME:Remarks CONTENT="Hi!\n\n\"iMacros\" fills forms ;-)\n\n\t\tTom"

DS CMD=CLICK X=358 Y=438 CONTENT={{!CLIPBOARD}}
Regards,

Tom, iMacros Support
Post Reply