Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/17/2018 in all areas

  1. 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.rar
    1 point
  2. IDK. But you're missing an ampersand in this line -- Local $url = "https://engnajjar.wordpress.com/wp-admin/post-new.php?content="_URIEncode($content) and there also appears to be an issue with this line ($post_Category is undefined) -- Local $Category_ID = "in-category-"&$post_Category
    1 point
  3. You're not providing a ton of information. This snippet will read random lines from a text file 20 times and output to the console, you should be able to modify to your needs: $sFile = @ScriptDir & "\Test.txt" For $a = 1 to 20 ConsoleWrite(FileReadLine($sFile, Random(1,9)) & @CRLF) Next
    1 point
  4. If there's not a form, then use _IEGetObjById to get the element and then you can actually use _IEFormElementSetValue to set it's value.
    1 point
  5. try other IE functions like https://www.autoitscript.com/autoit3/docs/libfunctions/_IEGetObjById.htm https://www.autoitscript.com/autoit3/docs/libfunctions/_IETagNameGetCollection.htm it could be you have multiple frames then it gets more complex https://www.autoitscript.com/autoit3/docs/libfunctions/_IEFrameGetCollection.htm
    1 point
  6. it should also work without a child GUI, using WinSetTrans with the handle of the edit): #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ColorConstants.au3> $hGUI = GUICreate("", 1000, 800) $cPic = GUICtrlCreatePic("c:\Program Files (x86)\AutoIt3\Examples\GUI\Merlin.gif", 0, 0, 1000, 800) GUICtrlSetState(-1, $GUI_DISABLE) $cEdit = GUICtrlCreateEdit("First line" & @CRLF, 176, 32, 200, 600) GUICtrlSetBkColor(-1, $COLOR_YELLOW) WinSetTrans(GUICtrlGetHandle($cEdit), "", 150) GUISetState(@SW_SHOW, $hGUI) While 1 $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd Exit
    1 point
  7. You can save also the bitmap from the clipboard: #include <Clipboard.au3> #include <GDIPlus.au3> _GDIPlus_Startup() Send("{PRINTSCREEN}") Sleep(100) ConsoleWrite(_GDIPlus_ImageSaveClipboardToFile(@ScriptDir & "\" & @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC & "_Test.jpg") & "/" & @error & @CRLF) _GDIPlus_Shutdown() Func _GDIPlus_ImageSaveClipboardToFile($sFilename) ;coded by UEZ build 2015-10-01 If Not _ClipBoard_Open(0) Then Return SetError(1, 0, 0) Local Const $hMemoryBMP = _ClipBoard_GetDataEx($CF_BITMAP) If Not $hMemoryBMP Then _ClipBoard_Close() Return SetError(2, 0, 0) EndIf Local Const $hBmp = _GDIPlus_BitmapCreateFromHBITMAP($hMemoryBMP) _ClipBoard_Close() _WinAPI_DeleteObject($hMemoryBMP) If Not _GDIPlus_ImageSaveToFile($hBmp, $sFilename) Then _GDIPlus_BitmapDispose($hBmp) Return SetError(3, 0, 0) EndIf _GDIPlus_BitmapDispose($hBmp) Return 1 EndFunc
    1 point
  8. aa2zz6, If you wanted to include the time (multiple copies per day) you could do something like this... #include <ScreenCapture.au3> #include <Date.au3> #include <MsgBoxConstants.au3> HotKeySet("{PRINTSCREEN}", "prtSc") Local $sString = StringReplace(_NowDate(), "/", "-") While 1 Sleep(100) WEnd Func prtSc() _ScreenCapture_Capture(@DesktopDir & "\" & StringRegExpReplace(_Now(), '[/ :]', '-') & ".jpg") EndFunc ;==>prtSc kylomas
    1 point
  9. Thank You Very much I already downloaded ImageSearch 64bit , everything now is working very well, but i must Compile Script As 64Bit to Run it without Any Problems.
    1 point
  10. JohnOne

    Global vs Local

    Warning is just a warning.
    1 point
×
×
  • Create New...