Jump to content

Injecting


Recommended Posts

Could someone help me with injecting a simple "send this button to this program" script? I've got the script that send the key. But what's the code to tell it only to send to the program I want it to? I tried the help files, but they weren't much of a help.

I will continue looking for it in the help files. But an answer would be really helpful! (:

Link to comment
Share on other sites

Use ControlSend

Or work with WinActivate / Winactive etc

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Use ControlSend

Or work with WinActivate / Winactive etc

I found ControlSend. But how does it work? This is what I wrote

ControlSend ( "This is the program", "", controlID, "z12" [, 1] )

while 1

send("z")

send("1")

send("2")

sleep(260)

wend

Func quitscript()

Exit

EndFunc

As you can see I am trying to send the keys z12 to this program. And as you probably figured out I am pretty new to this.

Link to comment
Share on other sites

I found ControlSend. But how does it work? This is what I wrote

ControlSend ( "This is the program", "", controlID, "z12" [, 1] )

while 1

send("z")

send("1")

send("2")

sleep(260)

wend

Func quitscript()

Exit

EndFunc

As you can see I am trying to send the keys z12 to this program. And as you probably figured out I am pretty new to this.

For starters, in your example:

ControlSend ( "This is the program", "", controlID, "z12" [, 1] )

you'd want to remove the square brackets from the "1" at the end. Square brackets designate that the specified parameter is optional (if you don't need it, you don't have to include it).

Additionally, where "controlID" is shown in the code, you'd want to actually give the name of the specific control ID ("[CLASSNN:Edit1]" or some such).

So, for that particular line, with the example control ID of "[CLASSNN:Edit1]", you'd want to change it to:

ControlSend ( "This is the program", "", "[CLASSNN:Edit1]", , "z12" , 1 )

Hope that helps clear things up a bit.

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

alright, first of all you dont need the :

send("z")

send("1")

send("2")

you could just write Send("z12"), this will save you time in the future :D

try this:

CODE

HotKeySet("!x", "exit")

WinActivate("name of window/program");activates the specified window

WinWaitActive("name of window/program") ;this will wait until that program is active and then continue with the script

while 1

send("z12")

sleep(260)

WEnd

Func exit()

Exit

EndFunc

this will repeatedly send "z12" until you hit alt+x [HotKeySet("!x", "exit")]

hope this helps :D

Link to comment
Share on other sites

Additionally, where "controlID" is shown in the code, you'd want to actually give the name of the specific control ID ("[CLASSNN:Edit1]" or some such).

So I put in [CLASSNN:program] and it's still the same.

This thing "CLASSNN" makes no sense to me. What does it stand for? What does it do? /:

Why can't it just be "Send "z""1""2" to "the process of the program"

Tapeworm. That looks alot easier. But now when I run it it says "badly formatted func statement"

Link to comment
Share on other sites

So I put in [CLASSNN:program] and it's still the same.

This thing "CLASSNN" makes no sense to me. What does it stand for? What does it do? /:

Look in the help file for the entry on Controls for information on identifying (with the AutoIt Window Info Tool) controls, and their usage.

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

Look in the help file for the entry on Controls for information on identifying (with the AutoIt Window Info Tool) controls, and their usage.

I think I got it right this time (: It's just the func thingy left. "Badly formatted "Func" statement." And I can't figure that one out.

Line -1

Func exit()

Exit

EndFunc

Edited by populus
Link to comment
Share on other sites

I think I got it right this time (: It's just the func thingy left. "Badly formatted "Func" statement." And I can't figure that one out.

Line -1

Func exit()

Exit

EndFunc

Maybe I was a bit unclear. When I try to run the script. It says

"Line -1"

"Badly formatted "Func" statement"

What should I do?

Link to comment
Share on other sites

Func exit() ...

You mustn't use a key-Word as Function name! (AutoIt is case INsensitive)

You can use this:

Func MyExit()

Exit

EndFunc

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

Maybe I was a bit unclear. When I try to run the script. It says

"Line -1"

"Badly formatted "Func" statement"

What should I do?

cant have
func exit()

change it to

func quit()

and on the setkey make it

HotKeySet("!x", "quit")

 

Spoiler

WinSizer 2.1 (01/04/2017) - Download - [ Windows Layout Manager ]
Folder+Program (12/23/2016) - Download - [ USB Shortcut Creator ]

 

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