Jump to content
Macro Express Forums

Creating A Csv File For Later Use


Recommended Posts

Hi everyone,

Here's what I'm starting with, a file creation.

<LAUNCHDEL2:0:01C:\WINNT\system32\notepad.exe><TEXTTYPE:<ALTD>fa<ALTU>><TEXTTYPE:C:\AutoImports\><DT:MMMM dd yyyy(hh-mmAMPM)F:00:1:><TEXTTYPE:<END>><TEXTTYPE:.csv<SHIFTD><HOME><SHIFTU><CONTROL>c><CLIPC><TVAR2:80:03:><DIS:<TEXTTYPE:<ENTER>><TBOX4:T:1:CenterCenter000278000200:000:%T80%>



It's a csv file that has a title of the current date and time and the file will be used later in the run. Specifically about 3 MacroRun calls later. I want to append text to it. If I'm setting up my code now for the append and don't know the name, what do I do? Thanks

Does this make any sense?



Link to comment
Share on other sites



Here a 2 things;

1. improve the way you are doing it (wait for windows etc)

2. Use the file and add to it without opening notepad;


see below

    Macro Express Script for "csv" (No Activation) 20/01/2005 3:35 PM


    Launch and Activate: "notepad.exe"

    Text Type: <ALT>fa

    Wait For Window Title: "Save As"

    If Not Folder Exists "c:\AutoImports"

    Create Folder: "C:\AutoImports\"

    End If

    Text Type: C:\AutoImports\

    Date/Time: Type out "MMMM dd yyyy(hh-mmAMPM)"

    Text Type: <END>

    Text Type: .csv<CONTROL><SHIFT><HOME>

    Clipboard Copy

    Variable Set String %T80% from Clipboard

    Text Type: <ENTER>

    Text Box Display:

    Launch and Activate: "%T80%"

    Text Type: <ALT>fo

    Wait For Window Title: "Open"

    Text Type: %T80%<ENTER>

    Macro Return

    // Better might be... ?

    Variable Set String %T1% ""

    Variable Set String %T2% "c:\AutoImports\"

    Date/Time: Save "dddd d MMMM yyyy" into %T3%

    Date/Time: Save "(h mm AMPM)" into %T4%

    Variable Set String %T1% ".csv"

    Variable Modify String: Save %T1% to Text File

    // Then later add to file or open if needed as originally

    Variable Modify String: Append %T10% to Text File


<LAUNCHNO3:0:0112Notepad<LAUNCH:C:\WINdows\system32\notepad.exe><TEXTTYPE:<ALT>fa><WAITWIN2:000010:000000:Save As><IFOTH:10:1:c:\AutoImports><DOFILE:02:NN:C:\AutoImports\>><ENDIF><TEXTTYPE:C:\AutoImports\><DT:MMMM dd yyyy(hh-mmAMPM)F:00:1:><TEXTTYPE:<END>><TEXTTYPE:.csv<CONTROL><SHIFT><HOME>><CLIPC><TVAR2:80:03:><TEXTTYPE:<ENTER>><TBOX4:T:1:CenterCenter000278000200:000:%T80%><LAUNCHNO3:0:0112Notepad<LAUNCH:%T80%><TEXTTYPE:<ALT>fo><WAITWIN2:000010:000000:Open><TEXTTYPE:%T80%<ENTER>><MRETURN><REM2:Better might be... ?><TVAR2:01:01:><TVAR2:02:01:c:\AutoImports\><DT:dddd d MMMM yyyyT:03:1:><DT:(h mm AMPM)T:04:1:><TVAR2:01:01:.csv><TMVAR2:17:01:00:000:000:%T2%%T3%%T4%%T5%F><REM2:Then later add to file or open if needed as originally><TMVAR2:20:10:00:000:000:%T2%%T3%%T4%%T5%T>


What do you think?


Best, Randall

(Not a programmer here, just interested in the forum and learning...

Link to comment
Share on other sites


Slick...that's what I could not think of...duh me.

We're adopting a constant file name and appending to it and I have a new scenerio.

Columns A and B are start and end date for the import. Keep in mind end date can be the next day. Columns C and D are the times in this format, 12:35:22.690.

I'm not worried about the format but am on how Excel is handleing the append, or is it ME. Column J is the elapsed time calculated D3-C3+IF(D3>C3,1). A simple way too is just D3-C3 but this does not take into account ending on the next day as the other does. The problem is having the formula in place before the data gets there. It appends to the next free line and not to the line directly below one that is already populated (because I have a formula in place). What I have not done so far is tried to calc here in ME prior to appending, searched Excel for an auto calc on load. I have Pupv5(Excel) addon that may be able to help too. This tool is pretty nifty. Any thoughts ...always appreciated



Link to comment
Share on other sites

  • 3 weeks later...

Question for the Guru's.

I'm appending %T2%,%T3%,%T4%,%D2% to a .csv file.

T2 holds text that will not be longer than Len=5

T3 and T4 are the following format - m-dd-yyyy 99:99:99

D2 will come in at 14 decimal places.


My problem is with the Column widths of T3,T4, and D2. I've done a AutoFit and saved, but each time I append to this file, they retun to a width of 8.1. I need the width to be wider....UGH!



Link to comment
Share on other sites



I am no guru! but interested in data transfer.


What program are you using that uses "columns" and "autofit"?


A ".csv" is simply a "comma-delimited text file", isn't it? - So it has no columns unless you import it into something like Excel. How excel handles it is probably a question for an Office forum group!


If you need to keep each string or item the same width each time it is entered, perhaps change each to a string, then "string modify "pad" a fixed amount with plenty of room before appending?


Best, Randall


(PS - If you "autofit" in excel, it may then change this? - Although I thought "Autofit" in excel only affected the screen display column width, not the saved column width in the saved file?) - Again, "How excel handles it is probably a question for an Office forum group!")


<TVAR2:02:01:abcde><TMVAR2:15:02:00:005:000:><TVAR2:03:01:9-09-2005 99:99:99><TMVAR2:15:03:00:020:000:><TVAR2:04:01:9-09-2005 99:99:99><TMVAR2:15:04:00:020:000:><DMVAR:05:02:1:000000000000005.0000:1:000000000000014.0000><TMVAR2:15:05:00:020:000:><REM2:Make sure all sizes are adequate?)>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...