Posted by Catur Nugroho | File under :
Simple Code to Using Html Agility Pack

So i have a code of Htmlagilitypack in my mind and hopefully what I get can be useful for those.
Lest try! 

Do not forget to add this code in your reference :
using HtmlAgilityPack;

This is firs time, we will take the example of html and put it into the HTML Agility Pack
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(sampleHtml);
  
Get Text Box Value
HtmlAgilityPack.HtmlNode node = new HtmlAgilityPack.HtmlNod();
node = doc.DocumentNode.SelectSingleNode("//input[@id='nameOfId']");
string strValue = node.Attributes["value"].value;

Get Combo Box Text Value
string strValue = "";
foreach (HtmlNode node in doc.DocumentNode.SelectSingleNode("//select[@id='nameOfId']").Elements("option"))
            {              

                   If(node.Attributes["selected"] != null)
                   {
                    strValue = node.Attributes["value"].value;
                    break;                   

                    }
             }

Get Radio Button Value
string strValue = "";
foreach (HtmlNode node in doc.DocumentNode.SelectNodes("//input[@name='nameOfName']"))
            {
                if (node.Attributes["checked"] != null)
                {
                   
strValue = node.Attributes["value"].value;
                    break;
                }
            }


Oh, too many in my mind so that I do not remember it clearly. I will update when I get something else or If you need somethings about it you can comment this article and I will answer as soon.
Posted by Catur Nugroho | File under :


It works much like PrizeLive and other such web sites. You are paid for completing offers and clicking on links. Before the first of the year, daily they had at least a dollar's worth of links to click on per day which was fast and easy, but since it's gone down quite a bit. I guess it fluctuates, but I wish I hadn't been lazy since it would have been easy money. You also get 50 cents for each referral, but all money earned in my first payout was from stuff done on the site and included no referrals.

Payment
You are required to having $2.5 in your account before requesting to cash out, but once your account is verified and you have the $2.5 payment is instant to your PayPal account. It's pretty straightforward.

Payment Proof
I received my first payment instantly after I had verified my account. I recommend verifying your account shortly after you set it up. It will take a day or so for the phone verification to go through. Once you're verified, you're good to go.



How To Join
There are no special qualifications to join. I would appreciate it, however, if you signed up you need referral code to completed it.

Goto playstore and search cashpirate then download that software.
1. Install CashPirate.
2. Enter my referral code- CXWPEV and signup to get 500 points if u wont enter then u will get 0 points so it ur wish.
3. You get 50% coins for the first 1000 coins you earn (= 500 coins bonus) and can start making money right away!

when u have 2500 points then u can redeem for 2.5$ paypal cashout u can use ur friend paypal also or for 5000 points for amazon. Youu can easily make 2500 points per week by installing app like ladoooo and completing some survey.



Posted by Catur Nugroho | File under :
How to read text from xps document using C#.

The purpose of this article is a personal note from the author. When the project is lost or forgotten so it is easier to find on this page. For over 2 years ago I use this code and really helped me.

I'm sorry, My English is not very good and and a little difficult to make the article.

The first step please add some this references of dot net class library :
1. PresentationCore.
2. PresentationFramework.
3. ReachFramework
4. System
5. System.Core.
6. System.Data
7. System.Data.DataSetExtensions
8. System.Deployment
9. System.Drawing
10. System.Runtime.Serialization
11. System.ServiceModel
12. System.Windows.Forms
13. System.Xml
14. System.Xml.Linq
15. WindowsBase.

Add this code into your name space :
using System.Threading;
using System.Windows.Xps.Packaging;
using System.Windows.Documents;


Usually I using threading to run the function. You can use the following code :
Thread _thMain = new Thread(new ThreadStart(StepOne)); //StepOne is function.
_thMain.IsBackground = true;
_thMain.SetApartmentState(ApartmentState.STA);
_thMain.Start();


The first way :
private void StepOne()
        {
            List<string> lData = new List<string>();
            using (XpsDocument xpsDoc = new XpsDocument(@"C:\sample.xps", System.IO.FileAccess.Read))
            {
                FixedDocumentSequence docSeq = xpsDoc.GetFixedDocumentSequence();
                Dictionary<string, string> docPageText = new Dictionary<string, string>();
                for (int pageNum = 0; pageNum < docSeq.DocumentPaginator.PageCount; pageNum++)
                {
                    DocumentPage docPage = docSeq.DocumentPaginator.GetPage(pageNum);
                    foreach (System.Windows.UIElement uie in ((FixedPage)docPage.Visual).Children)
                    {
                        if (uie is System.Windows.Documents.Glyphs)
                        {
                            lData.Add(((System.Windows.Documents.Glyphs)uie).UnicodeString);
                        }
                    }
                }
            }

            string strText = string.Empty;
            foreach (string strItem in lData)
            {
                if (string.IsNullOrEmpty(strItem))
                    continue;

                strText += strItem;
            }
        }


The second way :
private void StepTwo()
        {
            List<string> lData = new List<string>();
            using (XpsDocument xpsDoc = new XpsDocument(@"C:\sample.xps", System.IO.FileAccess.Read))
            {
                FixedDocumentSequence docSeq = xpsDoc.GetFixedDocumentSequence();
                Dictionary<string, string> docPageText = new Dictionary<string, string>();
                for (int pageNum = 0; pageNum < docSeq.DocumentPaginator.PageCount; pageNum++)
                {
                    DocumentPage docPage = docSeq.DocumentPaginator.GetPage(pageNum);
                    foreach (System.Windows.UIElement uie in ((FixedPage)docPage.Visual).Children)
                    {
                        if (uie is System.Windows.Documents.Glyphs)
                        {
                            //lData.Add(((System.Windows.Documents.Glyphs)uie).UnicodeString);
                            string strUnicode = ((System.Windows.Documents.Glyphs)uie).UnicodeString;
                            string strIndices = ((System.Windows.Documents.Glyphs)uie).Indices;
                            string strFormattedLine = "";
                            string[] astrIndices = strIndices.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                            for (int i = 0; i < astrIndices.Length; i++)
                            {
                                strFormattedLine += strUnicode[i].ToString();

                                if (astrIndices[i].Contains(","))
                                {
                                    if (int.Parse(astrIndices[i].Substring(astrIndices[i].IndexOf(",") + 1)) > 150)
                                        if (!strUnicode[i].ToString().Equals(" "))
                                            strFormattedLine += " ";
                                }
                            }

                            lData.Add(strFormattedLine);
                        }
                    }
                }
            }

            string strText = string.Empty;
            foreach (string strItem in lData)
            {
                if (string.IsNullOrEmpty(strItem))
                    continue;

                strText += strItem;
            }
        }


The difference in the two ways above is space.
Sometimes we will find a line that does not have the correct limit so we often struggle to define the data that we want.
Example :
The first way :
444444444444444444444 
The second way :
 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4

I hope this article can help you in managing text in the XPS documents. 

Good Luck!! 

 
 
Posted by Catur Nugroho | File under :
Simple PDF Automation Using Autoit in C#

The topic for this article is how read the text of a PDF document, export into txt file, and return the results as text or string.

This is code for adobe reader X Version 10.1.3, so if the next time you get some code that doesn't run as well might be due to different versions.

This article will explain clearly how we can make simple PDF Automation. If you can't understanding  the code, I have set up the source code so you can debug the code and you can download it from here.

Let's start the code :

This is the image information from the PDF 

 
Parameters :
Title : "[CLASS:AcrobatSDIWindow]" or "sample.pdf - Adobe Reader"
Text : ""

private void RunButton_Click(object sender, EventArgs e)
{
        //open pdf application
        //change it if you have different pdf version 10.1.3
        string strAcrobatReaderType = "AcroRd32";        string strDir = Application.ExecutablePath.Substring(0,      Application.ExecutablePath.LastIndexOf("\\bin") + 1) + "files\\sample.pdf";
        ProcessStartInfo pInfo = new ProcessStartInfo(@"C:\Program Files\Adobe\Reader 10.0\Reader\" + strAcrobatReaderType + ".exe", strDir);
        Process.Start(pInfo);


       //wait the window is opened
       autoit.WinWaitActive("[CLASS:AcrobatSDIWindow]", "", 50);
       if (autoit.WinExists("[CLASS:AcrobatSDIWindow]", "") == 0)
       {
                MessageBox.Show("Windows didn't open");
        }


       //save as text document
       //send keys ALT + f + a

       autoit.Send("!fax", 0);


Save As Image Window Info


Parameters :
Title : "Save As"
Text : ""
Control : Edit1

      string strSaveAsTitle = "Save As";
      string strDir = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\bin") + 1) + "files\\sample.txt";
      int iCountRentry = 0;
     

      //Wait Save As Window is open and check if don't open
      autoit.WinWaitActive(strSaveAsTitle, "", 1000);
      if (autoit.WinExists(strSaveAsTitle, "") == 0)
      {
                MessageBox.Show("Save As Windows didn't open");
       }


       //send keys file directory to save
       do
       {
                if (autoit.ControlGetText(strSaveAsTitle, "", "Edit1").Equals(strDir))
                break;

                //send CTRL + a
                Type("^a", 0, "Edit1", true, 1000, strSaveAsTitle);
                Type(strDir, 0, "Edit1", true, 1000, strSaveAsTitle);

                iCountRentry++;
        }
        while (iCountRentry < 10);
        if (iCountRentry > 10)
        {
                MessageBox.Show("Error sending keys file directory");
        }


Click Save Button Image

Parameters :
Title : "Save As"
Text : ""
Control : Button2
Control Click X : 38
Control Click Y : 10 

        //You have 2 option to save the text document
        //using click button Save As

        Click("left", 1, 44, 12, "Button2", 1000, strSaveAsTitle);

        //or using send key ENTER
        //Type("{ENTER}", 0, "Button2", false, 1000, strSaveAsTitle);

        //read text

        iCountRentry = 0;
        do
        {
                try
                {
                        using (StreamReader reader = new StreamReader(strDir))
                        {
                                 resultTextBox.Text = reader.ReadToEnd();
                        }
                        break;
                 }
                 catch
                
                        Application.DoEvents();
                        Thread.Sleep(1000);
                        iCountRentry++;
                 }
           } while (iCountRentry < 10);

}

Notes :
If this project  didn't working, you have to change some code such as Title, Control, Control Click X and Y. Autoit working because of the screen according to the PC you are using.
Using function of autoit control is better than the others because it is more accurate if used on another PC.

If you getting problems about this please leave a note in the comments so I can help you.

Download Full Source Code 


Posted by Catur Nugroho | File under :

Simple Notepad Automation Using Autoit C#

This is a simple example of how to work with Notepad for sending text, copy / paste, and save it as a file. I will try to explain as details so that you can easily understand.
You can adding this code into your project. This is additional function that I have made, you can copy and paste.

private void Type(string strKeys, int nMode, string strControl, bool blnSleepKeys, int nSleep, string strWindow)
        {
            if (blnSleepKeys)
            {
                char[] achKeys = strKeys.ToCharArray();

                foreach (char ch in achKeys)
                {
                    autoit.ControlSend(strWindow, "", strControl, ch.ToString(), nMode);
                    Thread.Sleep(100);
                    Trace.WriteLine("Sent Key: '" + ch.ToString() + "'");
                }
            }
            else
            {
                autoit.ControlSend(strWindow, "", strControl, strKeys, nMode);
                Trace.WriteLine("Sent Keys: " + strKeys);
            }

            for (int i = 0; i < (nSleep / 100); i++)
            {
                Application.DoEvents();
                Thread.Sleep(100);
            }
        }

        private void Click(string strButton, int nNumClicks, int nX, int nY, string strControl, int nSleep, string strWindow)
        {
            autoit.ControlClick(strWindow, "", strControl, strButton, nNumClicks, nX, nY);

            for (int i = 0; i < (nSleep / 100); i++)
            {
                Application.DoEvents();
                Thread.Sleep(100);
            }
        }


The first step that must be done is to determine the required parameters like as title, text, control, etc..
You can see the images below.



Parameters :
Title : "[CLASS:Notepad]" or "Untitled - Notepad"
Text : ""
Control : Edit1
nX : 78
nY : 53
private void runButton_Click(object sender, EventArgs e)
        {
            //check if notepad is already exist
            if (autoit.WinExists("[CLASS:Notepad]", "") == 1)
            {
                //notepad closed
                autoit.WinKill("[CLASS:Notepad]", "");
            }
            //execute notepad.exe
            autoit.Run("Notepad.exe", "", 1);
            //wait for max 25 seconds
            autoit.WinWaitActive("[CLASS:Notepad]", "", 25);
            //check if notepad doesn't exist
            if (autoit.WinExists("[CLASS:Notepad]", "") == 0)
            {
                MessageBox.Show("Notepad didn't opened");
            }
            else
            {
                //activate the notepad
                //or set notepad into front

                autoit.WinActivate("[CLASS:Notepad]", "");
            }
            //send some text into text area
            string strText = "autoitsourcecode.blogspot.com";
            Type(strText, 0, "Edit1", true, 500, "[CLASS:Notepad]");
            //try to copy / paste

            //send CTRL+ a
            Type("^a", 0, "Edit1", true, 1000, "[CLASS:Notepad]");

            //send CTRL + c (Copy)
            Type("^c", 0, "Edit1", true, 1000, "[CLASS:Notepad]");

            //send CTRL + v (paste)
            Type("^v", 0, "Edit1", true, 1000, "[CLASS:Notepad]");

            //send CTRL + v (paste)
            Type("^v", 0, "Edit1", true, 1000, "[CLASS:Notepad]");

            //send CTRL + v (paste)
            Type("^v", 0, "Edit1", true, 1000, "[CLASS:Notepad]");
            //send CTRL + v (paste)
             Type("^v", 0, "Edit1", true, 1000, "[CLASS:Notepad]");
            //save the file
            //send key alt + f + a

            Type("!fa", 0, "Edit1", true, 500, "[CLASS:Notepad]");
            //wait the "save as" win dialog is opened until 25 seconds
            autoit.WinWaitActive("Save As", "", 25);
            //check if didn't open
            if (autoit.WinExists("Save As", "") == 0)
            {
                MessageBox.Show("The can't saved");
            }


This is images Save As window info



Parameters :
Title : "Save As"
Text : ""
Control : Edit1
nX : 109
nY : 8
            //send key directory folder
            Type(@"C:\autoitDemo.txt", 0, "Edit1", true, 1000, "Save As");
            //check the files
            if (File.Exists(@"C:\autoitDemo.txt"))
                File.Delete(@"C:\autoitDemo.txt");
The image for click Save button


Parameters :
Title : "Save As"
Text : ""
Control : Edit1
nX : 46
nY :13

            //click button save
            Click("left", 1, 42, 15, "Button1", 1000, "Save As");
            //check if notepad is already exist
            if (autoit.WinExists("[CLASS:Notepad]", "") == 1)
            {
                //notepad closed
                autoit.WinKill("[CLASS:Notepad]", "");
            }
        }

Download Full Source Code
Posted by Catur Nugroho | File under :

Autoit Win Active Using C#

Checks to see if a specified window exists and is currently active.
WinActive ( "title" [, "text"] )

Parameters

title The title of the window to check. See Title special definition.
text [optional] The text of the window to check.

Return Value

Success: Returns the handle to the window if it is active.
Failure: Returns 0 otherwise.

Remarks

None.

Source : Autoit Help Document

Autoit Win Active In C#



Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Time Out :

 private void winWaitbutton_Click(object sender, EventArgs e)
        {           
            //open notepad
            autoit.Run("Notepad.exe", "", 1);

            //Wait a maximum of 20 seconds for "[CLASS:Notepad]" to exist
            autoit.WinWait("[CLASS:Notepad]", "", 20);

            if (autoit.WinActive("[CLASS:Notepad]", "") == 0)
            {
                MessageBox.Show("Notepad didn't active");
            }
        }


Download Full Source Code
Posted by Catur Nugroho | File under :

Autoit Win Wait Active Using C#

Pauses execution of the script until the requested window is active.
WinWaitActive ( "title" [, "text" [, timeout]] )

Parameters

title The title of the window to check. See Title special definition.
text [optional] The text of the window to check.
timeout [optional] Timeout in seconds

Return Value

Success: Returns handle to the requested window.
Failure: Returns 0 if timeout occurred.

Remarks

None.

Source : Autoit Help Document

Source Code Autoit Win Wait In C#

 


Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Time Out :

   private void winWaitButton_Click(object sender, EventArgs e)
        {
            DateTime dtStart = DateTime.Now;

            //open notepad
            autoit.Run("Notepad.exe", "", 1);

            //Wait a maximum of 20 seconds for "[CLASS:Notepad]" to exist and be active
            autoit.WinWaitActive("[CLASS:Notepad]", "", 20);

            label1.Text = "waiting for " + (DateTime.Now - dtStart).Seconds.ToString() + " seconds from 10 seconds";
        }


Download Full Source Code (look into source code if the notepad doesn't exist)
Posted by Catur Nugroho | File under :

Autoit Win Wait Using C#

WinWait

Pauses execution of the script until the requested window exists.
WinWait ( "title" [, "text" [, timeout]] )

Parameters
title The title of the window to check. See Title special definition.
text [optional] The text of the window to check.
timeout [optional] Timeout in seconds

Return Value
Success: Returns handle to the requested window.
Failure: Returns 0 if timeout occurred.

Remarks
None.

Source : Autoit Help Document

Source Code Autoit Win Wait In C#


Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Time out :

        private void winWaitButton_Click(object sender, EventArgs e)
        {
            DateTime dtStart = DateTime.Now;

            //open notepad
            autoit.Run("Notepad.exe", "", 1);

            //Wait a maximum of 20 seconds for "[CLASS:Notepad]" to exist
            autoit.WinWait("[CLASS:Notepad]", "", 20);

            label1.Text = "waiting for " + (DateTime.Now - dtStart).Seconds.ToString() + " seconds";
        }


Download Full Source Code (look into source code if the notepad doesn't exist)
Posted by Catur Nugroho | File under :

Autoit Control List View Using C#


Sends a command to a TreeView32 control.
ControlTreeView ( "title", "text", controlID, "command" [, option1 [, option2]] )

Parameters

title The title of the window to access.
text The text of the window to access.
controlID The control to interact with. See Controls.
command The command to send to the control (see below).
option1 [optional] Additional parameter required by some commands.
option2 [optional] Additional parameter required by some commands.

Return Value

Depends on command as table below shows. In case of an error (such as an invalid command or window/control could not be found) then @error is set to 1.


Command, Option1, Option2 Operation
"Check", "item" Checks an item (if the item supports it).
"Collapse", "item" Collapses an item to hide its children.
"Exists", "item" Returns 1 if an item exists, otherwise 0.
"Expand", "item" Expands an item to show its children.
"GetItemCount", "item" Returns the number of children for a selected item.
"GetSelected" [, UseIndex] Returns the item reference of the current selection using the text reference of the item (or index reference if UseIndex is set to 1).
"GetText", "item" Returns the text of an item.
"IsChecked" Returns the state of an item. 1:checked, 0:unchecked, -1:not a checkbox.
"Select", "item" Selects an item.
"Uncheck", "item" Unchecks an item (if the item supports it).


The "item" parameter is a string-based parameter that is used to reference a particular treeview item using a combination of text and indices. Indices are 0-based. For example:

Heading1
----> H1SubItem1
----> H1SubItem2
----> H1SubItem3
----> ----> H1S1SubItem1
Heading2
Heading3

Each "level" is separated by |. An index is preceded with #. Examples:


Item Item Reference
Heading2 "Heading2" or "#1"
H1SubItem2 "Heading1|H1SubItem2" or "#0|#1"
H1S1SubItem1 "Heading1|H1SubItem3|H1S1SubItem1" or "#0|#2|#0"


References can also be mixed like "Heading1|#1".

Remarks

As AutoIt is a 32-bit application some commands are not available when referencing a 64-bit application as Explorer when running on 64-bit Windows.

Source : Autoit Help Document
Posted by Catur Nugroho | File under :

Autoit Control Show Using C#

Shows a control that was hidden.
ControlShow ( "title", "text", controlID )

Parameters

title The title of the window to access.
text The text of the window to access.
controlID The control to interact with. See Controls.

Return Value

Success: Returns 1.
Failure: Returns 0 if window/control is not found.

Remarks

None.

Source : Autoit Help Document

Source Code Autoit Control Show In C#



Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Control : Edit1

private void controlShowButton_Click(object sender, EventArgs e)
        {
            //open notepad program
            autoit.Run("notepad.exe", "", 1);

            //wait notepad opened until 10 seconds
            autoit.WinWait("[CLASS:Notepad]", "", 10);

            //hide text area
            autoit.ControlHide("[CLASS:Notepad]", "", "Edit1");
            Thread.Sleep(2000);

            //show text area
            autoit.ControlShow("[CLASS:Notepad]", "", "Edit1");
        }


Download Full Source Code
Posted by Catur Nugroho | File under :

Autoit Control Set Text Using C#

Sets text of a control.
ControlSetText ( "title", "text", controlID, "new text" [, flag] )

Parameters

title The title of the window to access.
text The text of the window to access.
controlID The control to interact with. See Controls.
new text The new text to be set into the control.
flag [optional] when different from 0 (default) will force the target window to be redrawn.

Return Value

Success: Returns 1.
Failure: Returns 0 if window/control is not found.

Remarks

None.

Source : Autoit Help Document

Source Code Autoit Control Set Text In C#



Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Control : Edit1

private void controlSetTextButton_Click(object sender, EventArgs e)
        {
            //open notepad program
            autoit.Run("notepad.exe", "", 1);

            //wait notepad opened until 10 seconds
            autoit.WinWait("[CLASS:Notepad]", "", 10);

            //set the text
            autoit.ControlSetText("[CLASS:Notepad]", "", "Edit1", "autoitsourcecode.blogspot.com");
        }


Download Full Source Code
Posted by Catur Nugroho | File under :

Autoit Control Move Using C#

Moves a control within a window.
ControlMove ( "title", "text", controlID, x, y [, width [, height]] )

Parameters

title The title of the window to move.
text The text of the window to move.
controlID The control to interact with. See Controls.
x X coordinate to move to relative to the window client area.
y Y coordinate to move to relative to the window client area.
width [optional] New width of the window.
height [optional] New height of the window.

Return Value

Success: Returns 1.
Failure: Returns 0 if window/control is not found.

Remarks

If x and y equal to the Default keyword no move occurs, just resizing.

Source : Autoit Help Document

Source Code Autoit Control Move In C#

 


Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Control : Edit1

private void controlMoveButton_Click(object sender, EventArgs e)
        {
            //open notepad program
            autoit.Run("notepad.exe", "", 1);

            //wait notepad opened until 10 seconds
            autoit.WinWait("[CLASS:Notepad]", "", 10);

            if (MessageBox.Show("Are you sure want to move it?", "confirmation", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
            {
                autoit.ControlMove("[CLASS:Notepad]", "", "Edit1", 200, 200, 200, 200);
            }
        }


Download Full Source Code
Posted by Catur Nugroho | File under :

Autoit Control Get List View Using C#

Sends a command to a ListView32 control.
ControlListView ( "title", "text", controlID, "command" [, option1 [, option2]] )

Parameters

title The title of the window to access.
text The text of the window to access.
controlID The control to interact with. See Controls.
command The command to send to the control (see below).
option1 [optional] Additional parameter required by some commands.
option2 [optional] Additional parameter required by some commands.

Return Value

Depends on command as table below shows. In case of an error (such as an invalid command or window/control could not be found) then @error is set to 1.


Command, Option1, Option2 Operation
"DeSelect", From [, To] Deselects one or more items.
"FindItem", "string to find" [, SubItem] Returns the item index of the string. Returns -1 if the string is not found.
"GetItemCount" Returns the number of list items.
"GetSelected" [, option] Returns a string containing the item index of selected items. If option=0 (default) only the first selected item is returned. If option=1 then all the selected items are returned delimited by |, e.g: "0|3|4|10". If no items are selected a blank "" string is returned.
"GetSelectedCount" Returns the number of items that are selected.
"GetSubItemCount" Returns the number of subitems.
"GetText", Item, SubItem Returns the text of a given item/subitem.
"IsSelected", Item Returns 1 if the item is selected, otherwise returns 0.
"Select", From [, To] Selects one or more items.
"SelectAll" Selects all items.
"SelectClear" Clears the selection of all items.
"SelectInvert" Inverts the current selection.
"ViewChange", "view" Changes the current view. Valid views are "list", "details", "smallicons", "largeicons".


All items/subitems are 0 based. This means that the first item/subitem in a list is 0, the second is 1, and so on.
In a "Details" view of a ListView32 control, the "item" can be thought of as the "row" and the "subitem" as the "column".

Remarks

Some commands may fail when using a 32-bit AutoIt process to read from a 64-bit process. Likewise commands may fail when using a 64-bit AutoIt process to read from a 32-bit process.

Source : Autoit Help Document
Posted by Catur Nugroho | File under :

Autoit Control Hide Using C#

Hides a control.
ControlHide ( "title", "text", controlID )

Parameters

title The title of the window to access.
text The text of the window to access.
controlID The control to interact with. See Controls.

Return Value

Success: Returns 1.
Failure: Returns 0 if window/control is not found.

Remarks

None.

Source : Autoit Help Document

Source Code Autoit Control Hide In C#

 


Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Control : Edit1

private void controlHidebutton_Click(object sender, EventArgs e)
        {
            //open notepad program
            autoit.Run("notepad.exe", "", 1);

            //wait notepad opened until 10 seconds
            autoit.WinWait("[CLASS:Notepad]", "", 10);

            autoit.ControlHide("[CLASS:Notepad]", "", "Edit1");
        }


Download Full Source Code
Posted by Catur Nugroho | File under :

Autoit Control Get Text Using C#

Retrieves text from a control.
ControlGetText ( "title", "text", controlID )

Parameters

title The title of the window to access.
text The text of the window to access.
controlID The control to interact with. See Controls.

Return Value

Success: Returns text from a control.
Failure: Sets @error to 1 and returns a blank string of "".

Remarks

None.

Source : Autoit Help Document

Source Code Autoit Control Get Text In C#


Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Control : Edit1

 private void controlGetTextbutton_Click(object sender, EventArgs e)
        {
            //open notepad program
            autoit.Run("notepad.exe", "", 1);

            //wait notepad opened until 10 seconds
            autoit.WinWait("[CLASS:Notepad]", "", 10);

            //send text example
            autoit.ControlSend("[CLASS:Notepad]", "", "Edit1", "autoitsourcode.blogspot.com", 0);

            //get the texts
            string strReturnText = autoit.ControlGetText("[CLASS:Notepad]", "", "Edit1");

            returnGetTextLabel.Text = "Return text from text area notepad : \n" + strReturnText;
        }


 Download Full Source Code


Posted by Catur Nugroho | File under :

Autoit Control Get Pos (x) (y) Using C#

Retrieves the position and size of a control relative to its window.
ControlGetPos ( "title", "text", controlID )

Parameters

title The title of the window to access.
text The text of the window to access.
controlID The control to interact with. See Controls.

Return Value

Success: Returns an array containing the size and the control's position relative to its client window:

$array[0] = X position

$array[1] = Y position

$array[2] = Width

$array[3] = Height
Failure: Sets @error to 1.

Remarks

The title/text is referencing the parent window, so be careful with "","" which references the active window which may not be the one containing the controlID control.

Source : Autoit Help Document

Source Code Autoit Control Get Pos (x) (y) In C#


Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Control : Edit1

private void controlGetPosXYButton_Click(object sender, EventArgs e)
        {
            //open notepad program
            autoit.Run("notepad.exe", "", 1);

            //wait notepad opened until 10 seconds
            autoit.WinWait("[CLASS:Notepad]", "", 10);

            //get x position
            int iReturnGetPosX = autoit.ControlGetPosX("[CLASS:Notepad]", "", "Edit1");

            //get y position
            int iReturnGetPosY = autoit.ControlGetPosY("[CLASS:Notepad]", "", "Edit1");

            returnGetPosLabel.Text = "Autoit get control pos (x) : " + iReturnGetPosX.ToString() + "\n";
            returnGetPosLabel.Text += "Autoit get control pos (y) : " + iReturnGetPosY.ToString() + "\n";
        }


Download Full Source Code
Posted by Catur Nugroho | File under :

Autoit Control Get Post Height / Width Using C#

Retrieves the position and size of a control relative to its window.
ControlGetPos ( "title", "text", controlID )

Parameters

title The title of the window to access.
text The text of the window to access.
controlID The control to interact with. See Controls.

Return Value

Success: Returns an array containing the size and the control's position relative to its client window:

$array[0] = X position

$array[1] = Y position

$array[2] = Width

$array[3] = Height
Failure: Sets @error to 1.

Remarks

The title/text is referencing the parent window, so be careful with "","" which references the active window which may not be the one containing the controlID control.

Source : Autoit Help Document

Source Code Autoit Control Get Height / Width in C#


Parameters Required :
Title : [CLASS:Notepad]
Text : ""
Control : Edit1

private void controlGetPosButton_Click(object sender, EventArgs e)
        {
            //open notepad program
            autoit.Run("notepad.exe", "", 1);

            //wait notepad opened until 10 seconds
            autoit.WinWait("[CLASS:Notepad]", "", 10);

            //get height position
            int iReturnGetPosHeight = autoit.ControlGetPosHeight("[CLASS:Notepad]", "", "Edit1");

            int iReturnGetPosWidth = autoit.ControlGetPosWidth("[CLASS:Notepad]", "", "Edit1");

            returnGetPosLabel.Text = "Autoit get control height (x) : " + iReturnGetPosHeight.ToString() + "\n";
            returnGetPosLabel.Text += "Autoit get control width (y) : " + iReturnGetPosWidth.ToString() + "\n";
        }


 Download Full Source Code