Sign in to follow this  
Followers 0
Rabbitman

So close but...

11 posts in this topic

#1 ·  Posted (edited)

I am soooo close to finishing, but then one thing is wrong.

EDIT: FIRST PROBLEM SOLVED! SECOND PROBLEM: NOT SOLVED! DETAILS:

So here is my code (edited:

HotKeySet("{Esc}", "ExitProg") 
HotKeySet("{F3}", "StartStop")
HotKeySet("{PAUSE}", "Click")


Dim $On, $click
$click = False 
$On = False
 
While 1
    If $click = True Then
        MouseClick("left")
    EndIf
    If $On = True Then
        Send("{Z down}")
        Sleep(10)
        Send("{Z up}")
        Sleep(10)
    EndIf
WEnd

Func StartStop()
   If $On = False Then
      $On = True
   Else
      $On = False
   EndIf
EndFunc

Func Click()
   If $click = False Then
      $click = True
   Else
      $click = False
   EndIf
EndFunc

Func ExitProg()  
    Exit 0;;Exits the program
EndFunc

Now i want to add in a message box:

While 1
    $msg = GUIGetMsg()
    If $msg = $Button2 Then
        MsgBox(0, 0, 'Read The Help File.')
        EndIf
    WEnd

Question is, where do i put messagebox?

Rabbitman~~~~~~

Edited by Rabbitman

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I can't test it for you but try this:

HotKeySet("{Esc}", "ExitProg") 
HotKeySet("{F3}", "StartStop")
HotKeySet("{PAUSE}", "Click")


Dim $On, $click
$click = False 
$On = False
 
While 1
    If $click = True Then
        MouseClick("left")
    EndIf
    If $On = True Then
        Send("{Z down}")
        Sleep(10)
        Send("{Z up}")
        Sleep(10)
    EndIf
WEnd

Func StartStop()
   If $On = False Then
      $On = True
   Else
      $On = False
   EndIf
EndFunc

Func Click()
   If $click = False Then
      $click = True
   Else
      $click = False
   EndIf
EndFunc

Func ExitProg()  
    Exit 0;;Exits the program
EndFunc
Edited by LurchMan

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites

I am soooo close to finishing, but then one thing is wrong. Look:

HotKeySet("{Esc}", "ExitProg") 
HotKeySet("{F3}", "StartStop")
HotKeySet("{PAUSE}", "Click")
Func ExitProg()  
    Exit 0;;Exits the program
EndFunc

Dim $On, $click
$click = False 
$On = False


Func Click()
   If $click = False Then
      $click = True
   Else
      $click = False
   EndIf
EndFunc
 
     While True
   If $click = True Then
      MouseClick("left")
   EndIf
   WEnd

Func StartStop()
   If $On = False Then
      $On = True
   Else
      $On = False
   EndIf
EndFunc

   While True
   If $On = True Then
Send("{Z down}")
Sleep(10)
Send("{Z up}")
Sleep(10)
EndIf
WEnd

SO in that code, i have 3 hotkeys, Esc., F3 and Pause. F3 presses Z, Pause clicks, and Esc. exits. Now exit part works, but sadly only one hotkey seems to be working. I have tried moving things around and such but i cant seem to get it right. I would greatly appreciate help as this needs to be completed soon.

Rabbitman~~~~~~

Would the exit part be completing straight away?

Try this:

HotKeySet("{Esc}", "ExitProg") 
HotKeySet("{F3}", "StartStop")
HotKeySet("{PAUSE}", "Click")
Func ExitProg()  
    Exit 0;;Exits the program
EndFunc

Dim $On, $click
$click = False 
$On = False
While 1  ;No difference, I just use a 1 instead of true.
If $click = True Then
    MouseClick("left")
EndIf

If $On = True Then
   Send("{Z down}")
   Sleep(10)
   Send("{Z up}")
   Sleep(10)
EndIf

WEnd ;If you want these scripts to run at the same time, which I believe is what you want, you must include them in the same when statement.
     ;However this means it will not be constantly clicking, your best bet would be to run another script handling the clicking.


Func Click()
   If $click = False Then
      $click = True
   Else
      $click = False
   EndIf
EndFunc
 

Func StartStop()
   If $On = False Then
      $On = True
   Else
      $On = False
   EndIf
EndFunc

I hope that all works for you.

shanet


[font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS:
%programfiles%/AutoIt3/autoit3.chm

Share this post


Link to post
Share on other sites

Lurchman you are a god! Thank you it works perfecttt!

Share this post


Link to post
Share on other sites

Thanks for your quick help! I got it to work :x

Share this post


Link to post
Share on other sites

Ok new problem i cant add in a button where would i put it? Here is code for my button

While 1
    $msg = GUIGetMsg()
    If $msg = $Button2 Then
        MsgBox(0, 0, 'Read The Help File.')
        EndIf
    WEnd

I put it at the top it works but hotkeys dont. I put it at the bottom hotkeys work but buttons dont...

Share this post


Link to post
Share on other sites

Haha very funny but I don't think it will give exact directions on where to put it...

Share this post


Link to post
Share on other sites

Edited

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