Jump to content
Macro Express Forums

theSteve

Members
  • Posts

    12
  • Joined

  • Last visited

Posts posted by theSteve

  1. I suggest that you first request this as a feature from ISS.

     

    Second I suggest you use the Windows Ping command as a work-around. Use the Program Launch command like I did here

    <PROGRAM LAUNCH Path="ping.exe" Mode="\x03" Parameters="192.168.2.2" Default_Path="TRUE" Wait="1" Get_Console="TRUE" Console_Dest="%Test%"/>
    

    Notice I'm running it as hidden so nothing is apparent to the user. In this case I'm pinging 192.168.2.2 but you will change that to suit your needs. Now all you need to do is grab whatever relevant data you like from %Test% variable. If you need help with that let me know but I didn't want to muddy the waters by including that at this point. With this command result you could either use the average result at the bottom or you could use the "-n 1" parameter to have it ping only once. Just type "Ping -?" at a command prompt to get a complete list of parameters. The benefit of one ping is the quickness of execution. But often pings miss and that's why by default the ping command pings 5 times and gives an average.

     

    BTW if you choose to capture the command output MEP will wait for the command to complete before moving forward.

     

    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

  2. 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

  3. 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.

  4. 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.

  5. 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?

  6. 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

  7. 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?

  8. 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 :P

  9. 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?

  10. 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?

×
×
  • Create New...