Sign in to follow this  
Followers 0
alex OF DEATH

I need some help

16 posts in this topic

Okay, im in the early stages of an autologin for a game I play and I have one question.

If I am using a Combo list for the server selection, How do I set the data to the choice in the combo box?

example: (from actual script)

$Server = GUICtrlCreateCombo("", 56, 104, 129, 21)

GUICtrlSetData(-1, "Ares|Dies|Xigenon|Beramus|Cypher|Olympia|Edana|Manes", "Ares")

(So here, It's default on Ares, but I noticed that this may not be the actual data selection, just what appears in the box)

And later I have this:

if $server = Ares then call Ares()

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

Now, I have the function ares as a msgbox just to see if It's actually selecting the data. So I know it's just showing "ares" in the combo box instead of having it as the actual data.

I made that as clear as I can, so please help. (I know im a noob at this and it's probably a stupid mistake)


Share this post


Link to post
Share on other sites



While I have this topic, I am the most retarded person in the world.

Im also stuck on how to get a function to happen when a button is pressed.

I have the guictrlsetonevent thing, but I dont know how to get the controlID.

(I didn't edit my last post cuz there are like, 5 people looking at this section and not helping me :D)


Share this post


Link to post
Share on other sites

Okay, im in the early stages of an autologin for a game I play and I have one question.

If I am using a Combo list for the server selection, How do I set the data to the choice in the combo box?

example: (from actual script)

$Server = GUICtrlCreateCombo("", 56, 104, 129, 21)

GUICtrlSetData(-1, "Ares|Dies|Xigenon|Beramus|Cypher|Olympia|Edana|Manes", "Ares")

(So here, It's default on Ares, but I noticed that this may not be the actual data selection, just what appears in the box)

And later I have this:

if $server = Ares then call Ares()

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

Now, I have the function ares as a msgbox just to see if It's actually selecting the data. So I know it's just showing "ares" in the combo box instead of having it as the actual data.

I made that as clear as I can, so please help. (I know im a noob at this and it's probably a stupid mistake)

In your example $Server has been set to the Control ID of the combo control you created with GuiCtrlCreateCombo(). Use the Control ID to get the current selection with GuiCtrlRead():

$Selection = GuiCtrlRead($Server)oÝ÷ ØêÚºÚ"µÍYÝZPÝXY
    ÌÍÔÙHH  ][ÝÐÉ][ÝÈ[Ê

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

While I have this topic, I am the most retarded person in the world.

Im also stuck on how to get a function to happen when a button is pressed.

I have the guictrlsetonevent thing, but I dont know how to get the controlID.

(I didn't edit my last post cuz there are like, 5 people looking at this section and not helping me :wacko:)

Second verse, same as the first...

When you create the button with GuiCtrlCreateButton(), you save the control ID to a variable:

$Button_1 = GuiCtrlCreateButton("EXIT", -1, -1)oÝ÷ Ù;«íê)¶*'~î®oÝ÷ Ù'­¶ºw-í¢«~æ¢{ayÊ'¶º%ßÛ½éíÂ+aº¹oÝ÷ Ø*Þj×­çîËb¢|¨ºv¦yÖ¢÷ºÚ"µÍ[ÈÓ^Q^]

BÙÐÞ
    ][ÝÑ^]    ][ÝË  ][ÝÑ^]ÝYÙHY][ÝË
JB^][[

Now if you click on the EXIT button, the script will display the message and then exit.

:D

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Awesome, thank you for the first one.

But im having issues with the second one.

---

I choose the server from the drop down list, and nothing happens. Supposedly a message box should pop-up but it doesnt. Also, Im going to have the function execute when a button is pressed, not when it is chosen from the list. If it is possible to solve the first problem with what im going to do with it, tell me how I would go about doing the execution on the button press.

Here is my script:

#include <GUIConstants.au3>
; == GUI generated with Koda ==
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Login by alex OF DEATH", 390, 269, 318, 254)
$name = GUICtrlCreateInput("", 56, 24, 169, 21, -1, $WS_EX_CLIENTEDGE)
$password = GUICtrlCreateInput("", 56, 64, 169, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Password", 0, 64, 50, 17)
GUICtrlCreateLabel("Username", 0, 24, 52, 17)
$Server = GUICtrlCreateCombo("", 56, 104, 129, 21)
GUICtrlSetData (-1, "Ares|Dies|Xigenon|Beramus|Cypher|Olympia|Edana|Manes", "Server")
$servernum = GUICtrlCreateCombo("", 56, 136, 129, 21)
GUICtrlSetData (-1, "1|2|3", "0")
$KO = GUICtrlCreateInput("H:\KO\Launcher.exe", 80, 176, 177, 21, -1, $WS_EX_CLIENTEDGE)
$Fcko = GUICtrlCreateInput("H:\fcko\FuckKo.exe", 80, 208, 177, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Path for KO", 0, 176, 59, 17)
GUICtrlCreateLabel("Path for FCKO", 0, 208, 72, 17)
GUISetState(@SW_SHOW)
$StartGame = GUICtrlCreateButton("Start KO", 272, 216, 105, 49)
GUICtrlSetOnEvent ($StartGame, "RunKnight")
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
    ;;;;;;;
    EndSelect
WEnd
Exit
If GuiCtrlRead($Server) = "Ares" Then Ares()
   If GuiCtrlRead($Server) = "Dies" Then Dies()
      If GuiCtrlRead($Server) = "Xigenon" Then Xigenon()
         If GuiCtrlRead($Server) = "Beramus" Then Beramus()
            If GuiCtrlRead($Server) = "Cypher" Then Cypher()
               If GuiCtrlRead($Server) = "Olympia" Then Olympia()
                  If GuiCtrlRead($Server) = "Edana" Then Edana()
                     If GuiCtrlRead($Server) = "Manes" Then Manes()
                        
func Ares()
   MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc
MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)

func Dies()
   MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc


func Xigenon()
   MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc


func Beramus()
   MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc


func Cypher()
MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc


func Olympia()
MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc


func Edana()
MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc


func Manes()
MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc

;-------------------------------------------------------------------

Func RunKnight()
   Run("" & Guictrlread($Fcko) )
   Run("" & Guictrlread($KO) )
endfunc

PS- I cant exit my script without going to the task bar thing and manually closing it.

Edited by alex OF DEATH

Share this post


Link to post
Share on other sites

I'll start at the end of your last post first.

This is how I get around not being able to exit when I click the X to close.

GUISetOnEvent ($GUI_EVENT_CLOSE, "Exit")

Then just create a function like:

Func Exit()
  Exit
EndFunc

I don't know if that's the proper way to go about it, but it works for me. Then it doesn't rely on that While loop.

A suggestion while you're doing your testing to see if the right server function is being called....maybe just name the message box something like Ares, Cypher, etc. That way, when the message box comes up, you know you're calling the right function.

I haven't dealt with drop-down lists yet, so I'm not able to comment on that issue.

Share this post


Link to post
Share on other sites

Well, it worked. yay, now I can close it.

Now, all I need is to fix the functions im having problems with, set it to the "RunKO" button, make a save button (somehow) and actually make the server selection settings.


Share this post


Link to post
Share on other sites

For the Save button, I may be wrong, but I think you'll have to write your variables out to a file you'll "include" at startup. I don't think you'd want to try saving to your mac file. Just set up a function when you click Save that will open your file, write the lines of variables and their values, then close the file.

Something like this:

Func WriteVariableFile()
  $AutoLoginVariableFile = FileOpen("AutoLoginVariables.txt", 2)
  If $AutoLoginVariableFile = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
  EndIf

  FileWrite ($AutoLoginVariableFile, "#include-once" & @CRLF & @CRLF)
  FileWrite ($AutoLoginVariableFile, '$Server = "' & GuiCtrlRead($Server) & '"' & @CRLF)
    .
    .
    .
  FileClose ($AutoLoginVariableFile)
EndFunc

Just make sure to make note of how to use the " in the FileWrite. You need to use the single quote ' like I have along with the double quote ".

Again, there are probably better ways to do this, but I'm still pretty new at the whole AutoIt thing.

Share this post


Link to post
Share on other sites

For now, I have 2 problems.

Func Login()

sleep ( "1000" )

MouseClick ( "left" , 514, 530 )

sleep ( "2000" )

send ( $name )

send ( "{tab}" )

send ( $password )

Sleep ( 10000 )

send ( "{Enter}" )

endfunc

Only says 3 tab 4 enter.

It wont say $name or $password.

I THINK it is because it is not reading the file after you edit the input box. If it is, someone tell me how :\


Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Update:

I started messing around with what I was doing, and I have a new arrangement for the script.

I was testing this so only Ares has the actual beta function.

Here is the script:

#include <GUIConstants.au3>
; == GUI generated with Koda ==
Opt("GUIOnEventMode", 1)
$Form1 = GUICreate("Login by alex OF DEATH", 390, 269, 318, 254)
$name = GUICtrlCreateInput( "", 56, 24, 169, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlSetData ($name, $name)
$password = GUICtrlCreateInput("", 56, 64, 169, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Password", 0, 64, 50, 17)
GUICtrlCreateLabel("Username", 0, 24, 52, 17)
$Server = GUICtrlCreateCombo("", 56, 104, 129, 21)
GUICtrlSetData (-1, "Ares|Dies|Xigenon|Beramus|Cypher|Olympia|Edana|Manes")
Guictrlread ($server)
$servernum = GUICtrlCreateCombo("", 56, 136, 129, 21)
GUICtrlSetData (-1, "1|2|3")
$KO = GUICtrlCreateInput("H:\KO\Launcher.exe", 80, 176, 177, 21, -1, $WS_EX_CLIENTEDGE)
$Fcko = GUICtrlCreateInput("H:\fcko\FuckKo.exe", 80, 208, 177, 21, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateLabel("Path for KO", 0, 176, 59, 17)
GUICtrlCreateLabel("Path for FCKO", 0, 208, 72, 17)
GUISetState(@SW_SHOW)
$StartGame = GUICtrlCreateButton("Start KO", 272, 216, 105, 49)
GUICtrlSetOnEvent ($StartGame, "RunKnight")
GUICtrlSetOnEvent ($StartGame, "Login")
GUICtrlSetOnEvent ($StartGame, "ServerSelect")
GUISetOnEvent ($GUI_EVENT_CLOSE, "Exit1")
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        ;;;;;;;
    EndSelect
WEnd
Exit

Func ServerSelect()
   
If GuiCtrlRead ($Server) = "Ares" Then Ares()
   If GuiCtrlRead ($Server) = "Dies" Then Dies()
      If GuiCtrlRead ($Server) = "Xigenon" Then Xigenon()
         If GuiCtrlRead ($Server) = "Beramus" Then Beramus()
            If GuiCtrlRead ($Server) = "Cypher" Then Cypher()
               If GuiCtrlRead ($Server) = "Olympia" Then Olympia()
                  If GuiCtrlRead ($Server) = "Edana" Then Edana()
                     If GuiCtrlRead ($Server) = "Manes" Then Manes()
                        endfunc
                        
func Ares()
   sleep ( "3000" )
   MouseClick ( "left" , 514, 530 )
   sleep ( "5000" )
   send ( "{Enter}" )
   sleep ( "500" )
   Guictrlread ($name)
   send ($name)
   sleep ( "500" )
   send ( "{tab}" )
    sleep ( "500" )
   GuiCtrlRead ($password)
    sleep ( "500" )
   send ( "{Enter}" )

endfunc

func Dies()
   MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc

func Xigenon()
   MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc

func Beramus()
   MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc

func Cypher()
MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc

func Olympia()
MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc

func Edana()
MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc

func Manes()
MsgBox(4096, "Test", "This box will time out in 10 seconds", 10)
endfunc

;-------------------------------------------------------------------

Func RunKnight()
   Run("" & Guictrlread($Fcko) )
      Run("" & Guictrlread($KO) )
endfunc

Func Login()
   MouseClick ( "left" , 514, 530 )
   send ( "{Enter}" )
   Guictrlread ($name)
   send ( "{tab}" )
   GuiCtrlRead ($password)
   send ( "{Enter}" )
endfunc

Func Exit1()
  Exit
EndFunc

BUT; At the beginning $name is default at the value of 3. I cannot change this. I want it to update with whatever is in the Name input box. This is what I currently need help with, So Ignore (or not) my last post.

Edited by alex OF DEATH

Share this post


Link to post
Share on other sites

BUT; At the beginning $name is default at the value of 3. I cannot change this. I want it to update with whatever is in the Name input box. This is what I currently need help with, So Ignore (or not) my last post.

So remove the GUICtrlSetData ($name, $name)... $name = the ControlID, GUICtrlRead($name) = the data inside the input.

Also you may want to make sure that $name isn't blank before sending:

$ReadName = GUICtrlRead($name)
If StringStripWS($ReadName, 8) = '' Then
    MsgBox(64, 'Info:', 'Please input a name.')
Else
    Send($ReadName)
EndIf

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

edited out post

Solution:

send ( Guictrlread ($password) )

I was trying to do them one at a time and seperately. Man I need to start sleeping at night :D

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

AHHA!

Im almost DONE!

Okay, everything works, but I can't test it officially without a bypass for using a macro (styler knows)

NOW, a SAVE button. I REALLY don't want to use an .INI file or any seperate file for this, how would I go about doing this?

Edited by alex OF DEATH

Share this post


Link to post
Share on other sites

I was looking into something like this before, too. But I can't remember the exact search phrase I used. Try searching for content that has to do with replacing specific lines in a file. I know there was talk about this being a possibility in a future release, and that future release may have been the current beta version of AutoIt. Sorry I can't be of much more help right now, but I'm just about out the door for awhile.

Share this post


Link to post
Share on other sites

Use RegWrite.


Don't take my pic to serious...~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~You Looked, but you did not see!~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

If I use RegWrite, it will have to read from the file, correct?

Wouldn't that mean I have to re-write my script to read from RegWrite?

edit: Hmm, I just had quite an idea. I shall try this and tell you how it works out.

Edited by alex OF DEATH

Share this post


Link to post
Share on other sites

...Well, I'm pretty sure im done, but before I can do serious testing I need that bypass :D

Just add some pixel checks I guess ill be totally done.

Thank you everyone, ill be sure to add your names in the source :wacko:


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