freyaharts Posted July 20, 2017 Share Posted July 20, 2017 (edited) getting coords is working fine but getting the color gives me error expandcollapse popupHotKeySet ("{esc}", "_Exit") #include <Misc.au3> $Coords = AskUser() call ("Start") Func AskUser() MsgBox(0, "User Input", "Please click mouse your screen" & @CRLF & "Press OK, and then move your mouse there and click") Do Sleep(50) Until _IsPressed(01) $Coords = MouseGetPos() Local $Color = PixelGetColor($coords[0], $coords[1]) MsgBox(0, "info", "Your coords and color have been stored for later use") Return $Coords EndFunc Func Start() While 1 if pixelgetcolor($coords[0],$coords[1]) = $Color then sleep (200) ;run whole script Else sleep (100) endif wend EndFunc Func _Exit() Exit EndFunc Edited July 29, 2017 by freyaharts Link to comment Share on other sites More sharing options...
Developers Jos Posted July 20, 2017 Developers Share Posted July 20, 2017 1 hour ago, freyaharts said: please help me With what exactly? Is anything not working? Jos 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 More sharing options...
freyaharts Posted July 20, 2017 Author Share Posted July 20, 2017 when i run it .. it doesnt seem set the value and my whole script loop didnt work Link to comment Share on other sites More sharing options...
Developers Jos Posted July 20, 2017 Developers Share Posted July 20, 2017 Which value? It really would help to be much more specific. You have an msgbox() in there ... what is shown? When I run it it works fine after fixing the syntax error in this line: if pixelgetcolor ($Coords[0, $Coords[1]) = 0x012549 then It is missing a ] after the 0. Jos 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 More sharing options...
freyaharts Posted July 20, 2017 Author Share Posted July 20, 2017 sorry my objective is unclear .. heres what im trying to do a message box will pop out and ask the user to click the mouse and set the pixelgetcolor and then run the loop expandcollapse popupHotKeySet ("{home}", "SetBlueCoords") HotKeySet ("{END}", "_Exit") While 1 Sleep(200) WEnd func SetBlueCoords() MsgBox(0, "User Input", "Please click the screen on blue pixel bar" & @CRLF & "Press OK, and then move your mouse there and click") Do Sleep(50) Until _IsPressed(01) $Blue= MouseGetPos() $blueHex = & Hex($blueHex, 6)) call ("start") EndFunc func start() while 1 if pixelgetcolor ($blue[0], $[blue[1]) <> $blueHex then ;run the whole script endif wend endfunc Func _Exit() Exit EndFunc Link to comment Share on other sites More sharing options...
Developers Jos Posted July 20, 2017 Developers Share Posted July 20, 2017 Understood... but it is still unclear what the issue is with the script. So what is your question or what isn't working? Also define what program/process you are trying to automate so we understand. Jos 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 More sharing options...
freyaharts Posted July 20, 2017 Author Share Posted July 20, 2017 its for data entry job ... the user will click the position of progress bar on how many percent they wish before doing another task for copying anoter file.. when i run it i got this error message $blueHex = & Hex($blueHex, 6)) $blueHex = & Hex($^ ERROR Error: varriable used without being declared. im kinda new to this automation.. i hope you help me Link to comment Share on other sites More sharing options...
Developers Jos Posted July 20, 2017 Developers Share Posted July 20, 2017 You get that error because you have nowhere define that variable $BlueHex. So simply add it with its appropriate value at the top of the script. Jos 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 More sharing options...
freyaharts Posted July 29, 2017 Author Share Posted July 29, 2017 thank you so much, im kinda new to this. can you make an example how to achieve that? Link to comment Share on other sites More sharing options...
Developers Jos Posted July 29, 2017 Developers Share Posted July 29, 2017 1 minute ago, freyaharts said: can you make an example how to achieve that? No ... read again what I type and try to understand and play with that. You creted the posted script su I can only assume you created it and as such should understand it. Jos 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 More sharing options...
freyaharts Posted July 29, 2017 Author Share Posted July 29, 2017 hi im kinda new to this i want to get color and coordinates stored the data and use it for whole loop script coordinates works pecfectly however color doesnt seem work any ideas? expandcollapse popupHotKeySet ("{esc}", "_Exit") #include <Misc.au3> $Coords = AskUser() call ("Start") Func AskUser() MsgBox(0, "User Input", "Please click mouse your screen" & @CRLF & "Press OK, and then move your mouse there and click") Do Sleep(50) Until _IsPressed(01) $Coords = MouseGetPos() Local $Color = PixelGetColor($coords[0], $coords[1]) MsgBox(0, "info", "Your coords and color have been stored for later use") Return $Coords EndFunc Func Start() While 1 if pixelgetcolor($coords[0],$coords[1]) = $Color then sleep (200) ;run whole script Else sleep (100) endif wend EndFunc Func _Exit() Exit EndFunc Link to comment Share on other sites More sharing options...
freyaharts Posted July 29, 2017 Author Share Posted July 29, 2017 6 minutes ago, Jos said: No ... read again what I type and try to understand and play with that. You creted the posted script su I can only assume you created it and as such should understand it. Jos its been actually a week still trying to figure it out on my own.... i tried to slam my head on desk but still didnt get the idea .. im so hopeless Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 29, 2017 Moderators Share Posted July 29, 2017 freyaharts, Stick to just the one thread please - merged. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Developers Jos Posted July 29, 2017 Developers Share Posted July 29, 2017 So again, where in your script have you defined the variable $BlueHex ? (Shouldn't be a real hard question..right?) Jos 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 More sharing options...
freyaharts Posted July 29, 2017 Author Share Posted July 29, 2017 1 hour ago, Jos said: So again, where in your script have you defined the variable $BlueHex ? (Shouldn't be a real hard question..right?) Jos i merge my topic and remove the $bluehex.. please take a look in the top Link to comment Share on other sites More sharing options...
freyaharts Posted July 29, 2017 Author Share Posted July 29, 2017 im getting variable didnt declared error when already declared the variable? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 29, 2017 Moderators Share Posted July 29, 2017 0 freyaharts, That variable is declared as Local to the AskUser function and so is invisible to the Start function. The Variables - using Global, Local, Static and ByRef tutorial in the Wiki might be a useful read to help you understand more about scoping variables. M23 junkew 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
freyaharts Posted July 29, 2017 Author Share Posted July 29, 2017 ok i tried to remove the local ,global, but still get variable used without being declared Local $Color = PixelGetColor($coords[0], $coords[1]) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 29, 2017 Moderators Share Posted July 29, 2017 freyaharts, Declare the variable as Global at the top of the script and then it can be seen by both functions - as long as you do not redeclare it as Local inside one of them. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
freyaharts Posted July 29, 2017 Author Share Posted July 29, 2017 i put global to the top before all the functions but now i get error.. it asks for $coords varrible? Global $Color = PixelGetColor($coords[0], $coords[1]) 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