Jump to content

Help


Recommended Posts

I am new in AutoIt, this is my first post; Please help:

I have many rows, I want to delete every day, when I click on a row a conformation Java window appear asking for conformation, if yes I have to click Submit button otherwise click Cancel Button.

How can click the Submit Button when the conformation window is activated,(may be just by finding the label "submit" to click it;

(Note:- I cant use the Window title since each time it contain different number (Ticket number 243677776; Ticket number 243677755,)

Link to comment
Share on other sites

I am new in AutoIt, this is my first post; Please help:

I have many rows, I want to delete every day, when I click on a row a conformation Java window appear asking for conformation, if yes I have to click Submit button otherwise click Cancel Button.

How can click the Submit Button when the conformation window is activated,(may be just by finding the label "submit" to click it;

(Note:- I cant use the Window title since each time it contain different number (Ticket number 243677776; Ticket number 243677755,)

The default WinTitleMatchMode is to match the begining of the title. So "Ticket number " would match either of your example titles without providing the number.

Does the window show valid controls in the AutoIT Info utility?

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

The default WinTitleMatchMode is to match the begining of the title. So "Ticket number " would match either of your example titles without providing the number.

Does the window show valid controls in the AutoIT Info utility?

:D

Thanks a lot, it works, but when I tried to creat a GUI which contains a simple input box to enter number of lins

to be deleated its not working (number of loops; $Num), the loop itself is working without a problem

I would apriciate any feed back

Dim $Acc=("Prince")

Dim $Num="3" ;Number of Rows to be deleted

opt("WinTitleMatchMode",2)

opt("MouseCoordMode",2)

#include<GUIConstants.au3>

GuiCreate("Close Pad ",326,200) ;Creat a GUI Close Pad

$Labale_1=GuiCtrlCreateLabel("Number :",44,42,60,25)

$Input_Units=GuiCtrlCreateInput($Num,100,42,60,25)

GUISetState()

;Loop

$i = 0

Do

MouseClick("left", 144,99, 1) ;Click to delete allways the first Line

sleep(500)

MouseClick("left", 191,269, 1) ;Click Submit Button

$i = $i + 1

Until $i = $Num

sleep(100)

Exit

Link to comment
Share on other sites

Thanks a lot, it works, but when I tried to creat a GUI which contains a simple input box to enter number of lins

to be deleated its not working (number of loops; $Num), the loop itself is working without a problem

I would apriciate any feed back

Include statements should be the first code in your script after the top comments and whitespace. I don't see you using any actual GUIConstants, though, so you could just delete that if not used elsewhere in the script:

#include<GUIConstants.au3>

You don't need the parens around the string setting a variable. Using "3" gets you the ASCII string for three, not the number 3. You don't seem to use $Acc anywhere, I assume that code is just not shown:

Dim $Acc = "Prince", $Num = 3

Just comments to remind me what you're doing:

opt("WinTitleMatchMode",2); 2=Match any substr
opt("MouseCoordMode",2); 2=Client area coords

GUI looks OK, as far as it goes...

GuiCreate("Close Pad",326,200);Create a GUI Close Pad
$Labale_1=GuiCtrlCreateLabel("Number  :",44,42,60,25)
$Input_Units=GuiCtrlCreateInput($Num,100,42,60,25)
GUISetState()

Using For/Next will avoid having to do the incrementing yourself:

;Loop
For $i = 0 To $Num
     MouseClick("left", 144,99, 1);Click to delete allways the first Line
     sleep(500)
     MouseClick("left", 191,269, 1);Click Submit Button
     sleep(100)
Next
Exit

Now, that loop executes four times (for $i = 0 thru 3). If you meant to get 3 times just make that line:

For $i = 1 To $Num

What I don't see is any use of your GUI at all... what are we missing? :whistle:

To use your custom GUI you need a loop that does GuiGetMsg() and maybe add an "OK" button. (Check out the help file examples for GuiCtrlCreateButton(), and GuiCtrlCreateInput() for what the loops look like.)

Easier would be using InputBox(). Then you would replace your GUI with a loop like this:

While 1; Loop until user gives a valid input
    $Num = InputBox(""Close Pad", "Number :"); Prompt user for $Num
    $Num = Number($Num); Convert string to number
    If IsInt($Num) And $Num > 0 Then ExitLoop; Test for valid entry
Wend

One more change for the main loop, based on an assumption that $Acc was meant to be a string used to activate the appropriate window:

;Loop
For $i = 1 To $Num
    WinActivate($Acc); Activate the window
    WinWaitActive($Acc); Wait until it is active
    MouseClick("left", 144,99, 1); Click to delete allways the first Line
    sleep(500)
    MouseClick("left", 191,269, 1); Click Submit Button
    sleep(100)
Next

Put it all together and you get:

Dim $Acc = "Prince"
opt("WinTitleMatchMode",2); 2=Match any substr
opt("MouseCoordMode",2); 2=Client area coords

While 1; Loop until user gives a valid input
    $Num = InputBox(""Close Pad", "Number :"); Prompt user for $Num
    $Num = Number($Num); Convert string to number
    If IsInt($Num) And $Num > 0 Then ExitLoop; Test for valid entry
Wend

;Loop
For $i = 1 To $Num
    WinActivate($Acc); Activate the window
    WinWaitActive($Acc); Wait until it is active
    MouseClick("left", 144,99, 1); Click to delete allways the first Line
    sleep(500)
    MouseClick("left", 191,269, 1); Click Submit Button
    sleep(100)
Next

Exit

:)

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...