Leaderboard
Popular Content
Showing content with the highest reputation on 09/08/2013 in all areas
-
ImageSearch Usage Explanation
HansHenrik reacted to Centrally for a topic
After having lot of issues myself with getting ImageSearch to work I decided to make topic with explanation how to proper use this script. Here is link of original topic at this topic: Credits to kangkeng for creating such useful piece of code. What is ImageSearch? It's script that find part of screen which you before defined with given image. When should I use ImageSearch? You should use it whenever it's not possible or unlikely that pixelsearch will give what you need. So how can I use ImageSearch and enjoy it's awesome benefits? First of all to avoid mostly caused problems I recompiled DLLs for both architectures which you can download at end of this post. When you pick your package you should place both ImageSearch.au3 and ImageSearch.dll inside script folder. Usage Example: First of all take picture of what you want to search for (print screen + paint + corp + save as bmp). Place that picture in script directory (I named my picture checkImage (checkImage.bmp is full name with extension). You must include ImageSearch.au3 in your script. ImageSearch.au3 consist of 2 Functions you can use: _ImageSearch and _ImageSearchArea Note: Use _ImageSearch to search the entire desktop, _ImageSearchArea to specify a desktop region to search Values to put in for _ImageSearch function (entire screen search) ($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance, $HBMP=0) Values to put in for _ImageSearchArea function (you declare part of screen to be searched) ($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance,$HBMP=0) Description of parameters from ImageSearch.au3 itself: ; Description: Find the position of an image on the desktop ; Syntax: _ImageSearchArea, _ImageSearch ; Parameter(s): ; $findImage - the image to locate on the desktop ; $tolerance - 0 for no tolerance (0-255). Needed when colors of ; image differ from desktop. e.g GIF ; $resultPosition - Set where the returned x,y location of the image is. ; 1 for centre of image, 0 for top left of image ; $x $y - Return the x and y location of the image ; ; Return Value(s): On Success - Returns 1 ; On Failure - Returns 0 Example of my script using _ImageSearch ( entire screen search) #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() Local $search = _ImageSearch('checkImage.bmp', 0, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc while 1 sleep(200) WEnd Example of my script using _ImageSearchArea #include <ImageSearch.au3> HotKeySet("p", "checkForImage") global $y = 0, $x = 0 Func checkForImage() local $search = _ImageSearchArea('check5.bmp', 1, 800, 40, 900, 80, $x, $y, 0) If $search = 1 Then MouseMove($x, $y, 10) EndIf EndFunc while 1 sleep(200) WEnd I would like to apologize if by writing this I offended any of member that thinks this script is too simple to even have it explained, it's just as me being new to autoIt it took me so much time getting around errors and making this script to work. Thanks for reading, if you bump on any problems using it post it here, I will try to help you fixing it and update topic for further reference. Download links: 32bit: ImageSearch 32bit.rar 64bit: ImageSearch 64 bit.rar1 point -
Maybe try this Local $button = _IEFormElementGetObjByName($oForm, "loginBtn") _IEAction($button, "click")1 point
-
Turn off the monitor when power button pressed
Alexxander reacted to DW1 for a topic
To be specific, in Windows 7, there is no way to interrupt PBT_APMSUSPEND with BROADCAST_QUERY_DENY like in previous versions of Windows. I see lots of forums in all different programming languages discussing the same. As for another way to accomplish the same thing, there probably is, but I don't know what it is. Maybe if you changed the power button to shut down and attempt to interrupt that with BROADCAST_QUERY_DENY, but then you wouldn't be able to shut down the computer from the start menu either unless you looked for something like a hotkey and didn't pass the BROADCAST_QUERY_DENY if it was held down, or made your own shutdown option in your script, or shut down the app first, or any other not very clean/professional way. Maybe somebody that knows a lot more than I do will join the thread and show us the light. If the shutdown option seems fine to you, you can give that a shot though. EDIT: I tested stopping the shutdown, and it works, but it really only holds the shutdown from occurring on Windows 7, and will still show the shutdown screen until you hit cancel. So for Windows 7, I have no idea how to hook the power button as this method will not work for it.1 point -
Maybe try this _IEAction($oForm, "click") 8)1 point
-
Andreik It would probably be: Func _MyUIApp_OnViewChanged($pSelf, $iViewId, $iTypeId, $pView, $iVerb, $iReason) #forceref $pSelf, $iViewId, $iTypeId, $pView, $iVerb, $iReason Local Static $g_pRibbon Switch $iVerb Case 0 ;UI_VIEWVERB_CREATE ConsoleWrite("UI_VIEWVERB_CREATE" & @CRLF) If Not IsObj($g_pRibbon) Then Local $oUnknown = ObjCreateInterface($pView, $sIID_IUnknown, "") $oUnknown.AddRef() Local $pRibbon $oUnknown.QueryInterface($sIID_IUIRibbon, $pRibbon) $g_pRibbon = ObjCreateInterface($pRibbon, $sIID_IUIRibbon, $tagIUIRibbon) EndIf Case 2 ;UI_VIEWVERB_SIZE ConsoleWrite("UI_VIEWVERB_SIZE" & @CRLF) Local $uRibbonHeight If IsObj($g_pRibbon) Then $g_pRibbon.GetHeight($uRibbonHeight) ConsoleWrite("$uRibbonHeight = " & $uRibbonHeight & @CRLF) EndSwitch Return 0 ; S_OK EndFunc1 point
-
If the form doesn't have id or name specified, then you need to use the index of appearance. That would be _IEFormGetCollection() function. My another and better advice would be not to use IE.au3 at all for something like this. If I were you I would use Winhttp.au3, not because I wrote it, but because it's much more sensible solution: #include "WinHttp.au3" ; Initialize and get session handle $hOpen = _WinHttpOpen() ; Get connection handle $hConnect = _WinHttpConnect($hOpen, "www.website.net") ; web server where the site is hosted ; Fill the login form and collect resulting page $sHTML = _WinHttpSimpleFormFill($hConnect, _ Default, _ ; your code suggested default page "index:0", _ ; first form on the page has index 0, second is index 1, etc... You set correct one here, it's my assumption that it's 0 value "name:username", "John", _ ; <- filling username field by "name" attribute "name:password", "orange12") ; <- filling password field by "name" attribute ; ...Check @error here and maybe inspect value of $sHTML variable to see if login was successful ; After that you use $hConnect and $hOpen to automate further. Those handles will have cookies attached ; and every action you would do later with them will be from user "John" with password "orange12". ;... The rest of the code... ;... ; When you are done close handles _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen)1 point
-
Server time?
abberration reacted to sahsanu for a topic
Quick sample: #include <Constants.au3> $computer = "localhost" ;Change the computer name/ip here Local $running = Run(@ComSpec & " /c " & "net time " & "\\" & $computer, "", @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD) Local $output While 1 $output &= StdoutRead($running) If @error Then ExitLoop WEnd While 1 $output &= StderrRead($running) If @error Then ExitLoop WEnd Local $array = StringRegExp($output, ".+\ ([0-9]:.+)", 1) If Not @error Then MsgBox(64, "", "Computer " & $computer & " time is " & $array[0])1 point -
pixel search -need help-
Alexxander reacted to DW1 for a topic
Tested and working for me (with a different pixel search). Perhaps your pixel search is bad.1 point -
Syntax error when using ByRef ???
jaberwacky reacted to trancexx for a topic
It's not all that simple. You should be able to use default values with Byref. It's only that noone found time to add it to the language. But it was on my todo list. For example see this: ABC(23) Func ABC(ByRef $a) $a = 46 EndFunc ...That code is perfectly valid in AutoIt. It's only a bug in Au3Check that wouldn't let you run it, so you have to disable it before running that code.If that's allowed then using simple logic this: ABC(23) Func ABC(ByRef $a = 0) $a = 46 EndFunc ... should be allowed too.It's missing feature.1 point -
In case someone finds this in the future?do=embed' frameborder='0' data-embedContent> approach to what Rover suggested in post #4, as ?do=embed' frameborder='0' data-embedContent> remove the icon entirely. The code was by Rover originally.1 point
-
convert dec or hex to rgb percentages?
jaberwacky reacted to Josbe for a topic
Dec to RGB: MsgBox(0, "", _Dec2RGB(35231)) ;// Decimal to RGB Func _Dec2RGB($_DecColor) Local $R = BitAND( BitShift($_DecColor, 16), 0xff) Local $G = BitAND( BitShift($_DecColor, 8), 0xff) Local $B = BitAND($_DecColor, 0xff) Return $R & ", " & $G & ", " & $B EndFunc Output: --------------------------- 0, 137, 159 --------------------------- EDIT: Function with an example.1 point