Jump to content

Text problem in word when using COM


Recommended Posts

Hi all,

I have made a simple script to monitor the text which user types in a word document. This script is working like this.

1. If word is opened then get the object of word.application.

2. Entering to a while loop

inside that loop (sleep = 50)

   1. check for current cursor position and get the word behind the cursor.

    2. check if that word is in a dictionary and if yes, paste the key of the dictionary and again monitor another word

  So, this is the working style of that script. But when i run this script, everything is ok but the text in word looks very strange. I am attaching here an image of the difference. This problem only occure in a specific template. Not in a blank template. I have tested the same script idea with vb.net. there too i faced the problem. See the image. I need the Actual letter. But now i am getting the current result. 

How to fix this.

 000101.jpg

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

  • Moderators

kcvinu,

I have made a simple script to monitor the text which user types in a word document

That sounds very much as if it comes under the keylogger prohibition - can you persuade me that it does not?

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

@Melba23 Sure. It is nothing but a text expander. I am TV program translator by proffesssion. I need to type thousands of words per day. So i need use a good tex expander. I have Phrase Express but it won't support my native language. So i learned autoit and made one for me. :)

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

  • Moderators

kcvinu,

I have no problem with the fact that the script is not a keylogger by design, nor that you have such a script for personal use. However, please be careful with any code that you post on the forum - it sounds as if the full script does rather more than "check for a few keys being pressed" which is the touchstone for acceptability.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

@Melba23  Sure. Infact, i am learning autoit for my own purpose. I don't want to make harm for anybody. 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

kcvinu,

I understand your issue, but why did you post a bitmap and not text? Doing so doesn't allow to grab characters as you want them.

Anyway, I don't know malayalam enough to guide you to a final resolution but consider that both (MALAYALAM LETTER CHILLU NN, codepoint 0x00D7A) and (MALAYALAM LETTER TTA, codepoint 0x00D1F) are two distinct letters. Only a malayalam-aware text processor will be able to detect that they can be represented by a ligature as in your "actual letter" example [I guess it's a ligature but not knowing enough about the script I may be wrong]. AFAIK there is no Unicode codepoint attributed to this ligature and it can only be detected and represented by a malayalam-aware font rendering code.

I'm certain your code isn't intended to do anything bad and I also understand Melba concern. Can you please copy and paste the "actual letter" in text form (just like I did). Leave code away for now.

I advise you read from this page (but reading the entire site would help even more).

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

@jchd Thanks for the reply. This is the actual letter. " ണ്ട "

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

This is where you're confused: the text you just posted is not a letter, to wit:

#include <Array.au3>

Local $s = "ണ്ട"
Local $a = StringToASCIIArray($s)
_ArrayDisplay($a)

You can as well copy the first character or the last one with the mouse on the post. This is a string of three Unicode codepoints, namely 0x00D23, 0x00D4D and 0x00D1F. That is, in this order :

MALAYALAM LETTER NNA
MALAYALAM SIGN VIRAMA
MALAYALAM LETTER TTA

The actual rendering engine (depends on the font you use) decides to group these three glyphs into a new one which doesn't have a unique Unicode codepoint. The link I gave above explains what happens, even if there is little malayalam example, you'll get the idea.

Also as MS Word does a large number of things in your back, I'm uncertain you can succeed in making it do exactly what you want. Maybe simply by creating a user ligature in the menus.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

@jchd Thank you for the reply. I have visited the link. I think you have pointed me the right direction. There is a lot to read. Let me finish it. 

 

Edit. I suspect word too. A normal blank template can show all my letters without any problem. But a specific template which i work on is causing this problem.

Edited by kcvinu
Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

Is the offending template explicitely tagged as "malayalam"? If it's English (say), things may not work as expected, but this is just a guess.

This site (by Richard Ishida, a lead member of the Unicode consortium and I8n) is full of up-to-date data and information about Unicode. For instance its uniview applet lets you see a Unicode block (e.g. malayalam) and access detailed information about each and every codepoint (e.g. 0x0D4D).

EDIT: I must clarify something for future readers. When I or Ishida use the word "script", we intend "a writing system" which can be Latin, Cyrillic, Hangul, ... and this has no relationship with the term "script" as in "AutoIt is a script language".

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...