Sign in to follow this  
Followers 0
Krackin

Trying To Make A Script

29 posts in this topic

#1 ·  Posted (edited)

okay i want to make a script that will press 4 in a separate window without switching to it if possible

the window name is U2K

EDIT if Possible also that it was activated by a hotkey

Edited by Krackin

Share this post


Link to post
Share on other sites



What do have so far?

PS: Where has the COP bot gone?

okay i want to make a script that will press 4 in a separate window without switching to it if possible

the window name is U2K

EDIT if Possible also that it was activated by a hotkey

Share this post


Link to post
Share on other sites

i have nothing so far i usually have my bro do scripts for me but his pc is broken im gunna be using it for diablo 2 median mod so that i can make my second char drink an exp lixer while i kill stuff

Share this post


Link to post
Share on other sites

try ControlSend()

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

okay let me clear the first post up

i want a script that will make a keystroke in a second window without actually switching to it and set to a hotkey

key to press 4

window name to press in is U2K

hotkey preferably -

if its possible

ive never personally worked with script but i learn really fast any hints/tip would be greaty appreciated

Edited by Krackin

Share this post


Link to post
Share on other sites

So im guessing its not possible?

Share this post


Link to post
Share on other sites

It's already been answered, ControlSend().

HotKeySet("{PAUSE}" , "start") ;change hotkey

Func start()

ControlSend ( "title", "text", controlID, "4") ;change the parameters, you can read about them in the helpfile.

Endfunc

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

HotKeySet("{ENTER}" , "start")

Func start()

ControlSend ( "U2K", "", controlID, "4")

Endfunc

---------------------------

AutoIt Error

---------------------------

Line 5 (File "C:\Documents and Settings\Sterling\Desktop\U2K Elixer Bot.au3"):

ControlSend ( "U2K", controlID, "4")

ControlSend ( "U2K", controlID^ ERROR

Error: Missing separator character after keyword.

---------------------------

OK

---------------------------

what did i do wrong?

EDIT: Fixed The Error but i just tryed to run it and it wont start

Edited by Krackin

Share this post


Link to post
Share on other sites

Glad to see you got started.

Optional Use:

ProcessWait("u2k_process.exe"); To wait until this process is running - Use Au3Info.exe or Taskmanager to determine the actual EXE name

Or Just Use:

WinWaitActive("U2K"); To wait until there is an active Window with the title U2K

Use:

WinActivate("U2K"); To force focus to this Window

And then

Send("4"); To Send 4

what did i do wrong?

Share this post


Link to post
Share on other sites

HotKeySet("{ENTER}" , "start")

Func start()

ControlSend ( "U2K", "", controlID, "4")

Endfunc

---------------------------

AutoIt Error

---------------------------

Line 5 (File "C:\Documents and Settings\Sterling\Desktop\U2K Elixer Bot.au3"):

ControlSend ( "U2K", controlID, "4")

ControlSend ( "U2K", controlID^ ERROR

Error: Missing separator character after keyword.

---------------------------

OK

---------------------------

what did i do wrong?

EDIT: Fixed The Error but i just tryed to run it and it wont start

The line that has an error does not look the same as the line shown at the top of your post.

ControlSend ( "U2K", "", controlID, "4")

ControlSend ( "U2K", controlID, "4")

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Anyone Have Msn Im So Confused

Edit

ddiadlo19@hotmail.com

Edited by Krackin

Share this post


Link to post
Share on other sites

No to MSN.

Try this:

WinWait("U2K")
WinActivate("U2K")
If WinActive("U2K") Then Send("4")

If it needs an Enter after 4, then modify Send to:

Send("4{ENTER}")

If this works then you can enhance it to use a Hotkey and move the (above) working code to a function.

Anyone Have Msn Im So Confused

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Okay so What Order Does The Stuff Go In I Have This So Far

HotKeySet("{0}" , "start")

Func start()

ControlSend ( "U2K", "text", controlID "4")

Endfunc

where do i add into it like i said ive never used auto it b4

Is There Anywhere To See The Basic Order This Stuff Goes In Ive Been Looking In The Help File And Have Found Nothing Like What I Want Or The Order Of Things

EDIT: Idk I May Just Quit Trying Im Trying to Figure This Out And Im Runing A 103 Fever Plus Nothing I Make Will Even Open

Edited by Krackin

Share this post


Link to post
Share on other sites

Try running the (first) part of the code I posted.

If it works then place that code within your start() function replacing your (controlsend line).

Take care, chill (fever remember?), and have a nice WE.

Okay so What Order Does The Stuff Go In I Have This So Far

HotKeySet("{0}" , "start")

Func start()

ControlSend ( "U2K", "text", controlID "4")

Endfunc

where do i add into it like i said ive never used auto it b4

Is There Anywhere To See The Basic Order This Stuff Goes In Ive Been Looking In The Help File And Have Found Nothing Like What I Want Or The Order Of Things

EDIT: Idk I May Just Quit Trying Im Trying to Figure This Out And Im Runing A 103 Fever

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

do i use {0} if i want my hotkey to be 0 or just 0

also when i run the first one you posted it opens but when i change it to

HotKeySet("{0}" , "start")

Func start()

WinWait("U2K")

WinActivate("U2K")

If WinActive("U2K") Then Send("4")

Endfunc

it wont open

Edited by Krackin

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

As you said in your first post "without switching to it if possible" so I still believe ControlSend is the best way.

Here is a working example but since I don't have that "U2K" I can't fix it for you to work with your program.

HotKeySet("0" , "start") 

While 1
    Sleep(100);loop to keep program running
WEnd

Func start()
ControlSend("Untitled", "", "Edit1", "This is a line of text in the notepad window");send some text to notepad
;to get the parameters like title, text and controlID you can use "AutoIt Window Tool"
; look for Title and ClassnameNN for your program.
Endfunc
Edited by Pain

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

As you said in your first post "without switching to it if possible" so I still believe ControlSend is the best way.

Here is a working example but since I don't have that "U2K" I can't fix it for you to work with your program.

HotKeySet("0" , "start") 

While 1
    Sleep(100);loop to keep program running
WEnd

Func start()
ControlSend("Untitled", "", "Edit1", "This is a line of text in the notepad window");send some text to notepad
;to get the parameters like title, text and controlID you can use "AutoIt Window Tool"
; look for Title and ClassnameNN for your program.
Endfunc
U2K I Actually Diablo 2 Lod i just have it named u2k

what goes in edit1

;send some text to notepad

;to get the parameters like title, text and controlID you can use "AutoIt Window Tool"

; look for Title and ClassnameNN for your program.

thats confusing

Edited by Krackin

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

I assume you won't get any classname for Diabo 2 (like many other games) so try with "" but I'm not sure if it will work or not.

ControlSend("Diablo II", "", "", "text to send")

Most likely Diablo II also blocks send commands anyways.

Edited by Pain

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

I assume you won't get any classname for Diabo 2 (like many other games) so try with "" but I'm not sure if it will work or not.

ControlSend("Diablo II", "", "", "text to send")

Most likely Diablo II also blocks send commands anyways.

its not for the regular realm nothing is blocked at all i play a mod on a private server

and i dont want to send text i just want to press 4 just to use a xp elixer

Edited by Krackin

Share this post


Link to post
Share on other sites

then change "text to send" to "4" ;P

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