element72 Posted March 1, 2014 Share Posted March 1, 2014 (edited) I'm hoping to make my own pixelgetcolor script. If someone has experience on this or knows some issues I might run into please let me know. I am trying to make tooltip script for the mouse that will (if possible) get the color of the pixel relative to the mouse location with 100% accuracy. In the past I had an issue with some of these scripts, but I'm not sure if it was the code that was used, or if it was possibly a limitation of the computer and autoit script. The issue I'm referring to -- the tooltip script would sometimes report the wrong hex color. For better accuracy, is it better to use hex color or decimal color? Why does a tooltip title require IE5? That is internet explorer 5, correct? Does that mean I just need that installed on my computer? In the guide for pixelgetcolor it shows: PixelGetColor ( x , y [, hwnd] ) what does hwnd do in more detail or can you give me an example? Edited March 1, 2014 by element72 Link to comment Share on other sites More sharing options...
FireFox Posted March 1, 2014 Share Posted March 1, 2014 Hi, Welcome to the autoit forum Local $iColor = 0, $aMgp = 0 While 1 $aMgp = MouseGetPos() $iColor = PixelGetColor($aMgp[0], $aMgp[1]) ToolTip("Color: 0x" & Hex($iColor, 6), $aMgp[0] + 10, $aMgp[1] + 10) Sleep(10) WEnd For better accuracy, is it better to use hex color or decimal color? It's the same thing, the only difference is that it's not written on the same base (Decimal = base 10, Hex = base 16). That is internet explorer 5, correct? Does that mean I just need that installed on my computer? Correct. I would be surprised you haven't IE 5 installed on your computer or it's older than XP. what does hwnd do in more detail or can you give me an example? It means it will take the top-left corner of the window as starting coords. Br, FireFox. element72 1 Link to comment Share on other sites More sharing options...
BrewManNH Posted March 1, 2014 Share Posted March 1, 2014 When it says requires IE5 it means that it requires at least IE5, not that you need IE5 installed on the computer. You'd be really hard pressed to find that version and then to get installed on a current OS would be a tough process if it worked at all. EDIT: Looking at the help file, it clearly says IE5+, so that is already covered in there. element72 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
element72 Posted March 2, 2014 Author Share Posted March 2, 2014 I'm having trouble trying to copy hexcolor and mouse coordinates to clipboard. Can you please give me more detail on what clipput and clipget are doing? Sorry, I'm such a noob I'm using the code above that was provided by firefox. Link to comment Share on other sites More sharing options...
FireFox Posted March 2, 2014 Share Posted March 2, 2014 ClipPut($iColor) Read the helpfile. element72 1 Link to comment Share on other sites More sharing options...
element72 Posted March 3, 2014 Author Share Posted March 3, 2014 (edited) ClipPut($iColor) Read the helpfile. ok that reinforced what I knew. I still have the problem of copying certain values to the clipboard. I know it copies texts, but I'm having trouble getting it to copy hexcolor and mouse coordinates. Edited March 3, 2014 by element72 Link to comment Share on other sites More sharing options...
FireFox Posted March 3, 2014 Share Posted March 3, 2014 but I'm having trouble getting it to copy hexcolor and mouse coordinates. Be more descriptive. Link to comment Share on other sites More sharing options...
element72 Posted March 3, 2014 Author Share Posted March 3, 2014 (edited) Be more descriptive. I can only get the function to copy text. HotKeySet("{ESC}", "Terminate") HotKeySet("{c}", "Copy") Local $iColor = 0, $aMgp = 0 While 1 $aMgp = MouseGetPos() $iColor = PixelGetColor($aMgp[0], $aMgp[1]) ToolTip("Color: 0x" & Hex($iColor, 6), $aMgp[0] + 10, $aMgp[1] + 10) Sleep(10) WEnd Func Copy() ; Add new data to the clipboard. ClipPut() = "0x" & Hex($iColor, 6) ; Display the data returned by ClipGet. MsgBox($MB_SYSTEMMODAL, "", "The following data is now stored in the clipboard: " & "Color: 0x" & Hex($iColor,6)) EndFunc ;==>Terminate Func Terminate() Exit EndFunc ;==>Terminate Edited March 3, 2014 by element72 Link to comment Share on other sites More sharing options...
FireFox Posted March 3, 2014 Share Posted March 3, 2014 Seriously? ClipPut() = "0x" & Hex($iColor, 6) Link to comment Share on other sites More sharing options...
element72 Posted March 3, 2014 Author Share Posted March 3, 2014 (edited) Seriously? ClipPut() = "0x" & Hex($iColor, 6) Thanks for all the help. I have one last thing I'm trying to do. I want to be able to play a video file or a music file as an alarm when my script detects a change. Can you give me advice on this? I've been reading that wav should be preferred over mp3. Is there a command like Run which executes programs, but instead for video or music files? Edited March 3, 2014 by element72 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 3, 2014 Moderators Share Posted March 3, 2014 element72,Look in the Help file (always a good place to start!) and read about SoundPlay & _SoundPlay. 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...
element72 Posted March 3, 2014 Author Share Posted March 3, 2014 (edited) Ok how come i can't terminate the script while the sound is playing? Edit: Maybe I should allow the music file to play while the script continues, but I halt the script using a sleep command with the same time duration as the sound file. This would allow me to terminate anytime while the sound file is playing, correct? Edited March 3, 2014 by element72 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 3, 2014 Moderators Share Posted March 3, 2014 element72,I suggest you play a shorter sound in a loop and check whether you need to exit each pass. 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...
Bert Posted March 3, 2014 Share Posted March 3, 2014 a second suggestion is to simply put the music file as a separate exe and make a run call to it so your script keeps running The Vollatran project My blog: http://www.vollysinterestingshit.com/ 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