Jump to content
Sign in to follow this  

Using objects.

Recommended Posts

I was just trying something, with objects.

I was sent this file:

#include <GUIConstants.au3>

$GUI = GUICreate("", 600, 500)
$RichText = ObjCreate("RICHTEXT.RichTextCtrl")
GUICtrlCreateObj($RichText, 10, 10)
GUICtrlSetPos(-1, 10, 10, 580, 480)
With $RichText
    .Text = "Bold Text Underline Text"
    .SelStart = 0
    .SelLength = 9
    .SelBold = True
    .SelStart = 10
    .SelLength = 14
    .SelUnderline = True
$RichText.SelLength = 0

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE

And then I thought I would try and set data in it using GuiCtrlSetData, but then I figured it wouldn't work because its not a GUI CTRL :). So I looked through the helpfile, but couldn't find anything that will set data in Objects. So. My question is, how do I set data within an object?


Edit: I found that using $RichText.Text = "This is some text" will work. Will it all work if I was to read the text with speech?

Edit: OK, so I found that reading does work with no problems what so ever. Speak($RichText.Text, 0, 100) works great :D

Edited by Secure_ICT

Share this post

Link to post
Share on other sites

Object have "properties" that can be set using a special syntax like in your example. You are actually "setting" the value of 7 properties inside the With statement in your example.

BTW, "With" is just a shorthand function - $RichText.Text = "Bold Text Underline Text" would be the syntax for each of the 7 properties.

Each object has it's own set of properties and you must find the documentation for that object to know what they are (there are also object exploration tools you can use, but that is a more advanced topic).

Note that objects also have "methods" that cause action to be taken rather than setting attributes.

There is a pretty goo write-up by SvenP in the helpfile under Obj/COM.


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...