Introduction

 Top Next

Plugin Name:

Object

Current Version:

2,0,0,0 AMS8 Only

Description:

A L-OOP model for all standard AMS Visual Object's actions.

L-OOP stands for Lua Object Oriented Programming, for more

information about Object Oriented Programming in Lua, see

this page: Lua Pil :: OOP

This page will not describe how this plugin is written, but mainly

it will describe how a low-level simple L-OOP object has been set up

and called.

The current version includes

CAS - Chaining and Stacking

SMOTF - String manipulation on the fly.

POTF - Properties on the fly.

Author:

Imagine Programming <Bas Groothedde>

Web:

www.imagine-programming.com

Contact:

contact@imagine-programming.com

Copyright:

© Imagine Programming, 2010.

Imagine Programming


Welcome

 Top Previous Next

Welcome to the helpfile for the Imagine Object Action Plugin 2,0,0,0 for Autoplay Media Studio 8

Short help/description:

This plugin allows you to preform actions on the AMS objects in a more

pure-lua and object oriented form. The plugin contains all AMS functions for

object in OOP form. A few extra functions are added, these are

only listed in the helpfile, because the Action Dialog displays the functions

incorrectly. Only Object.Create, Object.GetPageHandle, Object.GetDialogHandle

are listed in the Action dialog. Also, Grid.GetCellState is added to the action

dialog, because this function wasn't documented in the AMS helpfile nor actionXML files.

Make sure to read the helpfile about the extra functions and their usage,

the usage for all native functions can be found in the AMS helpfile, for that

object.

As from version 1.1.0.0 this plugin now also contains the as we call it,

POTF (Properties on the fly) system. Which means, that you can just

type the object's name, followed by a .Properties and following that a . and a fieldname.

This will automatically update the properties of that object. eg:

Input1.Properties.Height = 50;

This will change the height of the object to 50, without having to call a function!

As of version 1.2.0.0, this is now supported on Page/Dialog ObjectHandles aswell,

check the helpfile for Object.GetPageHandle and Object.GetDialogHandle.

As from version 2,0, Stacking and chaining is possible, also SMOTF!

Read the manual on these new features!


About

Imagine Object Action Plugin 2,0,0,0

Imagine Programming

- Bas Groothedde

www.imagine-programming.com

contact@imagine-programming.com

© Imagine Programming, 2010. All rights reserved.

Imagine Object Action Plugin

is a legal trademark by Imagine Programming.


License

Software license for Imagine Object Action Plugin.

This software and/or files are copyrighted to Imagine Programming and

Imagine Programming also claims full rights to this software.

This software is licensed to anyone for usage, this software is yours

to use/run and not to redistribute/reproduce.

This software is protected by copyright law and international treaties.

Unauthorized reproduction or distribution of this program, or any portion of it,

may result in severe civil and criminal penalties, and will be prosecuted under

the maximum extent possible under national and international law.

Redistribution

Redistribution is allowed, only when a direct link to the product's page is shown.

The products page for this product is http://imagine-programming.com/Product/17/.

You may not place a direct link to the file and you may not upload the file

yourself. If you wish to place your file on any website other as

www.imagine-programming.com, contact Imagine Programming with a request.

Email: contact@imagine-programming.com

Reproduction

Reproduction of any of the content of this software and/or files is strictly

forbidden by the international copyright law. Do not modify any of the included

files of this software package.

Warranty

The program IS DISTRIBUTED "AS IS". NO WARRANTY OF ANY KIND IS EXPRESSED OR

IMPLIED. YOU USE AT YOUR OWN RISK. NEITHER THE AUTHOR(S) NOR THE AGENTS OF THE

AUTHOR(S) WILL BE LIABLE FOR DATA LOSS, DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND

OF LOSS WHILE USING OR MISUSING THIS SOFTWARE.

Again, legal measures will be taken in case of copyright infringement!

If you do not agree with the terms of this license you must remove Imagine Object Action Plugin

and all of it's files from your storage devices and cease to use the product.


Functions and CAS info

In this section you will find all the help regarding all the methods and extra functions/systems

in this plugin. Please report bugs at the Indigorose Forum group for Imagine Programming

or through email: contact@imagine-programming.com

A short description of the chain/stack system. (CAS)

Usually using this plugin, you specify the handle each time you call a function. However,

with the new system implemented in this version of the object, you can call as many functions

as you wish, on a single line even! Also, all results will be saved if you use the stacking system as well.

In this chapter, take a look at

Object.SetCodeChaining,

Object:GetStack,

Object:ClearStack,

Object.ClearStackCache.

Full function list, of which most of them are discussed in the AMS helpfile.

Object.ClearStackCache

Object.Create

Object.GetDialogHandle

Object.GetPageHandle

Object.InitializeAllObjects

Object.SetCodeChaining

Object:AbbreviateFilePath

Object:AddItem

Object:AddSlide

Object:Append

Object:AutoSize

Object:AutoSizeColumn

Object:AutoSizeColumns

Object:AutoSizeRow

Object:AutoSizeRows

Object:Back

Object:CanPaste

Object:CanUndo

Object:Center

Object:CenterRelative

Object:ClearContents

Object:ClearStack

Object:Click

Object:CollapseNode

Object:Compare

Object:CompareFileVersions

Object:CompareNoCase

Object:Copy

Object:Cut

Object:Delete

Object:DeleteAllItems

Object:DeleteColumn

Object:DeleteItem

Object:DeleteNonFixedRows

Object:DeleteRow

Object:DeleteSlide

Object:DeselectItem

Object:Destroy

Object:EditCopy

Object:EditCut

Object:EditPaste

Object:EmptyUndoBuffer

Object:EnsureVisible

Object:EnsureVisible

Object:ExpandColumnsToFit

Object:ExpandLastColumn

Object:ExpandNode

Object:ExpandRowsToFit

Object:ExpandToFit

Object:FadeIn

Object:FadeOut

Object:FillFromFolder

Object:Find

Object:FindItem

Object:FindNodeByData

Object:FindNodeByText

Object:FindText

Object:Focus

Object:Forward

Object:GetCellColors

Object:GetCellState

Object:GetCellText

Object:GetChecked

Object:GetCheckedCount

Object:GetChildCount

Object:GetChildren

Object:GetColumnCount

Object:GetColumnHiding

Object:GetColumnResize

Object:GetColumnWidth

Object:GetCount

Object:GetCurrentPos

Object:GetCurrentSlide

Object:GetDragAndDrop

Object:GetEditable

Object:GetFile

Object:GetFileInfo

Object:GetFilename

Object:GetFixedColumnCount

Object:GetFixedColumnSelection

Object:GetFixedRowCount

Object:GetFixedRowSelection

Object:GetFlashVariable

Object:GetFocusCell

Object:GetFrameFocusCell

Object:GetFullScreen

Object:GetGridColors

Object:GetGridLines

Object:GetHeaderSort

Object:GetImage

Object:GetImagePath

Object:GetItemCheck

Object:GetItemData

Object:GetItemText

Object:GetLength

Object:GetLine

Object:GetListMode

Object:GetModified

Object:GetMute

Object:GetNextItem

Object:GetNode

Object:GetOpacity

Object:GetParagraphFormat

Object:GetPos

Object:GetProp

Object:GetProperties

Object:GetRange

Object:GetRect

Object:GetRowCount

Object:GetRowHeight

Object:GetRowHiding

Object:GetRowResize

Object:GetScript

Object:GetScrollPos

Object:GetScrollRange

Object:GetSelectable

Object:GetSelected

Object:GetSelectedCount

Object:GetSelectedNode

Object:GetSelection

Object:GetSelectionFormat

Object:GetSingleColumnSelection

Object:GetSingleRowSelection

Object:GetSize

Object:GetSlideCount

Object:GetSortAscending

Object:GetSortColumn

Object:GetStack

Object:GetState

Object:GetTabEnabled

Object:GetText

Object:GetTextLength

Object:GetToolTipsEnabled

Object:GetTrackFocusCell

Object:GetURL

Object:GetUnhideColumn

Object:GetUnhideRow

Object:GetVolume

Object:GoToPage

Object:GoToSlide

Object:InsertColumn

Object:InsertItem

Object:InsertNode

Object:InsertRow

Object:IsCellEditable

Object:IsCellFixed

Object:IsCellSelected

Object:IsCellValid

Object:IsCellVisible

Object:IsEnabled

Object:IsFullScreen

Object:IsItemSelected

Object:IsVisible

Object:Left

Object:Length

Object:Load

Object:LoadFile

Object:LoadFromFile

Object:LoadFromFile

Object:LoadFromHTTP

Object:LoadHTML

Object:LoadURL

Object:Lower

Object:MakeColorRGB

Object:MakePath

Object:Mid

Object:Navigate

Object:Navigate

Object:Paste

Object:Pause

Object:Play

Object:Print

Object:Print

Object:PrintWithDialog

Object:RedrawCell

Object:RedrawColumn

Object:RedrawRow

Object:Refresh

Object:Refresh

Object:RemoveNode

Object:RemoveProp

Object:Replace

Object:ResetContent

Object:RestoreOriginalRect

Object:ReverseFind

Object:Right

Object:SaveToFile

Object:SaveToFile

Object:ScrollLines

Object:ScrollToLine

Object:Seek

Object:SelectAll

Object:SelectItem

Object:SetAppendDelimiter

Object:SetCellColors

Object:SetCellFont

Object:SetCellText

Object:SetChecked

Object:SetColumnCount

Object:SetColumnHiding

Object:SetColumnResize

Object:SetColumnWidth

Object:SetCurrentPos

Object:SetDragAndDrop

Object:SetEditable

Object:SetEnabled

Object:SetFixedColumnCount

Object:SetFixedColumnSelection

Object:SetFixedRowCount

Object:SetFixedRowSelection

Object:SetFlashVariable

Object:SetFocusCell

Object:SetFrameFocusCell

Object:SetFullScreen

Object:SetGridColors

Object:SetGridLines

Object:SetHeaderSort

Object:SetImage

Object:SetItemCheck

Object:SetItemData

Object:SetItemText

Object:SetListMode

Object:SetModified

Object:SetMute

Object:SetNameDest

Object:SetNode

Object:SetOpacity

Object:SetParagraphFormat

Object:SetPos

Object:SetProp

Object:SetProperties

Object:SetRange

Object:SetRect

Object:SetRedraw

Object:SetRowCount

Object:SetRowHeight

Object:SetRowHiding

Object:SetRowResize

Object:SetScript

Object:SetScrollPos

Object:SetSelectable

Object:SetSelected

Object:SetSelectedNode

Object:SetSelectedRange

Object:SetSelection

Object:SetSelectionFormat

Object:SetSingleColumnSelection

Object:SetSingleRowSelection

Object:SetSize

Object:SetSortAscending

Object:SetState

Object:SetStep

Object:SetTabEnabled

Object:SetText

Object:SetToolTipsEnabled

Object:SetTrackFocusCell

Object:SetType

Object:SetUnhideColumn

Object:SetUnhideRow

Object:SetUpdate

Object:SetVisible

Object:SetVolume

Object:SetZOrder

Object:SetZoomScroll

Object:SortTextItems

Object:SplitPath

Object:StepIt

Object:Stop

Object:ToNumber

Object:ToggleEnabled

Object:ToggleVisible

Object:TrimLeft

Object:TrimRight

Object:Undo

Object:Upper

---

275 functions and methods.


Object.InitializeAllObjects

When you call this function, Object Action Plugin will go through all objects in the current Page/DialogEx

and create an object handle for them. If you set the debuglevel it will return a number of errors and it will

debug all warnings/errors when you have the debug window opened.

Parameters

Type | Name | Description
number | Debug Level | 0. Absolutely ignore all errors and continue. 1. Display warnings an object name is invalid, and the object has been ignored. 2. Display warnings when an existing luavariable has been overwritten and continue. this will also use debuglevel 1.

Returns

This function does not return any value.

Example

-- This is the first code in On Show.
Object.InitializeAllObjects(0);

-- Now this has been called, and you have an object named "Image1", one named "Input1", and a "Paragraph1"
-- you can already start using the methods using those names.

Image1:FadeIn(170, 10);
Input1:SetText("Hello World!");


Object.Create

Creates a new L-OOP Object for an AMS visual object. You can use this object to manipulate objects

using Methods rather than using the Object's name over and over again.

Parameters

Type

Name

Description

string | ObjectName | The object's name to create a handle for, or the new object's name in case you create one.
table | Properties | If you want to create a new object, pass on the Object's properties table here.
number | ObjectType | If you want to create a new object, pass on the new object's type here. Eg: OBJECT_INPUT

Returns

This function returns an OOP object for later use.

All methods included with the Object Action Plugin can be used on this

object, IF the object's type supports these methods.

You will recieve a message when you try to call an unsupported function.

Example

Input1 = Object:Create("Input1") --it exists, so no properties table and objecttype have to be passed.

Input1:SetText("Hello World!");
Input1:Append("Greets from Imagine Programming!","\r\n");
Input1:Destroy();


Object:Destroy

Destroys the handle for the object.

Parameters

Type

Name

Description

boolean

RemoveObject

If set to true, the object will also be removed from the AMS Page/DialogEx.

Returns

This function does not return anything.

Example

Input1:Destroy(false);


Object.SetCodeChaining

Set the level of codechaining. This level can be changed at any moment, in any event.

The default level of code chaining is set to IOBJECT_CHAINING_NONE. So functions

have to be called the regular way at first.

Parameters

Type

Name

Description

number

Chaining Level

The code Chaining level, this can be one of the next:

IOBJECT_CHAINING_NONE - No chaining, regular calls.

IOBJECT_CHAINING_BASIC - Basic chaining, no stacking. Caution, results of only the last call will return.

IOBJECT_CHAINING_STACK - Stack chaining, all results of calls will be stacked which you can later obtain by calling hObj:GetStack(bClear). Read help on that.

Returns

This function does not return any value.

Example

Object.SetCodeChaining(IOBJECT_CHAINING_STACK);


Object:GetStack

When stacking is enabled, and the stack has been filled, you can obtain the whole stack

in one move by calling this function. You can ignore certain variables using an underscore.

See the example to see how it works.

When stacking is enabled, each methodcall returns a value. Thus, also methods used to

set data with or perform an operation that does not return any values.

Instead of returning 'nil' for these methods, an empty string will be returned. Mainly because

the stacking system does not save nil values.

All methods in Object work inside a chain, but certain ones cut off the chain and will

prevent further chaining on the current line. These functions are:

Object:GetStack

Object:Destroy

Parameters

Type | Name | Description
boolean | AutoClear | Automatically clear the stack when set to true. This can ofcourse be done later using Object:ClearStack, however, the stack will remain to grow until you clear it.

Returns

This method randomly returns values of different types.

When a method returns nil, the stack will return "" instead of nil.

Example

local errnum = Object.InitializeAllObjects(2) -- Debugging level 2, all warnings.
if(errnum>0)then
Debug.ShowWindow(true);
end
-- This example requires of you that you have an Input1 Object.

Object.SetCodeChaining(IOBJECT_CHAINING_STACK);

local _, bCanPaste = Input1:SetText("Hello World")
:SetPos (10, 120)
:GetProperties()
:GetSize()
:CanPaste();

--Without stacking, only CanPaste would be returned as the second result. With
--stacking, it still returns only the last result, but it also stacks up the
--rest of the results. So, the code above is valid with the basic stackingmode
--as well, but only the results of the last call will be returned.
--Now let's obtain our values, the underscores mean that that result will be ignored.

local _,_,tProps,tSize,bCanPaste = Input1:GetStack(true); -- True means clear automatically.
--Clearing the stack can also manually be done using Input1:ClearStack();
--ClearStack is useful to use inside a chain, eg right after SetPos in the code
--above. That will remove the result from SetText and SetPos, and you can leave out the
--first two underscores.

--All methods in Object work inside a chain, but certain ones cut off the chain and will
--prevent further chaining on the current line. These functions are:
--Object:GetStack
--Object:Destroy


Object:ClearStack

When stacking is enabled, and you have items in the stack you wish not to use,

call this method to clear the stack of that object completely.

Parameters

Type

Name

Description

No arguments required.

Returns

This method does not return a value.

Example

local errnum = Object.InitializeAllObjects(2) -- Debugging level 2, all warnings.
if(errnum>0)then
Debug.ShowWindow(true);
end
-- This example requires of you that you have an Input1 object.

Object.SetCodeChaining(IOBJECT_CHAINING_STACK);

local _, bCanPaste = Input1:SetText("Hello World")
:SetPos (10, 120)
:GetProperties()
:GetSize()
:CanPaste();
Input1:ClearStack(); -- Input1's stack is now completely empty.


Object.ClearStackCache

When stacking is enabled, you can call this function to completely

erase the stacks for all objects. It is wise to do this when you know you

can use it, just to make sure memory is not being wasted.

Parameters

Type

Name

Description

No arguments required.

Returns

This function does not return a value.

Example

Object.ClearStackCache(); -- All stacks empty!


Object:Append

Appends text to the object's text. For example, when used on a paragraph object, it will add text to the end of

the object's content.

Parameters

Type

Name

Description

string | Text | The text to append to the object's text.
string | Delimiter | Optional - If you want to overwrite the default delimiter for just once, specify it here.

Returns

This function does not return anything.

Example

Input1:Append("This is a string, which will append using the defailt delimiter");
Input1:Append("This string will be appended using a custom delimiter", "\r\n\r\n");


Object:SetAppendDelimiter

Set's the default 'Append' delimiter for Object:Append();

Note: The AppendDelimiter is unique for each object handle!

Parameters

Type | Name | Description
string | Delimiter | The default delimiter for Object:Append();

Returns

This function does not return any value.

Example

Input1:SetAppendDelimiter("\r\n\r\n");
Input1:SetText("First line");
Input1:Append("Second line of text using the newly set delimiter");
Input1:Append("Third line of text using only one newrule", "\r\n");


Object:GetRect

Set's the default 'Append' delimiter for Object:Append();

Note: The AppendDelimiter is unique for each object handle!

Parameters

Type | Name | Description
 |  | No arguments required.

Returns

This method returns a table containing the position and size of an object.

ReturnTable.X

ReturnTable.Y

ReturnTable.Width

ReturnTable.Height

Example

Par1 = Object:Create("Paragraph1");
local oldRect = Par1:GetRect();
oldRect.X = oldRect.X+10;
oldRect.Y = oldRect.Y+10;
Par1:SetRect(oldRect); -- you can also pass the rect as 4 seperate values, see the helpfile on this function.


Object:SetRect

Set the size and position of an object.

Parameters

Type | Name | Description
number | X (Or RectTable) | The position from the left in pixels. Also possible, pass on a Rect table here and ignore all arguments, this will also set the position and size of the object. Set to nil for old X
number | Y | The position from the top in pixels. Set to nil for old Y
number | Width | The width in pixels. Set to nil for old Width
number | Height | The height in pixels Set to nil for old Height

Returns

This function does not return any value.

Example

-- Example 1
Par1 = Object:Create("Paragraph1");
local oldRect = Par1:GetRect();
oldRect.X = oldRect.X+10;
oldRect.Y = oldRect.Y+10;
Par1:SetRect(oldRect); -- you can also pass the rect as 4 seperate values, see the helpfile on this function.

-- Example 2, as from the Par1:SetRect line in first example
Par1:SetRect(oldRect.X+10,oldRect.Y+10,oldRect.Width-10,oldRect.Height-10);

-- Example 3, ignore fields, they stay what they were.
Par1:SetRect(oldRect.X+10,nil,oldRect.Width-10,nil);


Object:Center

Center an object on the page/DialogEx

Parameters

Type | Name | Description
number | WindowHandle | The windowhandle of the host of the object. Either the main windowhandle, or the DialogEx's windowhandle.

Returns

This function does not return any value.

Example

Par1:Center(Application.GetWndHandle());


Object:CenterRelative

Center an object onto another object.

You could use a Hotspot or a Paragraph, make it 10x10.

After calling this function using either that hotspot or paragraph, the object will

be centered relatively to that object. Thus, centered on that object.

Parameters

Type | Name | Description
string | Parent Object | The parent object to center on. This can also be a valid handle to an existing object created with this plugin. So, not necessarily a string, but also an object.

Returns

This function does not return any value.

Example

Par1:Center(Application.GetWndHandle());


Object:ToggleEnabled

Toggles the enabled state for an object

Parameters

Type

Name

Description

No arguments required.

Returns

This function does not return any value.

Example

Button1:ToggleEnabled();


Object:ToggleVisible

Toggles the visible state for an object

Parameters

Type

Name

Description

No arguments required.

Returns

This function does not return any value.

Example

Button1:ToggleVisible();


Object:RestoreOriginalRect

Restores the initial position and size for an object. This is the position and size which has been saved

the moment Object.Create has been called.

Parameters

Type

Name

Description

No arguments required.

Returns

This function does not return any value.

Example

Input1:RestoreOriginalRect();


Object:FadeIn

This method only works on Image object, it will fade in the image from a certain opacity

until it reaches the limit you specify.

Parameters

Type | Name | Description
number | Max Opacity | The maximal % Opacity, has to be higher than 0 and lower than 101.
number | Timeout | The delay between opacitychanges. A lower delay is a faster fade.

Returns

This function returns true on success, false on failure.

Example

Image1:FadeIn(170, 12);


Object:FadeOut

This method only works on Image object, it will fade out the image from a certain opacity

until it reaches the limit you specify.

Parameters

Type | Name | Description
number | Min Opacity | The minimal % Opacity, has to be higher than 0 and lower than 101.
number | Timeout | The delay between opacitychanges. A lower delay is a faster fade.

Returns

This function returns true on success, false on failure.

Example

Image1:FadeOut(20, 12);


Object.GetPageHandle

Get's a new Object handle for managing Page Properties and functions.

All Page functions are available in the Object plugin.

Parameters

Type

Name

Description

No arguments required.

Returns

This function returns an object for use with the Object Plugin.

Example

hPage = Object.GetPageHandle();
hPage.Properties.BackgroundColor = Math.HexColorToRGB("00FF00");


Object.GetDialogHandle

Get's a new Object handle for managing DialogEx Properties and functions.

All DialogEx functions are available in the Object plugin.

Parameters

Type

Name

Description

No arguments required.

Returns

This function returns an object for use with the Object Plugin.

Example

hDialog = Object.GetDialogHandle();
hDialog.Properties.BackgroundColor = Math.HexColorToRGB("00FF00");
hDialog.Properties.DialogTitle = "Wooptiedoo!"


Object:ClearContents

Removes all items from given object.

Note: In GRID, it only removes all the cells!

Parameters

Type

Name

Description

No arguments required.

Returns

This function does not return any value.

Example

Input1:ClearContents(); --Clears Input1

Listbox:ClearContents() -- Clears all items in that listbox


Object:SetScript

Set the script for an event in an object.

Parameters

Type | Name | Description
string | Event | The name of the event to set the script for.
string | Script | A valid lua script to set for this object's event.

Returns

This function does not return any value.

Example

Button1:SetScript("On Click", [[
Dialog.Message("Hello", "World");
]]);


Object:GetScript

Get the script from an event in an object.

Parameters

Type | Name | Description
string | Event | The name of the event to get the script from.

Returns

This function returns a string, containing the luascript.

Example

local strLua = Button1:GetScript("On Click");


Object:Click

Fire the object's On Click event, if supported.

Parameters

Type

Name

Description

No arguments required.

Returns

This function does not return any value.

Example

Button1:Click(); --Executes the On Click event in the button.


Object:Focus

Set the current focus to that object.

Parameters

Type

Name

Description

No arguments required.

Returns

This function does not return any value.

Example

Input1:SetFocus();


Object:SetZOrder

Set the z-position of an object.

Parameters

Type | Name | Description
number | Position | The z-order position.
string | Reference Object | If Position is set to ZORDER_INSERT_BEFORE or ZORDER_INSERT_BEHIND, this is the object that the object specified in ObjectName will be positioned next to. ReferenceObject is an empty string ("") by default.

Returns

This function does not return any value.

Example

Image1:SetZOrder(ZORDER_INSERT_BEFORE, "Image2");


SMOTF - String Manipulation - Functions

String Manipulation - On the fly.

In this current version, it is also possible to directly manipulate an objects content using the new

string methods. Hence though, not all AMS String functions are implemented, however, most

of the functions are and additional methods will later arrive.

Only objects being able to set and get text from are supported, eg: Input, Paragraph, Richtext,

Label etc.

Only the methods explained in this chapter are supported, but quite useful. Please read the help

topics regarding the methods before using them, because not all methods of calling these methods

are the same as when you call a String function in AMS. Eg. hObj:SplitPath uses an argument where

you specify what parts must show.


Object:Mid

Fetches a piece of the string at a certain position of a ceratin length.

Parameters

Type

Name

Description

number | Start Position | The position to start at.
number | Length | The length to fetch.

Returns

This method does not return any value. It sets the object with the new value.

Example

Input1:Mid(5, 10);


Object:SplitPath

Grabs certain parts of a path in an input, specified by you. Then in turn, it will format them to a string

that will appear in the object.

Parameters

Type

Name

Description

number

Part(s)

The part(s) to fetch, this can be one of the following:

IOBJECT_FILENAME

IOBJECT_EXTENSION

IOBJECT_DRIVE

IOBJECT_FOLDER

You can pass on multiple parts by seperating them as seperate arguments.

Take a look at the example below to show you how it's done.

Returns

This method does not return any value. It sets the object with the new value.

Example

Input1:SplitPath(IOBJECT_FILENAME, IOBJECT_EXTENSION);
-- This will set the input's text to boot.ini if the content was C:\boot.ini


Object:Right

Grab a certain length from the right of an object's content, and

update it with the new content.

Parameters

Type

Name

Description

number

Length

The length to grab.

Returns

This method does not return any value. It sets the object with the new value.

Example

Paragraph1:Right(50);


Object:Left

Grab a certain length from the left of an object's content, and

update it with the new content.

Parameters

Type

Name

Description

number

Length

The length to grab.

Returns

This method does not return any value. It sets the object with the new value.

Example

Paragraph1:Left(50);


Object:CompareFileVersions

Compare the object's content with the versionstring you provide.

Parameters

Type

Name

Description

string

Version

The versionstring to compare the object's content with.

Returns

This method returns a boolean value. True if the strings match, false otherwise.

Example

Input1:CompareFileVersions("2.3.50.1");


Object:ToNumber

Return the numeric representation of a numeric string inside the object.

Parameters

Type

Name

Description

No arguments required.

Returns

This method returns a number. If the conversion to a number has failed,

this method returns an empty string.

Example

local nNumber = Input4:ToNumber();
if(nNumber~="")then
-- Do Stuff with your number.
end


Object:Replace

Replace a string inside an object.

Parameters

Type

Name

Description

string | Pattern | The substring to find.
string | ReplaceString | The string to replace found results with.
boolean | CaseSensitive | When set to true, the search will be case sensitive. Otherwise it will ignore differences between uppercase or lowercase. The default value for this argument is false

Returns

This method does not return any value. It sets the object with the new value.

Example

Label1:Replace("Hello World", "What's up?", false);


Object:Length

Return the length of the content of an object.

Parameters

Type

Name

Description

No arguments required.

Returns

This method returns a number, this number will be the length of the object's text.

Example

local inp1TextLen = Input1:Length();


Object:Lower

Change all text inside an object to Lowercase text.

Parameters

Type

Name

Description

No arguments required.

Returns

This method does not return any value. It sets the object with the new value.

Example

eMailInput:Lower();


Object:Compare

Compare a string to the content of an object.

Parameters

Type

Name

Description

string

CompareString

The string to compare.

Returns

This method returns a boolean value. True if the strings match, false otherwise.

Example

if(not Input1:Compare("Imagine Programming Rocks!"))then
Dialog.Message("HEY!", "You did not type nice words =(");
end


Object:CompareNoCase

Compare a string to the content of an object.

This function does this check without checking lower/upper case difference.

Parameters

Type

Name

Description

string

CompareString

The string to compare.

Returns

This method returns a boolean value. True if the strings match, false otherwise.

Example

if(not Input1:CompareNoCase("Imagine Programming Rocks!"))then
Dialog.Message("HEY!", "You did not type nice words =(");
end


Object:TrimLeft

Remove a sequence of characters from the left of the object's content.

Parameters

Type

Name

Description

string

Trim

The string to remove from the left.

Returns

This method does not return any value. It sets the object with the new value.

Example

-- Overkill trimming
while(Input1:Mid(1,1)==" ")do
Input1:TrimLeft(" ");
end


Object:TrimRight

Remove a sequence of characters from the right of the object's content.

Parameters

Type

Name

Description

string

Trim

The string to remove from the right.

Returns

This method does not return any value. It sets the object with the new value.

Example

-- Overkill trimming
while(Input1:Right(1)==" ")do
Input1:TrimRight(" ");
end


Object:Upper

Change all text inside an object to Uppercase text.

Parameters

Type

Name

Description

No arguments required.

Returns

This method does not return any value. It sets the object with the new value.

Example

hSerialNumber:Upper();


Object:Find

Find a string inside the object's content, and return it's position.

Parameters

Type | Name | Description
string | Pattern | The substring to find.
number | Start Position | The position to start the search at. This value defaults to 1, and can be left empty.
boolean | Case Sensivity | When set to true, the search will be case sensitive. Otherwise it will ignore differences between uppercase or lowercase. This value defaults to false, and can be left empty.

Returns

This method returns a number, this number will be the position of the string.

This function returns -1 if the string could not be found.

Example

local hwpos = Input4:Find("Hello World", 1, false);


Object:ReverseFind

Find a string inside the object's content, and return it's position.

This function begins the search at the endposition of the string,

and moves back to the begin position of the string.

Parameters

Type | Name | Description
string | Pattern | The substring to find.
boolean | Case Sensivity | When set to true, the search will be case sensitive. Otherwise it will ignore differences between uppercase or lowercase. This value defaults to false, and can be left empty.

Returns

This method returns a number, this number will be the position of the string.

This function returns -1 if the string could not be found.

Example

local hwpos = Input4:ReverseFind("Hello World", false);


Object:AbbreviateFilePath

Returns an abbreviated file path given a maximum number of characters. If the file path exceeds the maximum number of characters, folder names will be removed from the path from the right hand side until its length is less than the specified number of characters. This removal will be replaced by "...".

The object will be set with the abbreviated file path.

Parameters

Type | Name | Description
number | Characters | The maximum number of characters allowed in the new path.

Returns

This method does not return any value. It sets the object with the new value.

Example

hConvertIn:AbbreviateFilePath(50);


Object:MakePath

Set the object's content with a path generated using the specified table of pathparts.

Parameters

Type | Name | Description
table | Path parts | A table containing all parts of the path. tPathParts = { Drive = "C:", Folder = "\\Program Files\\", Filename = "PFLister", Extension = ".exe" }

Returns

This method does not return any value. It sets the object with the new value.

Example

hPath:MakePath{Drive="C:", Folder="\\Program Files\\", Filename="PFLister", Extension=".exe"};
-- And yes, that syntax above is possible. Since it requires only 1 argument, it can be parsed
-- like this. eg:
-- print "Hello World" << that is also valid.


Object:Concat - use Object:Append

We did not use Object:Concat, but we are mentioning it, because the existing function

Object:Append can achieve the same.

Object:Append

Object:SetAppendDelimiter


POTF - Properties On The Fly

 Top Previous

Description

POTF!

Here you will find some information about the POTF system in the Object Action Plugin.

This system, simply allows you to change properties for an object, without having to call

any functions. As from version 1.2, POTF is also supported for Page and/or DialogEx properties.

You have the handle, and from there on, you change the properties. See the examples to check out

how to do this.

Note: Object.GetPageHandle and Object.GetDialogHandle are important for POTF!

Additional Information

Obtaining Properties

Please note, that for obtaining properties, POTF can not be used just yet.

When you change the properties table for a specific object, you don't actually

'change' it.

Examples

Use it for Objects

Image1 = Object.Create("Image1") -- This image must exist on the current page/dialog.
Image1.Properties.ImageFile = "Autoplay\\Images\\Logo.png";
Image1.Properties.Opacity = 0;
Image1.Properties.TooltipText = "Imagine Programming";
-- The properties have been set and applied, no need for calling any functions!
-- But let's just do that, just because fading in images is cool!
Image1:FadeIn(85);
Image1:Destroy(); -- Destroys the handle to the object.

Use it for Pages.

hPage = Object.GetPageHandle(); -- Can only be called from a page!
hPage.Properties.BackgroundType = BG_SOLID;
hPage.Properties.BackgroundColor = 0;
hPage.Properties.Description = "Page Description";
hPage.Properties.Keywords = {"My", "Page", "Keywords"}; --!Important, you must pass this as one table, you can not
-- edit single fields like hPage.Properties.Keywords[1] = "My";!!
hPage:Destroy(); -- Destroys the handle to the object.

Use it for DialogEx's.

hDialog = Object.GetDialogHandle(); -- Can only be called from an opened dialog!
hDialog.Properties.DialogTitle = "This is the new title!";
hDialog.Properties.BackgroundType = BG_GRADIENT;
hDialog.Properties.GradientColorTop = Math.HexColorToNumber("BB0000");
hDialog.Properties.BackgroundColor = Math.HexColorToNumber("450000");
hDialog.Properties.Resizable = false;
hDialog:Destroy() -- Destroys the handle to the object. -- Go check it out!