Jump to content

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


Recommended Posts

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
Link to comment
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.)

Link to comment
Share on other sites

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
Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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Æ
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

>>>> 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
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...