Jump to content
Macro Express Forums

randallc

Members
  • Posts

    434
  • Joined

  • Last visited

Posts posted by randallc

  1. Hi,

    more simply, try;

    Write in macro express;

    1. activate word window, appropriate document (form)

    2. CRL-G -"goto" -wait

     

    etc;

    <ACTIVATE2:- Microsoft Word><REM2:1st field  "text1" ?><TEXTTYPE:<CONTROL>g><WAITWIN2:000010:000000:Find and Replace><TEXTTYPE:Text1<ENTER>><IMSD:30><TEXTTYPE:Text4<ENTER>><WCLS:Find and Replace><WAITWLF2:000010:000000:Find and Replace><CLIPC><TVAR2:01:03:><REM2:2nd field  "text2" ?><TEXTTYPE:<CONTROL>g><WAITWIN2:000010:000000:Find and Replace><TEXTTYPE:Text4<ENTER>><IMSD:30><TEXTTYPE:Text4<ENTER>><WCLS:Find and Replace><WAITWLF2:000010:000000:Find and Replace><CLIPC><TVAR2:02:03:><REM2:3rd field  "text3" ? etc>
    Activate Window: "- Microsoft Word"

    // 1st field  "text1" ?

    Text Type: <CONTROL>g

    Wait For Window Title: "Find and Replace"

    Text Type: Text1<ENTER>

    Delay 30 Milliseconds

    Text Type: Text4<ENTER>

    Window Close: "Find and Replace"

    Wait Window Lose Focus: "Find and Replace"

    Clipboard Copy

    Variable Set String %T1% from Clipboard

    // 2nd field  "text2" ?

    Text Type: <CONTROL>g

    Wait For Window Title: "Find and Replace"

    Text Type: Text4<ENTER>

    Delay 30 Milliseconds

    Text Type: Text4<ENTER>

    Window Close: "Find and Replace"

    Wait Window Lose Focus: "Find and Replace"

    Clipboard Copy

    Variable Set String %T2% from Clipboard

    // 3rd field  "text3" ? etc

     

    All this macro would do would be to copy the content; but you could get the properties too to strings by opening that box in your picture once you are there;

    Text Type: <APP>r

    Wait For Window Title: "Text Form Field Options"

    Text Type: <ALT>e<CONTROL>c

    Variable Set String %T3% from Clipboard

    etc

     

    Best, Randall

  2. Hi,

    here's a non-guaranteed Word macro which calls the next NMEX3 macro at the end;

    Sub fieldfind()

    'To do it simply, set this macro to a toolbar menu which you can get from MEx3

    ' by simple key presses; at the end, it will call your macro to continue

    'and recover the strings from the registry entries you have made

    ' At least to give an idea.....

    Dim MacEx3, strSection, strPicker, strDestination

    strSection = "HKEY_CURRENT_USER\Software\Professional Grade Macros" _

            & "\PGM Functions\Swap"

    Selection.HomeKey Unit:=wdStory, Extend:=wdMove

    ActiveDocument.Fields.Update

    Do While Not (Selection.NextField Is Nothing)

    fieldNumber = fieldNumber + 1

    System.PrivateProfileString("", strSection, _

        "Field" + fieldNumber) = Selection

    'MsgBox (Selection)

    Loop

    MacEx3 = "c:\program files\macro express3\"

    On Error Resume Next

    Shell (MacEx3 + "meproc.exe /ARetrieverFromRegistryMacro")

     

    End Sub

    What do you think?

    Randall

  3. Hi,

    I have successfully run macros in word which send info to MEX text strings.

    If you can record a Word macro to record the info you want first, this could be run and the info sent?

    I have not made a macro looking for field name content, but I bet it is possible.

    Best, Randall

  4. Hey, Good work!

    Thanks for that.

    If you only want 3 lines and want to name them and the title on the fly; try;

    // Set Form Title

    Variable Set String %T1% "My Title Whatever I Want"

    Variable Modify String: Save %T1% to Environment Variable

    // Set Field Label 1

    Variable Set String %T1% "Field1 - Surname "

    Variable Modify String: Save %T1% to Environment Variable

    // Set Field Label 2

    Variable Set String %T1% "Field2 - Firstname"

    Variable Modify String: Save %T1% to Environment Variable

    // Set Field Label 3

    Variable Set String %T1% "Field3 - email"

    Variable Modify String: Save %T1% to Environment Variable

    // Run macro

    Macro Run: {_Form3}

    // Display or retrieve 3 fields

    Repeat Start (Repeat 3 times)

      Read Registry String: "FieldName%N1%"

      Variable Modify String: Save %T1% to Environment Variable

      Variable Modify String: Append "FieldName%N1% = " to %T2%

      Variable Modify String: Append "%T1%%CRLF%" to %T2%

    Repeat End

    Text Box Display:

    <REM2:Set Form Title ><TVAR2:01:01:My Title Whatever I Want><TMVAR2:19:01:00:000:000:Title><REM2:Set Field Label 1><TVAR2:01:01:Field1 - Surname ><TMVAR2:19:01:00:000:000:Field1><REM2:Set Field Label 2><TVAR2:01:01:Field2 - Firstname><TMVAR2:19:01:00:000:000:Field2><REM2:Set Field Label 3><TVAR2:01:01:Field3 - email><TMVAR2:19:01:00:000:000:Field3><REM2:Run macro><MACRUN2:{_Form3}><REM2:Display or retrieve 3 fields><REP3:01:000001:000001:00003:1:01:><REGRSTR:1:HKEY_CURRENT_USER\Software\Professional Grade Macros\PGM Functions\Swap\FieldName%N1%><TMVAR2:19:01:00:000:000:FieldName%N1%><TMVAR2:07:02:00:000:000:FieldName%N1% = ><TMVAR2:07:02:00:000:000:%T1%%CRLF%><ENDREP><TBOX4:T:1:CenterCenter000278000200:000:T2=

    =====================================

    %T2%>

    Best, Randall

    EDIT; "{_Form3} corrected, replaced

    __Form3_.mxe

  5. Hi,

    Here's an idea (example too to run to check if you want?...)

    1. Sort the file.

    2. AScii process the file to check first and last entry for each ID

    // Sort file first

    // Initialise Dos Sort

    // Set Filename (and here, make example)

    // Shut DOS in background if still running

    // Set SORT switches

    // Sort to Answertxt file

    // Change spaces to commas, to use Ascii file process of csv file later

    // process FIRST file lines

      // Write FIRST line of ID file

    // process file lines till second field (T2) not the same

      // if it's a new ID

        // Write LAST line of previous ("Current") ID file for that ID, and FIRST of next ID

      // THEN; Re-assign the latest TIME for that Current ID

    // Write LAST line of previous ("Current") ID file for that ID; at END

    Best, Randall

    SortIDandTIMES2.mxe

  6. [EDIT]Hi again;

    Perhaps I have mis-understood, or messed up the script?

    Do you want the whole file on 1 line with commas instead of "CRLF", or do you want commas in the "csv" file to replace the "space"s?

    Here with the spaces;

    <REM2:text fileread; initialise><ASCIIC:2:1:10><ASCIIC:3:1:13><TMVAR2:08:03:02:000:000:><TMVAR2:19:03:00:000:000:CRLF><ASCIIC:3:1:9><TMVAR2:19:03:00:000:000:TAB><VSETMISC:T1:Installation Path><TMVAR2:19:01:00:000:000:InstallPath><REM2:Set File Name to Parameter1><TVAR2:01:01:%InstallPath%\File.txt><TMVAR2:19:01:00:000:000:Parameter1><REM2:Set from prompt if needed><IFOTH:01:2:%Parameter1%><TVAR2:01:01:%Parameter1%><ELSE><TVAR2:01:01:%InstallPath%\File.txt><TVAR2:01:02:FFile name?FFCenter:Center><TMVAR2:19:01:00:000:000:Parameter1><DOFILE:05:NN:%T1%>%InstallPath%\temp.txt><ENDIF><TMVAR2:19:01:00:000:000:FileName><REM2:Retrieve first line, count commas; add one for number fields answer><TVAR2:01:04:%InstallPath%\File.txt><TMVAR2:21:01:01:000:000: ,><TMVAR2:17:01:00:000:000:%InstallPath%\File.csvT><LAUNCHDEL2:0:01%InstallPath%\File.csv>

    Best, Randall

  7. Hi,

    I presume you want all the text file appended as 1 csv line?; [if you have lots of txt files to process, set "T1" through "repeat with folders", set full file path of files to "T1"]

    <REM2:text fileread; initialise><ASCIIC:2:1:10><ASCIIC:3:1:13><TMVAR2:08:03:02:000:000:><TMVAR2:19:03:00:000:000:CRLF><ASCIIC:3:1:9><TMVAR2:19:03:00:000:000:TAB><VSETMISC:T1:Installation Path><TMVAR2:19:01:00:000:000:InstallPath><REM2:Set File Name to Parameter1><TVAR2:01:01:%InstallPath%\File.txt><TMVAR2:19:01:00:000:000:Parameter1><REM2:Set from prompt if needed><IFOTH:01:2:%Parameter1%><TVAR2:01:01:%Parameter1%><ELSE><TVAR2:01:01:%InstallPath%\File.txt><TVAR2:01:02:FFile name?FFCenter:Center><TMVAR2:19:01:00:000:000:Parameter1><DOFILE:05:NN:%T1%>%InstallPath%\temp.txt><ENDIF><TMVAR2:19:01:00:000:000:FileName><REM2:Retrieve first line, count commas; add one for number fields answer><TVAR2:01:04:%InstallPath%\File.txt><TMVAR2:21:01:01:000:000:%CRLF%,><TMVAR2:20:01:00:000:000:%InstallPath%\File.csvT><LAUNCHDEL2:0:01%InstallPath%\File.csv>
    // text fileread; initialise

    Variable Set %T2% to ASCII Char of 10

    Variable Set %T3% to ASCII Char of 13

    Variable Modify String: Append %T2% to %T3%

    Variable Modify String: Save %T3% to Environment Variable

    Variable Set %T3% to ASCII Char of 9

    Variable Modify String: Save %T3% to Environment Variable

    Set Variable %T1% to "Installation Path"

    Variable Modify String: Save %T1% to Environment Variable

    // Set File Name to Parameter1

    Variable Set String %T1% "%InstallPath%\File.txt"

    Variable Modify String: Save %T1% to Environment Variable

    // Set from prompt if needed

    If File Exists "%Parameter1%"

      Variable Set String %T1% "%Parameter1%"

    Else

      Variable Set String %T1% "%InstallPath%\File.txt"

      Variable Set String %T1% from Prompt

      Variable Modify String: Save %T1% to Environment Variable

      Copy File or Files: "%T1%"

    End If

    Variable Modify String: Save %T1% to Environment Variable

    // Retrieve first line, count commas; add one for number fields answer

    Variable Set String %T1% from File: "File.txt"

    Replace "%CRLF%" with "," in %T1%

    Variable Modify String: Append %T1% to Text File

    Program Launch: "File.csv"

    Best, Randall

    EDIT' [if you have lots of txt files to process, set "T1" through "repeat with folders", set full file path of files to "T1"]

  8. Hi,

    I'm not sure how reliable (won't work properly and will shutdown if both Web Pages in links in same explorer have same window title, as it relies on a change....), but seems to work?...

    <TVAR2:01:06:><TEXTTYPE:<ALT><ARROW LEFT>><WAITWEB2:000010:000000:><TVAR2:02:06:><IFVAR2:4:02:1:T1><WCLS:"CURRENT"><ENDIF>
    Variable Set String %T1% from Window Title

    Text Type: <ALT><ARROW LEFT>

    Wait for Web Page: ""

    Variable Set String %T2% from Window Title

    If Variable %T2% = variable %T1%

      Window Close: Current Window

    End If

    I doubt the registry issue, cause it's a java thing from the Website, probably....

    Best, Randall

  9. Hi,

    1. You may be able to speed it up ; there is a command; paste some code to sort out the problem?

    Macro Control, macro playback speed/ mouse playback speed etc on that command.

    2. That might be possible to calculate once you have (1) sorted, or it may be better to speed it up, then wait till a preset time - schedule it to run every 150 secs? (or timer macro on ME3 examples on Web site? - or in this forum)

    3. If the 2 programs have different "control" index, you might be able to use "get Control" on each one, and "set focus to control" for C1 or C2, say, for using each one.

    4. As you start the macro, "Set String variable" to name of current window title; then at the end, "window activate" T1, or whatever string you used.

    Let me know; post some code.

    best, Randall

  10. Hi,

    Probably the main thing is to check the clipboard has time ; you could just set a 1/2 sec delay, or add these others;

    <REM2:Make sure your window has focus (or even the control if still problems with timing)><ACTIVATE2:notepad><WAITWIN2:000010:000000:notepad><TEXTTYPE:<HOME><SHIFT><END>><CLIPE><CLIPC><REM2:Make sure it has copied before proceeding (won't work idf the field could be empty, unless you accept only a certain number of checks)><TVAR2:01:01:><REP3:01:000001:000001:00020:0:01:><NMVAR:08:01:0:0000001:0:0000000><IMSD:25><TVAR2:01:03:><IFVAR2:1:01:2:><EXITREP><ENDIF><ENDREP><REM2:End of copy check><DVAR2:01:03:><REM2:Add a little leeway><IMSD:100><DMVAR:01:01:1:000000000000001.0000:2:.05><REM2:Make sure your window has focus (or even the control if still problems with timing)><ACTIVATE2:notepad><WAITWIN2:000010:000000:notepad><TEXTTYPE:%D1%>
    // Make sure your window has focus (or even the control if still problems with timing)

    Activate Window: "notepad"

    Wait For Window Title: "notepad"

    Text Type: <HOME><SHIFT><END>

    Clipboard Empty

    Clipboard Copy

    // Make sure it has copied before proceeding (won't work idf the field could be empty, unless you accept only a certain number of checks)

    Variable Set String %T1% ""

    Repeat Start (Repeat 20 times)

      Variable Modify Integer: Inc (%N1%)

      Delay 25 Milliseconds

      Variable Set String %T1% from Clipboard

      If Variable %T1% <> ""

        Repeat Exit

      End If

    Repeat End

    // End of copy check

    Variable Set Decimal %D1% from Clipboard

    // Add a little leeway

    Delay 100 Milliseconds

    Variable Modify Decimal: %D1% = %D1% + .05

    // Make sure your window has focus (or even the control if still problems with timing)

    Activate Window: "notepad"

    Wait For Window Title: "notepad"

    Text Type: %D1%

    Best, Randall

×
×
  • Create New...