Jump to content
Macro Express Forums

cyrillic caracters and append text not working


Recommended Posts

Congratulations! You've discovered a Macro Express bug. Your macro works for English-language characters and for accented French characters, but not for Cyrillic characters.  (I didn't test any other languages or character sets. In French, I only tested é.)

 

I tried a workaround, but this failed, too, in exactly the same way:

 

Clipboard Copy
Variable Set String %Clip% from the clipboard contents
Variable Modify String: Save %Clip% to "C:\Whatever\test.txt"

 

Please submit a bug report to ISS.

Link to comment
Share on other sites

I discovered a long time ago MEP does not support Unicode. I also discovered that one can work around this in cases of characters that are ASCII/ANSI, but it can never handle characters that are only in Unicode. 

Link to comment
Share on other sites

This can done via Macro Express, but you won't be able to programmatically save information to the file that contains clipboard data. You'll need to do everything "manually," perhaps like this:

 

1. Capture the name of the current window:

Variable Set String %WinTitle% to topmost window title

 

2. Copy the selected text to the clipboard.

 

3. Open the file that contains the clipboard data:

Program Launch: "notepad.exe" (Normal)
Parameters: c:\tmp\test.txt

 

4. Wait for the file to open.

 

5. Go to the end (Ctrl + End), type Enter, and paste:

Text Type (Simulate Keystrokes): <CONTROL><END><ENTER><CONTROL>v

 

6. Save the file.

 

7. Close the file.

 

8. Switch to the window that has the name captured in step 1:

Window Activate: %WinTitle%

 

 

Although possible with Macro Express, it'll take work, and refining the script to work reliably might take some tinkering. There are a lot of moving parts. If you get the macro to work, you'll have expanded your Macro Express skills!

 

Too bad Macro Express can't handle Unicode!

Link to comment
Share on other sites

Well, I see acantor and I have been working in parallel, so this is kind of a repeat.  Here's the macro I just tested.  It is sloppy and slow because it relies on opening and closing Notepad on the screen.  Maybe you can figure out a way to streamline it.  

 

Here is something that seems to work, because Notepad seems to handle your funny characters.  Assume you already have "file B" and you want to append some copied text.  Highlight the text, then trigger this macro.

 

Delete File/Files: "c:\temp9\filea.txt"                        // delete temporary work file A
Text Type (Simulate Keystrokes): <CTRLD>c<CTRLU>               // copy text to clipboard
Delay: 100 milliseconds
Program Launch: "notepad" (Normal)                             // start MS Notepad blank screen
Text Type (Simulate Keystrokes): <CTRLD>v<CTRLU>               // paste text into Notepad      
Text Type (Simulate Keystrokes): <ALTD>f<ALTU>a                // save Notepad as file A
Text Type (Simulate Keystrokes): c:\temp9\filea.txt
Text Type (Simulate Keystrokes): <ENTER>
Text Type (Simulate Keystrokes): <ALTD>f<ALTU>x                // close Notepad
Program Launch: "filecopy.bat" (Normal)                        // append file A from Notepad, to pre-existing file B
Macro Return


Batch file "filecopy.bat", launched by the macro, consists of the old-fashioned DOS command
Copy c:\temp9\fileb.txt +  c:\temp9\filea.txt  c:\temp9\fileb.txt

 

Link to comment
Share on other sites

This seems to work and runs relatively quickly. The delays may need to be increased. (It might be possible to reduce them.)

 

You'll want to change the file name that receives information from the clipboard.

 

Clipboard Copy
Variable Set String %WinTitle% to topmost window title
Program Launch: "notepad.exe" (Maximized)
Parameters: c:\tmp\test.txt
Wait for File to be Ready: C:\Tmp\test.txt
Text Type (Simulate Keystrokes): <CONTROL><END><ENTER> // Go to end of file and start a new line
Clipboard Paste
Delay: 50 milliseconds
Text Type (Simulate Keystrokes): <CONTROL>s // Save the Notepad file
Delay: 50 milliseconds
Window Close: test.txt - Notepad
Window Activate: %WinTitle%

 

<CLIPBOARD COPY/>
<VARIABLE SET STRING Option="\x05" Destination="%WinTitle%"/>
<PROGRAM LAUNCH Path="notepad.exe" Mode="\x02" Parameters="c:\\tmp\\test.txt" Default_Path="TRUE" Wait="1" Get_Console="FALSE"/>
<WAIT FOR FILE TO BE READY Filename="C:\\Tmp\\test.txt" Time="0" Indefinite="FALSE" Hours="0" Minutes="0" Seconds="1"/>
<TEXT TYPE Action="0" Text="<CONTROL><END><ENTER>" _COMMENT="Go to end of file and start a new line"/>
<CLIPBOARD PASTE/>
<DELAY Flags="\x02" Time="50"/>
<TEXT TYPE Action="0" Text="<CONTROL>s" _COMMENT="Save the Notepad file"/>
<DELAY Flags="\x02" Time="50"/>
<WINDOW CLOSE Option="\x01" Title="test.txt - Notepad" Partial="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
<WINDOW ACTIVATE Title="%WinTitle%" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/>

 

Link to comment
Share on other sites

If the point of this macro is to automate the collection of information to a file, I think I would want that file to remain open. I wouldn't want to open and close the file every time I activated the macro.

 

This version displays the file for one second after the paste operation -- just enough time to visually check the copied text has arrived -- and then switches back to the original window.

 

Variable Set String %WinTitle% to topmost window title
Clipboard Copy
 
Window Activate: test.txt - Notepad // File that contains the copied information
 
Text Type (Simulate Keystrokes): <CONTROL><END><ENTER> // Go to end of file and start a new line
Text Type (Simulate Keystrokes): <CONTROL>v // Paste
Delay: 50 milliseconds
 
Text Type (Simulate Keystrokes): <CONTROL>s // Save
Delay: 1000 milliseconds
 
Window Activate: %WinTitle%

 

<VARIABLE SET STRING Option="\x05" Destination="%WinTitle%"/>
<CLIPBOARD COPY/>
<COMMENT/>
<WINDOW ACTIVATE Title="test.txt - Notepad" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006" _COMMENT="File that contains the copied information"/>
<COMMENT/>
<TEXT TYPE Action="0" Text="<CONTROL><END><ENTER>" _COMMENT="Go to end of file and start a new line"/>
<TEXT TYPE Action="0" Text="<CONTROL>v" _COMMENT="Paste"/>
<DELAY Flags="\x02" Time="50"/>
<COMMENT/>
<TEXT TYPE Action="0" Text="<CONTROL>s" _COMMENT="Save"/>
<DELAY Flags="\x02" Time="1000"/>
<COMMENT/>
<WINDOW ACTIVATE Title="%WinTitle%" Exact_Match="TRUE" Wildcards="FALSE" _IGNORE="0x0006"/>

 

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.

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

Loading...
×
×
  • Create New...