theSteve
-
Posts
12 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Posts posted by theSteve
-
-
You see you said "Last Record". In data parlance with regards to text files a record is synonymous with a row. What you should have said was "Last Value" or "Last field of a record."
Oops! Sorry.
So let me give my advice to your problem. To get the last time stamp in your example I would read the whole file in as a string variable, get the length of the string, then count backward until I found the first comma, add two and copy that chunk.
I'm a little embarassed that I didn't think of that myself...
Also might want to consider using decimal time vars to make teh 30 day calculation easy.
Another great suggestion but I made a date comparison macro... oh well, at least it was good for practice.
Thanks a lot for your help, Cory.
TheSteve
-
This comment proves you do not understand how this command works. TO use an Excel analogy I believe you are thinking of rows instead of columns. I know you have solved your need in the way I suggested already but you might want to take some time to understand this command as well as it is very useful. I just don't want you to miss out on a cool command because you don't understand how it works.
I think you're right. I'm just not seeing something.
Let me put this into an example.
I have a macro that performs an action on a series of items, all with serial numbers. When the action is complete, a folder is named after that serial number. Inside that folder, a text file is also named after the serial number. Inside the text file, I am placing a date/time stamp.
For example:
Serial number 10001
folder created: 10001
file created: 10001.txt
contents of file: 05/10/2010 11:20:45 AM
My macro then goes through all the serial numbers and a large series of these folders/files exist.
The NEXT time the macro processes the SAME serial number, 10001, another time stamp is appended, and the contents of the file 10001.txt are as follows:
05/10/2010 11:20:45 AM, 05/11/2010 11:01:20 AM
My processing macro will act differently if the CURRENT date is less than 30 days later than the LAST PROCESSED date in the text file.
So basically, I always want to compare my current date against the FINAL value of the text file.
-
You are indeed incorrect. You 'feed' it a file, you store the results in an array. And the result is not one element for each line, it's one element for each delimited value (think columns) per line. Experiment a little with it and you will quickly see. Don't fret, it won't bite.
Oh I've played with it a LOT. And I love it. Just seems weird it NEEDS an array.
My problem was that I only want ONE value ... the LAST one.
So an array is useless to me. Because in my situation, I don't know how many delimited values are in the text file.
I changed my macro to use CR after the value when building the text file (instead of commas) and now use TEXT FILE PROCESS instead of ASCII to process the built text file. Problem solved.
-
You can use the ASCII File Process commands in the exact same manner:
ASCII File Begin Process: YourFilePathAndName ASCII File End Process Text Box Display:
Really? Am I incorrect in my belief that ASCII File processing needs to be fed an ARRAY variable?
Under the understanding that an array IS mandatory here:
If I process to %T%, it stores the FIRST value of the file in %T[1]%, second to %T[2]%, and so on...
... but I have no way of knowing how many values are in the text file... so how would I get the FINAL value?
-
Just read the file; when the file is closed, your variable will contain the value of the last row.
Text File Begin Process: YourFilePathAndName Text File End Process Text Box Display:
<TEXT FILE BEGIN PROCESS Filename="YourFilePathAndName" Start_Record="1" Process_All="TRUE" Records="1" Variable="%tData%"/> <TEXT FILE END PROCESS/> <TEXT BOX DISPLAY Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang3081{\\fonttbl{\\f0\\fnil\\fcharset0 Tahoma;}{\\f1\\fnil Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs16 This should be the last line of your file!\r\n\\par \r\n\\par %tData%\\f1 \r\n\\par }\r\n" Left="Center" Top="Center" Width="278" Height="200" Monitor="2" OnTop="FALSE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>
Hm, that makes sense.
I was trying to use CSV files and ASCII Text File Process command, which ONLY accepts an ARRAY instead of a single string variable.
But I suppose I can change the text file to a line-by-line format instead of csv.
Thanks Paul,
theSteve
-
Does anyone know a way to get just the LAST record from a CSV text file?
(The CSV file is generated when the DATE/TIME is appended to a text file at the time of another macro's execution.)
So my CSV will look like this:
04/28/2010 4:22:15 PM, 04/30/2010 1:15:02 PM, 05/01/2010 7:45:50 AM,
I want to store the last entry to a variable.
-
If you use a variable that exists, then it will be evaluated. But if you use a variable that does not exist, then it will not. Change "I like to eat %T[1]%." to "I like to eat %NoVariable%."
That works for me, Kevin. Thanks a million.
theSteve
-
Here's what I'm trying to do:
I have an Excel cell with this content, which I'm copying to clipboard:
"I like to eat %T[1]%."
(Assume %T[1]% is set to "Apples")
I'm setting string variable %cellContent% to the clipboard contents, then appending %cellContent% to a text file, named Fruit.txt.
I want Fruit.txt to read: "I like to eat %T[1]%."
I DO NOT want Fruit.txt to read: "I like to eat Apples."
Is this possible?
-
I don't use the Ping command but I get the same short string that you reported. You could use the Date/Time command before and after to calculate the time for a response.
Thanks for the idea... but ping response is recorded in milliseconds... i dont think the date/time command will provide that specific or precise a record. It really just seems that PRO has taken a step backwards from ME3 in this case.
edit>correct me if i'm wrong here, though. your solution could be completely valid and here i am just dismissing it
-
In Macro Express 3, the Ping Site command returns a detailed string of text (including the response time).
It looks like in Macro Express Pro, the PING SITE command only returns whether or not the ping was successful. So basically, it has the same functionality as the "IF PING SUCCESSFUL" command.
Am I missing something? Is there a way to get the detailed string (my concern is response time) from a ping in MEpro?
-
Hey,
I'm having troubles with the PING SITE command.
I'm using Windows 7, and am behind a router... and normally consider myself an "advanced" pc user.
The PING SITE command is ALWAYS returning "Unknown Host" to the selected string variable. Internet works fine. From command prompt, the "ping" command works fine.
The same macro, run from an XP machine at my work, works fine.
I tried disabling the Windows 7 - Windows Firewall, and that didn't help either.
Any ideas?
Ping Site functionality... ME3 vs. MEpro
in Macro Express and Macro Express Pro
Posted
Cory... this is so awesome. I didn't even know you could run command line processes hidden. This is a huge deal for me. hahaha.
Thanks,
theSteve