jay185
-
Posts
11 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by jay185
-
-
I have chosen to call my variable %tClip%. You can call it %T[1]% if you like, the difference being that your variable forms the 1st element of an array.
Let me describe the process to you like this:
On my clipboard is this text:
The quick
brown fox
jumps over the
lazy dog
This text consists of 4 lines, each of which ends with 2 invisible characters (carriage return = ASCII 13, line feed = ASCII 10)
So this text is exactly 48 characters long (35 non-space characters, 5 spaces, 4 carriage returns, 4 line feeds).
If you store this text in a variable, its length will be 48 characters.
If you now change all carriage return/line feed combinations to nothing, the length of the variable will become 40 (35 non-space characters, 5 spaces, 0 carriage returns, 0 line feeds).
If you now subtract the new length of 40 from the original length of 48, you get 8.
If you now divide 8 by 2 (2, because we removed 2 characters for each line), you get 4 - which is the answer to your original question "how many lines of text do I have?".
i see what you mean. but what if the text variable is dynamic? this is where i am puzzled. it will compute how many lines that i have copied from clipboard to a text variable...
thanks paul for the explanation
-
This question doesn't make sense! %tClip% is the name of a text variable, into which I have copied the contents of the clipboard (see 1st line of my suggestions).
when you say %tClip% you are referring to the text variable %T[XX]% right? what I dont understand is the saving lenght part. As I understand it, it counts the character of whatever is stored in the text variable.
would it be ok if i request an actual code? so that i can see how it is done.
thanks in advance paul
-
- Save the contents of the clipboard to a variable, e.g. %tClip%
- Save Ascii 13 to a variable, e.g. %tCr%
- Save Ascii 10 to a variable, e.g. %tLf%
- Save the length of %tClip% into a variable, e.g. %nLen%
- Replace all %tCr%%tLf% with "" (i.e. a zero-length string) in %tClip%
- Save the new length of %tClip% into a variable, e.g. %nLenNew%
- Subtract %nLenNew% from %nLen% into a variable, e.g. %nDiff%
- Divide %nDiff% by 2 - and this is your answer
Beware of any final line in the clipboard - if it doesn't end with %tCr%%tLf%, then you'll need to allow for this (e.g. extract the last 2 characters of %tClip% and compare with %tCr%%tLf% - if unequal, append %tCr%%tLf% to %tClip%).
how do you save the length of a %tClip% into a variable?
-
I just need a simple formula that will output the # of text lines from the clipboard.
e.g.
the quick
brown fox
jumps over
the laxy
dog
if we are to start the clipboard from "the" and ends with "dog" then the output should be 5 lines.
any ideas?
-
that's no challenge, its more like you wanted to be taught step by step how it works, and I bet you know how basing from the number of post that you have.
1. the hta code is set into a variable
2. the variable then write it as a file.hta
3. macro runs the created file.hta
4. while the macro loops until file.hta window disappears, you key in data to the file.hta window, if you close this window, it will output a file.mex file
5. macro runs the file.mex file getting all the values
6. macro then displays the value into a window
what you really need to know is vbscript which isn't hard enough.
-
it should be
<CTRLD><SHIFTD>v<SHIFTU><CTRLU>
-
heyyy thanks that worked...
-
I have found a solution for my problem, this is to open up the file itself from notepad, copy the whole file, transfer it to a variable, open a new notepad, then type in by using the variable i used to transfer my previous file. hehehehehe am starting to go crazy
-
I actually can't make this to work...
here's my sample.
My code looks like this.
Variable Set Integer %N1% from PromptVariable Set Decimal %D1% from Prompt
Variable Modify Decimal: Convert %D1% to text string %T1%
Variable Modify String: Save %T1% to Environment Variable
Text File Begin Process: "3pm.txt"
Variable Modify String: Append %T99% to Text File
Text File End Process
actual script
<IVAR2:01:02:FWhat Time?TFCenter:Center><DVAR2:01:02:FAA DailyTFCenter:Center><DMVAR:05:01:1:000000000000001.0000:1:000000000000002.0000><TMVAR2:19:01:00:000:000:%N1%AAD><BTFBEG:099:000001:000000:C:\Documents and Settings\Administrator\Desktop\3pm.txt><TMVAR2:20:99:00:000:000:C:\Documents and Settings\Administrator\Desktop\3.htmF><BTFEND>on the text file is an html code... where as it shows
3pm %3AAD%4pm %4AAD%
5pm %5AAD%
thanks a lot
-
I have a text file that have variables in it. lets say, an html table w/ variables in each table all set to 0.
My problem is, how do I load that text file and save as a different name text file w/ values saved in variable in it?
lets say main.txt contains:
<html><body>
Box 1 contains %T99%
</body></html>
then ME will read the file main.txt and replace the value of %T99% to whatever I set it to (e.g. 100), then it will output a file naming mainb.txt then it shoud contain
<html><body>
Box 1 contains 100
</body></html>
........
is this possible? if so, please help me...
count cr/lf from clipboard
in Macro Express and Macro Express Pro
Posted
but how do I go on counting the # of characters from a text variable?
when i say dynamic, it refers to copy`ing text from anywhere and putting it into a text variable. sorry if i confuse you guys