gatsbysamericandream Posted April 7, 2006 Share Posted April 7, 2006 Hi everyone, I'm new to the forums. I tried to avoid the noob thing and I atleast read the FAQ and searched for an answer to this first but couldn't find anything in the few pages I looked. Anyway, I have a few questions. How would I go about Calling a function through the mouseclick("left") command? How do you send text to an un-active (but opened) notepad file through autoit? Is it possible to compile an eternal notepad file through autoit? I hope you guys can help me out. I look forward to posting in this forum a lot. Thanks Team. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 7, 2006 Moderators Share Posted April 7, 2006 Hi everyone, I'm new to the forums. I tried to avoid the noob thing and I atleast read the FAQ and searched for an answer to this first but couldn't find anything in the few pages I looked. Anyway, I have a few questions. How would I go about Calling a function through the mouseclick("left") command?How do you send text to an un-active (but opened) notepad file through autoit?Is it possible to compile an eternal notepad file through autoit?I hope you guys can help me out. I look forward to posting in this forum a lot. Thanks Team.Question 1 needs Beta, it can be found in the Developers forum... Top up where the sticky's are: The function is _IsPressed() once downloaded you can view in the help file.Question 2 you'll look at ControlSend() in the help fileQuestion 3 you'll look at FileInstall() in the help fileWelcome to the forums. 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. Link to comment Share on other sites More sharing options...
pixartist Posted April 7, 2006 Share Posted April 7, 2006 Hi everyone, I'm new to the forums. I tried to avoid the noob thing and I atleast read the FAQ and searched for an answer to this first but couldn't find anything in the few pages I looked. Anyway, I have a few questions. How would I go about Calling a function through the mouseclick("left") command? How do you send text to an un-active (but opened) notepad file through autoit? Is it possible to compile an eternal notepad file through autoit? I hope you guys can help me out. I look forward to posting in this forum a lot. Thanks Team. Func _IsPressed($hexKey) 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 while 1 if _isPressed(01) then ;do something endif wend Link to comment Share on other sites More sharing options...
gatsbysamericandream Posted April 7, 2006 Author Share Posted April 7, 2006 Thanks a lot man. Fast response, very nice. I'll download the beta right now. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 7, 2006 Moderators Share Posted April 7, 2006 Func _IsPressed($hexKey) 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;==>_IsPressedJust FYI pixartist, you can shorten that down to:Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc ;==>_Is_Key_PressedNot that it's necessary, but maybe that'll come in handy down the road for God knows whatever reason . 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. Link to comment Share on other sites More sharing options...
Bert Posted April 7, 2006 Share Posted April 7, 2006 (edited) To answer your questions:How would I go about Calling a function through the mouseclick("left") command?#include<misc.au3>If _IsPressed ("01") then _yourfunc() How do you send text to an un-active (but opened) notepad file through autoit?if $window1 = winexist("name of notepad window") thencontrolsend($window1, "", "edit1", "any text you like", 1) Is it possible to compile an eternal notepad file through autoit?You can, if you make a au3 file associated with notepad. then save the file as a au3. You would be much better off using Scite as your code editor. Once you use Scite, and all the tools that come with it, you will think: Notepad??? for coding???? why would I want to do that????? Edited April 7, 2006 by vollyman The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Bert Posted April 7, 2006 Share Posted April 7, 2006 damn! 3 of us just jumped on this! The Vollatran project  My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
gatsbysamericandream Posted April 7, 2006 Author Share Posted April 7, 2006 think: Notepad??? for coding???? why would I want to do that????? OH I USE SCITE!Anyway, thanks for all the help guys. I think I got a handle on things now. Link to comment Share on other sites More sharing options...
Valuater Posted April 7, 2006 Share Posted April 7, 2006 (edited) OH I USE SCITE!Anyway, thanks for all the help guys. I think I got a handle on things now.Is it possible to compile an eternal notepad file through autoit?you can use FileInstall() to install the notepad.exe within your script/programmaybe take a look at this ( very good examples )http://www.autoitscript.com/forum/index.php?showtopic=21048#8) Edited April 7, 2006 by Valuater Link to comment Share on other sites More sharing options...
gatsbysamericandream Posted April 8, 2006 Author Share Posted April 8, 2006 Ok so I used _Ispressed to perform something IF it is clicked. How would I make it double click? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 8, 2006 Moderators Share Posted April 8, 2006 MouseClick ( "button" [, x, y [, clicks [, speed ]]] )So:MouseClick('left', $x, $y, 2)The 2 representing 2 clicks. 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. Link to comment Share on other sites More sharing options...
gatsbysamericandream Posted April 8, 2006 Author Share Posted April 8, 2006 Silly Goose. I meant is there a way to make the _Ispressed function detect double clicks by adding a delay or something. I tried to figure it out but couldnt. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted April 8, 2006 Moderators Share Posted April 8, 2006 (edited) Silly Goose. I meant is there a way to make the _Ispressed function detect double clicks by adding a delay or something. I tried to figure it out but couldnt.Well you did say "make" it double click, not "show" it double clicked.. I made this a while back.. Global $PRIMARY, $SECONDARY _MouseButton($PRIMARY, $SECONDARY) While 1 If DoubleClickCheck() Then MsgBox(0, 'Double', 'You double clicked') Wend Func DoubleClickCheck($t_Time_One = 2, $v_dll = 'user32.dll'); $t_Time_One is an optional paramater, you can set the delay longer if you like Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $PRIMARY) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Do $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $PRIMARY) Until BitAND($a_R[0], 0x8000) <> 0x8000 Local $Timer = TimerInit() While 1 $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $PRIMARY) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 If TimerDiff($Timer) / 1000 >= "." & $t_Time_One Then Return 0 WEnd EndIf Return 0 EndFunc Func _MouseButton(ByRef $PRIMARY, ByRef $SECONDARY) Local $k = '' $k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons") If $k = 1 Then $PRIMARY = "02" $SECONDARY = "01" Else $PRIMARY = "01" $SECONDARY = "02" EndIf EndFuncIf you want a longer delay, you can set that in the () parameter of _DoubleClickCheck()... so _DoubleClickCheck(3) would give it a 300th of a second delay rather than a 200th and so on. Edit: Made it one Function..., Other than determining what is the Primary or Secondary button, but you can just replace primary with whatever (left or right) if it just your computer your using it on. Also... If you don't want to determine the button and you always want it to be the left:While 1 If DoubleClickCheck() Then MsgBox(0, 'Double', 'You double clicked') Wend Func DoubleClickCheck($t_Time_One = 2, $v_dll = 'user32.dll'); $t_Time_One is an optional paramater, you can set the delay longer if you like If Not IsDeclared('PRIMARY') Then $PRIMARY = '01' Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $PRIMARY) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Do $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $PRIMARY) Until BitAND($a_R[0], 0x8000) <> 0x8000 $Timer = TimerInit() While 1 $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $PRIMARY) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 If TimerDiff($Timer) / 1000 >= "." & $t_Time_One Then Return 0 WEnd EndIf Return 0 EndFuncThis will take care of either way... if you delcare it ahead of time like the first example, but will be the 'left' button if not. Edited April 8, 2006 by SmOke_N 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now