Jump to content

Help requested for Clipboard, GUICtrlCreateListViewItem, Bolded text, INI files


 Share

Recommended Posts

I have multiple Microsoft Word documents, which contain tables and information within. As an example of such, see This Image. I made a script that will parse through each and every file, find the specified header (in the example, "Changes Made"), and get the data in the column to the right.

After it retrieves that data, it goes through each line and extracts the information to an ini file, so it is formatted like this:

[New Item]
1=Added drops to monsters in Goldol
[Update]
1=Heavy Armors natural defence was lowered.

So far, that's worked wonderfully. I then made a script using GUI Windows as a lookup tool to reference each change made stored. The GUI window reads through each section in the INI file and display each section in a separate ListView. In the example, all values in "New Item" are in separate ListviewItems in a single ListView. The "Update" items are in their own listview, but each one on its own row as well. Lastly, I created a button to copy the selected row in the listview to the clipboard

My main question is how would I go about taking the copied data (which at this point would be "New Item: Added drops to monsters in gondol"), and make the "New Item: " part of it bold. I want to have the copy button copy the row, but when I paste it into a different word document to apply the bold font to part of the string. When you copy text from a website and paste it into word, it brings the formatting along with it. I want to do the same thing, but using my listviewitem that is being copied.

Link to comment
Share on other sites

As a quick reply, I suggest you look at the extended clipboard options .... a UDF if I remember correctly.

Copying text and formatting, is a data process, not pure text as in standard Clipboard commands.

You probably need to check the User Defined Functions (UDF) section of the Help file.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

I was looking up the _Clipboard_GetDataEx and similar commands, but I was not seeing anything that could help with setting clipboard data to bold. I see a bunch of things to set the format, but from what i can tell, setting the format from text to locale (or any other format) doesn't change make any part of it bold.  This is where my confusion sets in for trying to figure out how to do what I want. :(

Link to comment
Share on other sites

I'm not exactly sure what you are trying to do - all the steps.

But it sounds like you are copying text that is bold formatted from a Web page, then storing that text in a Listview entry, then later inserting it into a Word document?

If that is the case, then you are losing the bold formatting during the store as Listview item entry stage.

I haven't played with Clipboard functions much, but you probably need to store a flag in your Listview, for that text, that says it was bold. This would be as another entry in the same line.

When inserting into Word, your program sees that flag, and then tells Word to format that text as bold.

However, you may not need to do that, if every insertion is going to end up bold or partly so - you just tell Word what section you want bold.

Are you using the Word UDF? See the User Defined Functions section of the Help file.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

I have an INI file that looks like the following:

 

[New Item]
1=Added drops to monsters in Goldol
[Update]
1=Heavy Armors natural defence was lowered.
 

I then have a script to make a GUI search form: '>

Upon searching for a partial term, it shows results (3 different sections are shown, with the results of the search term in each: '>

The purpose was to select a row, and the copy button as shown will copy the text to the clipboard. 

 

I am trying to change it so that the "Section" for the copied item appears in bold such as: "New ItemsAdded new drops to gondol." The text in the listviewitem can be normal font, it does not matter. I just need the "New Items: " part which will be given through a string to the clipboard to be bold / underline.

 

I am using the word UDF to read the original file before converting extracted data to the INI. The original text is not in the proper formatting that I will need in the end. I am not seeing anything relating to changing the format of certain text to bold. I was thinking the FindReplace function would work as you can search for specific formatting in word and replace using specific formats, but I am not seeing any parameters that set something to bold / underline / etc. The format part of that function is simply true or false.

Edited by BakaMono
Link to comment
Share on other sites

I don't recall ever using the Word UDF, though I have done some basic stuff with the Excel UDF.

A quick perusal of the Word UDF seems to back what you say, so in that scenario, I would use the _WordMacroRun command from the UDF to run a VBA macro in the document to do what you want. Obviously you have to have that macro pre-setup. You can pass quite a few parameters to the macro, so you should be able to get it working how you want.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

If the VBA macro idea doesn't suit, you could check >this topic, if you haven't done so already. There might be something useful for you mentioned within. Also, I'm not sure if or what any new additional Word functions might be available in the latest AutoIt beta.

Another option of course, is to use one of the many rich edit options available here in the Examples section.

With that you could feasibly, open your final document in it, apply your changes, and re-save as a Word document again.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

The macro option should be able to work for the bolding part, since they are unique wordings that only appear in that specific section. I can also simply attach to the current open word document and run the macro with a click of a single hotkey. Took some time to find the macro function though as they did away with the old one to replace it with something similar. Thanks for the help :)

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...