Jump to content

Trying To Make A Script


Krackin
 Share

Recommended Posts

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

Edited by Krackin
Link to comment
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?

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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

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

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

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