Jump to content

help with this LONG expression


layer
 Share

Recommended Posts

hey guys... i have this expression and i was wanting to know if it is right the way it is, or if it has to be modified :">

If _IsPressed ('01') and $pos= "55, 210" then
FileWrite (@DesktopDir & "\clicks.txt\", "LeftMouseClicked!")
EndIf

the expression should be like this is english: if mouse1 is pressed at the corrdinates 55(x), 200(y) then amke a file named clicks.txt on the desktop and write LeftMouseClicked!

this must be possible, could someone help me? because im not sure if it's working... :idiot:

thanks! :D

FootbaG
Link to comment
Share on other sites

You need to declare $pos

One line $pos Dim and a one line 'If' statement

$pos = MouseGetPos()
If _IsPressed ('01') = 1 And $pos[0] = 55 And $pos[1] = 210 Then FileWrite (@DesktopDir & '\clicks.txt', 'LeftMouseClicked!')

I would also like to ask you don't make this a keylogger, to me it looks like the framework to me.

Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

Link to comment
Share on other sites

nahh... ive already made a keylogger, but i dont use it for bad purposes... it's because when ezzetabi made the _IsPressed Func someone said "thanks, i fianally made a keylogger!" i said "how the heck could you make a keylogger?" and he just said well u just gotta do this for every letter lalalala and so on... but i have never used it.. but actually it's for a game and im going to have to store it in an ini file for reawding later on :idiot:

FootbaG
Link to comment
Share on other sites

still don't work (i think) :idiot: just so you guys can see... this is what im trying to do... i tried putting a message box so if u click 55, 210 it would show up!

#include <GUIConstants.au3>
GUICreate ("Shoot it!", 300, 300)
GUISetState ()
GUISetCursor (3, 1)
$target= GUICtrlCreatePic (@DesktopDir & "\target.bmp", 50, 200, 60, 50) 
$hitme= GUICtrlCreateLabel ("Hit the target!", 150, 100)





Func _IsPressed($hexKey)
; $hexKey must be the value of one of the keys.
; _IsPressed will return 0 if the key is not pressed, 1 if it is.
; $hexKey should entered as a string, don't forget the quotes!
; (yeah, layer. This is for you)
  
  Local $aR, $bO
  
  $hexKey = '0x' & $hexKey
  $aR = DllCall("user32", "int", "GetAsyncKeyState", "int", $hexKey)
  If Not @error And BitAND($aR[0], 0x8000) = 0x8000 Then
     $bO = 1
  Else
     $bO = 0
  EndIf
  
  Return $bO
EndFunc;==>_IsPressed


  $loc = 60
Do
GUICtrlSetColor ($hitme, 0xff0000)
  $get = GUIGetMsg()
  $pos = MouseGetPos()
  If _IsPressed ('01') = 1 Then
     SoundPlay(@DesktopDir & "\sg552-1.wav")
     GUICtrlSetColor ($hitme, 0x00ff00)
     $pos = MouseGetPos()
     Sleep("275")
  EndIf
  If _IsPressed ('01') and $pos= "55, 210" then
FileWrite (@DesktopDir & "\clicks.ini\", "LeftMouseClicked!")
MsgBox (0, "u clicked it!", "u clicked teh left mouse at 55, 210...")
sleep ("250")
EndIf  
Until $get = -3

just download those files (the sound and picture) if you'd like, you don't have to... and make sure u put it on ur desktop dir because if u don't the GUI won't be able to get it... also there may be some old syntax.. im at my cusins house and they have the older version... so if i click at 55, 210 NO messagebox comes up!!! someone please help? i will explain further if asked :D:lol:

EDIT: that gun sound is from valve or from counter-strike or some creator of something, heres the link.. im pretty sure it was this... http://cs.gamegate2k.com/counterstrike/cssounds

Edited by layer
FootbaG
Link to comment
Share on other sites

  • Developers

please :idiot:

<{POST_SNAPBACK}>

did you try turnning the 2 If's around like:

If _IsPressed('01') And $pos = "55, 210" Then
      FileWrite(@DesktopDir & "\clicks.ini\", "LeftMouseClicked!")
      MsgBox(0, "u clicked it!", "u clicked teh left mouse at 55, 210...")
      Sleep("250")
   ElseIf _IsPressed('01') = 1 Then
      SoundPlay(@DesktopDir & "\sg552-1.wav")
      GUICtrlSetColor($hitme, 0x00ff00)
      $pos = MouseGetPos()
      Sleep("275")
   EndIf
Edited by JdeB

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

that doesn't even play the sound anymore :lol: but when you do

If _IsPressed('01') And $pos = "55, 210" Then

is that for the whole desktop size or for the gui window? do you understand? how would i find out where the control is for the whole desktop size? i saw a post about this just a few weeks ago, but i can't seem to find it :/ ive also tried seaerching but i dont think they have exactly what i want... i need to have a loop where it plays the noise when mouse1 is pressed and then if mouse1 is pressed in the middle of the target, msgbox (lalla) and play the sound... it seems it can't be done :idiot: im sure it can but i have to find out where the control is on the WHOLE desktop... any suggestions? :D

(this is what i get for trying to make a game...)

FootbaG
Link to comment
Share on other sites

  • Developers

that doesn't even play the sound anymore :lol: but when you do

If _IsPressed('01') And $pos = "55, 210" Then

is that for the whole desktop size or for the gui window? do you understand? how would i find  out where the control is for the whole desktop size? i saw a post about this just a few weeks ago, but i can't seem to find it :/ ive also tried seaerching but i dont think they have exactly what i want... i need to have a loop where it plays the noise when mouse1 is pressed and then if mouse1 is pressed in the middle of the target, msgbox (lalla) and play the sound... it seems it can't be done :idiot: im sure it can but i have to find out where the control is on the WHOLE desktop... any suggestions? :D

(this is what i get for trying to make a game...)

<{POST_SNAPBACK}>

Didn't really check out everything you are doing ... Just had another look.

You retirve the Mouse pos here:

$pos = MouseGetPos()

And test it here...

If _IsPressed('01') And $pos = "55, 210" Then

BUT MoluseGetPos() Returns:

Return Value

Returns a two-element array that containing the mouse coordinates:

$array[0] = X coord (horizontal)

$array[1] = Y coord (vertical)

Edited by JdeB

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

Well, if your using mine i would recomend doing an > and < box.

To find the place of a control you do WinGetPos() + ControlGetPos(), But i'm not sure if the titlebar of the window wont mess this up.

And to my understanding soundplay() isn't working right now..

Edited by Wolvereness

Offering any help to anyone (to my capabilities of course)Want to say thanks? Click here! [quote name='Albert Einstein']Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.[/quote][quote name='Wolvereness' date='7:35PM Central, Jan 11, 2005']I'm NEVER wrong, I call it something else[/quote]

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