cueclub Posted March 20, 2010 Share Posted March 20, 2010 I am actually not writing anything for use. Just playing with some ideas at this point. Looks like i found a new hobby. Ok here is my thought. Without using the Au3info tool. Is it possible to get mouse positions x and y, just by clicking on the scree and then clicking a button? here is an idea i am working on. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) TEST() Func TEST() Local $Button_1, $msg, $Test1, $Test2, $Test3, $Test4, $Test5, $Test6, $Test7, $Test8, $Test9, $Test10 GUICreate("TEST", 160, 570, 5, 200) ; will create a dialog box that when displayed is centered GUICtrlCreateLabel("Test SETUP", 30, 5, 150) GUICtrlCreateLabel("(Test 1)", 10, 30, 150) $Test1 = GUICtrlCreateInput("", 10, 50, 100, 20) GUICtrlCreateLabel("(Test 2)", 10, 80, 100) $Test2 = GUICtrlCreateInput("", 10, 100, 100, 20) ; GUICtrlCreateLabel("(Test 3)", 10, 130, 100) $Test3 = GUICtrlCreateInput("", 10, 150, 100, 20) GUICtrlCreateLabel("(Test 4)", 10, 180, 100) $Test4 = GUICtrlCreateInput("", 10, 200, 100, 20) GUICtrlCreateLabel("(Test 5)", 10, 230, 100) $Test5 = GUICtrlCreateInput("", 10, 250, 100, 20) $Button_1 = GUICtrlCreateButton("save", 25, 530, 100) GUISetState() ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 IniWrite("C:\Users\Main\Desktop\test.ini", "Test Positions", "Test#1 ", GUICtrlRead($Test1)) IniWrite("C:\Users\Main\Desktop\test.ini", "Test Positions", "Test#2 ", GUICtrlRead($Test2)) IniWrite("C:\Users\Main\Desktop\test.ini", "Test Positions", "Test#3 ", GUICtrlRead($Test3)) IniWrite("C:\Users\Main\Desktop\test.ini", "Test Positions", "Test#4 ", GUICtrlRead($Test4)) IniWrite("C:\Users\Main\Desktop\test.ini", "Test Positions", "Test#5 ", GUICtrlRead($Test5)) exit EndSelect WEnd EndFunc ;==>Example As you can see from above, it asks for the person to enter 5 points on their screen. Using the info tool. I'm trying to have it do something like this: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) TEST() Func TEST() Local $Button_1, $msg, $Test1, $Test2, $Test3, $Test4, $Test5, $Test6, $Test7, $Test8, $Test9, $Test10, $mpos GUICreate("TEST", 160, 570, 5, 200) ; will create a dialog box that when displayed is centered GUICtrlCreateLabel("Test SETUP", 30, 5, 150) GUICtrlCreateLabel("(Test 1)", 10, 30, 150) $mpos = $Mousegetpos() $Test1 = GUICtrlCreateInput($mpos, 10, 50, 100, 20) GUICtrlCreateLabel("(Test 2)", 10, 80, 100) $Button_1 = GUICtrlCreateButton("save", 25, 530, 100) GUISetState() ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 IniWrite("C:\Users\Main\Desktop\test.ini", "Test Positions", "Test#1 ", GUICtrlRead($Test1)) exit EndSelect WEnd EndFunc ;==>Example ok the 1st code works great. but would be too many things for a user to do. Would be nicer if i could get #2 to work . Any and all ideas will be tried and welcomed. Thx Cue Link to comment Share on other sites More sharing options...
somdcomputerguy Posted March 20, 2010 Share Posted March 20, 2010 Without using the Au3info tool. Is it possible to get mouse positions x and y, just by clicking on the scree and then clicking a button?I just made a post in another thread that might help you. See here, #3. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
cueclub Posted March 20, 2010 Author Share Posted March 20, 2010 big help as usual snowmaker. I will mess around with your example and post my findings as i usually do . Link to comment Share on other sites More sharing options...
somdcomputerguy Posted March 20, 2010 Share Posted March 20, 2010 Well I hope it works for you. Also, check out a later post in that thread I linked to before, there is another, and probably better, thing there. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
cueclub Posted March 20, 2010 Author Share Posted March 20, 2010 k will do, I have been trying it with the mouse trap example, but cant seem to get it to work. I'm sure i will figure it our eventually. Thanks again Link to comment Share on other sites More sharing options...
cueclub Posted March 21, 2010 Author Share Posted March 21, 2010 Well I hope it works for you. Also, check out a later post in that thread I linked to before, there is another, and probably better, thing there.Couldnt find the link you were referring to . Link to comment Share on other sites More sharing options...
cueclub Posted March 21, 2010 Author Share Posted March 21, 2010 (edited) expandcollapse popup#Include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) TEST() Func TEST() Local $Button_1, $msg, $Test1, $Test2, $Test3, $Test4, $Test5, $Test6, $Test7, $Test8, $Test9, $Test10 GUICreate("TEST", 160, 570, 5, 200) ; will create a dialog box that when displayed is centered GUICtrlCreateLabel("Test SETUP", 30, 5, 150) $Button_1 = GUICtrlCreateButton("save 2 ini", 25, 530, 100) GUISetState() ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 getpos() exit EndSelect WEnd EndFunc ;==>Example Func GetPos() local $pos While 1 ToolTip("Click Somewhere Else now") Sleep(100) If _IsPressed("01") Then ExitLoop WEnd ToolTip("") $pos = MouseGetPos() iniwrite(C:\Users\Main\Desktop\test.ini", "Test Positions", "Test#1 ", GUICtrlRead($pos)) EndFuncany idea what I am missing here? edit: keeps returning a value of 0 doesn't seem to want to write to the ini. And when the button is pressed it closes. Also is there an easier way to do this:Local $Button_1, $msg, $Test1, $Test2, $Test3, $Test4, $Test5, $Test6, $Test7, $Test8, $Test9, $Test10perhaps something like local $button1, $msg, $test1-$test10 ?? or is it not that simple. Edited March 21, 2010 by cueclub Link to comment Share on other sites More sharing options...
Kasmar Posted March 21, 2010 Share Posted March 21, 2010 I saw you checking out the thread I had so I looked at yours to see if I could help you. Used the info in my thread for yours =]. This will write the file to the C: drive with the coords for you but it isnt set up to loop so after you click it will close. expandcollapse popup#Include <Misc.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) TEST() Func TEST() Local $Button_1, $msg, $Test1, $Test2, $Test3, $Test4, $Test5, $Test6, $Test7, $Test8, $Test9, $Test10 GUICreate("TEST", 160, 570, 5, 200) ; will create a dialog box that when displayed is centered GUICtrlCreateLabel("Test SETUP", 30, 5, 150) $Button_1 = GUICtrlCreateButton("save 2 ini", 25, 530, 100) GUISetState() ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 getpos() exit EndSelect WEnd EndFunc Func GetPos() local $pos, $x = 1 While $x = 1 ; Loop until the mouse is clicked. if _IsPressed("01") then ; If left mouse is pushed. $pos = MouseGetPos() ; Record the position. $x = 0 ; Change x to end loop. EndIf WEnd iniwrite("C:\test.ini", "Test Positions", "Test#1 ", $pos[0] & " " & $pos[1]) EndFunc Link to comment Share on other sites More sharing options...
cueclub Posted March 21, 2010 Author Share Posted March 21, 2010 yup that did the trick, I couldn't figure out why it wasnt working. I was thinking about it a different way. Now i will try to use it in various ways. Thanks for the help. 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