Results 1 to 19 of 19

Thread: Group of commands

  1. #1

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Question Group of commands

    for a command button, i made it do 14 different commands... how can i make sure they all go in the order i put it all in? because it isn't working.. and i've tried 1 command at a time, and they all worked...



    can sum1 plz help me?

    thnx in advance,
    Phil.D.
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  2. #2

  3. #3

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: Group of commands

    i found out tht it is doing it in the right order, but it does it all at once, so there is a problem, even when i put "Sleep 1000" after every command it still doesn't do it properly... and as i said, every command works seperately.. what should i do?
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Group of commands

    If you only want it to execute one command at a time, you should create a BtnCount variable, and then separate each statement using this logic. You could do something like this:

    VB Code:
    1. sub Button1_Click()
    2.   select case BtnCount
    3.   case 1
    4.     ' Do Command 1
    5.   case 2
    6.     ' Do Command 2
    7.   '-
    8.   '-
    9.   case else
    10.     ' anything extra
    11.   end select
    12.   BtnCount = BtnCount +1
    13. end sub

  5. #5

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: Group of commands

    i don't know if tht will matter now, because it works in order now... it just doesn't work if i have more than 2 commands on it... y?
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  6. #6

  7. #7

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: Group of commands

    it won't do the commands!!! it does the first command and tht's it.. then the computer freezes until i press "Ctrl+Alt+Del"... once i press those buttons, it does the second command...
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Group of commands

    Quote Originally Posted by smart_phil_dude1
    it won't do the commands!!! it does the first command and tht's it.. then the computer freezes until i press "Ctrl+Alt+Del"... once i press those buttons, it does the second command...
    OK, then let me suggest again that you post your code.

  9. #9
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Group of commands

    Might be that the first command you executed is run then the second one is run too and they messed up each other, post your code so we could take a look at it...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  10. #10

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: Group of commands

    ok, sure... here it is :

    VB Code:
    1. Private Sub Command16_Click()
    2. If List1.ListIndex <> -1 Then
    3.  
    4.     P.X = -30
    5.     P.Y = -30
    6.     ret& = ClientToScreen&(Form1.hwnd, P)
    7.     P.X = P.X + Me.ScaleWidth / 2
    8.     P.Y = P.Y + Me.ScaleHeight / 2
    9.     ret& = SetCursorPos&(P.X, P.Y)
    10. Sleep 1000
    11.  
    12.     mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
    13. Sleep 1000
    14.  
    15.     P.X = -72
    16.     P.Y = -72
    17.     ret& = ClientToScreen&(Form1.hwnd, P)
    18.     P.X = P.X + Me.ScaleWidth / 2
    19.     P.Y = P.Y + Me.ScaleHeight / 2
    20.     ret& = SetCursorPos&(P.X, P.Y)
    21. Sleep 1000
    22.  
    23.     mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
    24. Sleep 1000
    25.  
    26. SendKeys (ReadINI("Autologin", "Name" & List1.ListIndex + 1, ini_path) & "{enter}" & Decrypt(" " & ReadINI("Autologin", "Pass" & List1.ListIndex + 1, ini_path)))
    27. Sleep 1000
    28.  
    29.     P.X = -30
    30.     P.Y = -40
    31.     ret& = ClientToScreen&(Form1.hwnd, P)
    32.     P.X = P.X + Me.ScaleWidth / 2
    33.     P.Y = P.Y + Me.ScaleHeight / 2
    34.     ret& = SetCursorPos&(P.X, P.Y)
    35. Sleep 1000
    36.  
    37.     mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, cButt, dwEI
    38. End If
    39. End Sub
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  11. #11
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Group of commands

    What you are doing is unfamiliar to me but here are some things I found with some research on the web.
    • You should check your ret values for 0 (fail).
    • mouse_event function has been superseded and you should use SendInput instead


    What are you trying to do with that SendKeys line?
    Which specific command doesn't work?

  12. #12

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: Group of commands

    ok, well... all commands work alone, but together, nothing happens...
    and the SendKeys is to loggin to a game.. tht's what it's for..
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  13. #13

  14. #14

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: Group of commands

    what do u mean it's not possible? not possible to make it go in order?
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  15. #15
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Group of commands

    No I mean that it's not possible that they work seperately but not together.

    Have you tried F8-ing through the code?
    Have you looked at the screen while doing that to see if anything has happened?

  16. #16
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Group of commands

    Just a thought, why dont you try splitting up your code into several subs then call those subs from a "main" sub?
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  17. #17

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: Group of commands

    well, i'm not tht good with vb and not sure how to work with subs...

    but it does work alone, and not together... and what does F8 do?
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

  18. #18
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Group of commands

    Quote Originally Posted by smart_phil_dude1
    ... and what does F8 do?
    Here's a short lesson on debugging.

    • Place your cursor on the first line of code in the Command16_Click sub and press F9. You can also just click in the margin to the left of the line. Either of those ways will put a breakpoint on the line as indicated by the red bullet in the left margin.
    • Run you program and click Command16 and the code will stop at that line.
    • Highlight List1.ListIndex and then click the Quick Watch button (the pair of eyeglasses) in the menu bar. That will reveal the value of the ListIndex.
    • Press F8. That will take you to the next line of code.

  19. #19

    Thread Starter
    Lively Member smart_phil_dude1's Avatar
    Join Date
    Jun 2005
    Location
    Behind You!
    Posts
    125

    Re: Group of commands

    ah, i c, thnx man,

    peace out,
    Phil.D.
    Please Help Us Save Ana or donate now by going to Oneana.com

    Visit my Website at http://www.therealfantasy.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width