Sign in to follow this  
Followers 0
Stefan22

Script presses button but doesn't execute it for some reason

20 posts in this topic

#1 ·  Posted (edited)

Hello,

I have a question: "Is it possible to make a script to get something like when im pressing F12 it will automaticly fill in the text/numbers 0123456789?"

Some sort of thing with hotkeys. Im kinda new here so dont really know how it has to work.

Greetings Stefan

EDIT: Got this working now, just need to know how to press a button in a other window :)

Edited by Stefan22

Share this post


Link to post
Share on other sites



HotKeySet() and Send() :)


[center][font="Arial"]If practise makes perfect and no-ones perfect whats the point of practise?[/font]Sorry for my rude attitude when I started here.[/center]

Share this post


Link to post
Share on other sites

EDIT: Got this working now, just need to know how to press a button in a other window :)

ControlClick ( "title", "text", controlID)

My Projects - WindowDarken (Darken except the active window) Yahsmosis Chat Client (Discontinued) StarShooter Game (Red alert! All hands to battlestations!) YMSG Protocol Support (Discontinued) Circular Keyboard and OSK example. (aka Iris KB) Target Screensaver Drive Toolbar Thingy Rollup Pro (Minimize-to-Titlebar & More!) 2D Launcher physics example Ascii Screenshot AutoIt3 Quine Example ("Is a Quine" is a Quine.) USB Lock (Another system keydrive - with a toast.)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thanks alot, got it almost working now :)

EDIT: Only thing I need to know is where to find the ControlID of the button

Edited by Stefan22

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hmmm let me tell u what i have to do ^^

I got a program called Phone Dialer Pro. In this program u can press buttons and call people etc.

Now I need to make a script which automaticly starts the program, uses a hotkey to fill in the number 0123456789 and after that press the Dial button.

Maybe anyone can help me with this?

Greetings Stefan.

Edited by Stefan22

Share this post


Link to post
Share on other sites

This should do the job.

Just edit the title of the window and the two control IDs:

HotKeySet("{F12}","call")

While 1
    Sleep(100)
WEnd

Func call()
    
    ControlSend("title of window","","Control ID for the control with the number","0123456789") ; number to call
    
    Sleep(200)
    
    ControlClick("Title of window","","Control ID of the dial button") ; press the dial button
    
EndFunc

Regards

Share this post


Link to post
Share on other sites

Ok thanks for fast reply, I will give it a try

Share this post


Link to post
Share on other sites

Ok thanks for fast reply, I will give it a try

You do know how to get the control ID and the title. right? if not just use the Autoit window info..

Regards

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Yes I think I found that. This is what I have now:

Run("C:\Program Files\Phone Dialer Pro2\phonepro.exe")

HotKeySet("{F12}","call")

While 1
    Sleep(100)
WEnd

Func call()
    
    ControlSend("Phone Dialer Pro - "one"","","23","0123456789"); number to call
    
    Sleep(200)
    
    ControlClick("Phone Dialer Pro - "one"","","7"); press the dial button
    
EndFunc

But when im trying to run this it gives an error the one that autoit3.exe cant be runned and has to close. So for some reason I cant run the script :/

EDIT: 'I think' that my program cant run the ControlClick and Controlsend dont know why this is, but its annoying :)

EDIT2: This is how the program looks like

http://img81.imageshack.us/my.php?image=windowsw3.jpg

And this is the error I get ps: sorry its in dutch :P

http://img253.imageshack.us/my.php?image=window2dz7.jpg

Edited by Stefan22

Share this post


Link to post
Share on other sites

Hmm can anyone help here? :)

Share this post


Link to post
Share on other sites

The problem could be the lines that have extra quotes in them, like this part:

ControlSend("Phone Dialer Pro - "one"","","23","0123456789"); number to calloÝ÷ Ù'-è¨ïâÆåiÉ"Ë^iÚrhº·N­ßÛyÆ®±ëaz«¨µ«b¢y®FÞ~ÞÞþ'%¢Ç¬¶¬¶¸§'ò¢ìÛh«Þªê-jبf«È§²'^jËkx2¢èZ½ëhv'zíÂax,+az·h¹¹^¶ªºZ¶*'ªä²X¤zØb°Ú-Ç¡£­«*ºjºhꮢڮ¢Ø§²×vêºhꮢ֮¶­sd6öçG&öÅ6VæBgV÷CµöæRFÆW"&òÒgV÷C²gV÷C¶öæRgV÷C²gV÷C²gV÷C²ÂgV÷C²gV÷C²ÂgV÷C³#2gV÷C²ÂgV÷C³#3CScsgV÷C²²çVÖ&W"Fò6Æ

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Ok thanks :) I got rid of the errors, but still the F12 button doesnt work :s no idea why this is..

Edited by Stefan22

Share this post


Link to post
Share on other sites

Does anyone know why the script doesn't press the buttons on the program?

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Does anyone know why the script doesn't press the buttons on the program?

hmm is there maybe another hotkey set to F12 from the dial program

and what you mean by buttons aren't pressed?

i guess the ControlSend sends only characters to the window

and you controlclick does not seem to specify on a button

your like:

ControlClick('Phone Dialer Pro - "one"',"","7")

But there you dont defined a button that is to be clicked?

look for the right command vvv

ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] )

after the 3rd " , " comes the button to press

but you dont got something for that part..

i never made a gui but i guess thats it :)

Edited by Verox743

Started with AutoIt on 12th June, 2008.

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Hmm well, the program doesn't use F12 for anything else. And I can try to make the controlclick like you give it :)

Run("C:\Program Files\Phone Dialer Pro2\phonepro.exe")

HotKeySet("{F11}","bellen") 

While 1
    Sleep(500)
WEnd

Func bellen()
    
    MouseClick("left", 754, 307)
    
    Send("123456789")
    
    Sleep(999)
    
    ControlClick ('Phone Dialer Pro - "one"', "", 7 , "left" , 1 , 806 , 572)
    
EndFunc

Got this now, but when starting the program it gives in the number wich I have to dial, and it looks like its pressing the button... But it does not dial :s

Edited by Stefan22

Share this post


Link to post
Share on other sites

Does anyone know how to get this working?

Share this post


Link to post
Share on other sites

Try showing us the summary text of the button/control you're trying to click.

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

>>>> Window <<<<

Title: Phone Dialer Pro - "Untitled"

Class: ThunderRT5Form

Position: 615, 394

Size: 320, 388

Style: 0x16CA0000

ExStyle: 0x00040100

Handle: 0x001D02A6

>>>> Control <<<<

Class: ThunderRT5CommandButton

Instance: 4

ClassnameNN: ThunderRT5CommandButton4

Advanced (Class): [CLASS:ThunderRT5CommandButton; INSTANCE:4]

ID: 7

Text:

Position: 12, 274

Size: 111, 57

ControlClick Coords: 56, 22

Style: 0x5C01000B

ExStyle: 0x00000004

Handle: 0x001C016E

>>>> Mouse <<<<

Position: 686, 739

Cursor ID: 0

Color: 0xECE9D8

>>>> StatusBar <<<<

>>>> Visible Text <<<<

II

M

M

(...)

Frame1

>>>> Hidden Text <<<<

Edit1: Okay this is it, dont mind the title of it ^^ its Untitled now, should be one but that isn't a problem can change that whenever I want.

Edited by Stefan22

Share this post


Link to post
Share on other sites

This should click the button:

ControlClick("Phone Dialer Pro -" , "" , 7 )

See that 7 is not in quotes since it is an ControlID number and not the ClassnameNN

Regards

Share this post


Link to post
Share on other sites

Thanks alot, it works now! :)

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  
Followers 0