Jump to content

guestscripter

Active Members
  • Posts

    90
  • Joined

  • Last visited

Reputation Activity

  1. Like
    guestscripter reacted to Alterlife in Getting the current chrome url.   
    Success :-)



    AutoItSetOption("WinTitleMatchMode", 2) $handle = WinGetHandle("[CLASS:Chrome_WindowImpl_0; TITLE:Getting the current chrome url]") If @error Then MsgBox(4096, "Error", "Could not find the correct window") Else ; alert the present url MsgBox(4096, "", ControlgetText($handle, "", "Chrome_AutocompleteEditView1" )) ;n redirect the browser ControlSetText ($handle, "", "Chrome_AutocompleteEditView1", "http://alterlife.org/") ControlSend ($handle, "", "Chrome_AutocompleteEditView1", "{enter}") MsgBox(4096, "Error", "The browser has been redirected to http://alterlife.org/.") EndIf
  2. Like
    guestscripter reacted to Lasker in A new image search solution   
    Hello,
    Im a new AutoIt user, im from Spain and i would like to share here my own image search detection method.
    What's about it?
    It's not perfect, but with it you don't need to use any DLL file. You don't need to distribute the image file with your final AU3 Script, or Exe if compiled. The image size does not affect to the detection speed. It's bug free (i believe).
    You can find here as an attach file, a distro package with all you need, and it includes a simple how-to guide.
    Im going to paste here the how-to guide:
    How to use this AutoIt image detector:
    Point 1:
    Install JRE (Java Runtime Environment), without this you can't execute Java Applications (.jar files). Open the Java tool named AISD with double click on it, or "java -jar aisd.jar" in the cmd. In AISD, open the image you want to detect in your script. Remember: the upper left pixel of the image, MUST be a not common color in the background if you want a fast detection. Then you will get a script file if you want, or only a clipboard copied version, full ready to paste into your main script because this one comes with extra help codes. Anyway, the generated code is the $sign definition of the image (calm down, point 3 explains what is the $sign and it's easy).
    Point 2:
    Paste the mentioned code in your main script, and try to follow the sample_usage script. If you know how to write au3 codes, it should be very easy. In general terms, all you need is to include image_search.au3, and then you can use the func image_search($sign, $width, $height). You need also the get_image_sign() function, that calculates the first parameter for image_search(). The get_image_sign() function is the one you have generated at point 1.
    Point 3:
    image_search() returns the center point of the target image. The func needs the $sign from the image, width and height. This $sign is the "footprint" of the image, in the form of an array of 9 integers. In most of the cases the $sign should be enough to identify the image, this is useful because using the $sign instead of the real image let you get a small script and a fast detection. You can also delete the image once you get the $sign. This $sign has always the same size (those 9 integers, it does not matter if the original image is small or big). How can you define the $sign for a certain image?, you don't need to generate the $sign, AISD does (point 1). Follow the sample_usage script and you will get it.
    Files in this distro package:
    * AISD.jar: The already explained Java app.
    * image_search.au3: The library or module with the resources that lets you detect images.
    * sample_usage.au3: The mentioned sample_usage script. It contains the smallest example, but i think it should be ok for learning purposes.
    * sample_usage.exe: The sample_usage.au3 script compiled (au3 -> .exe). You can execute this to see the image_search() func working.
    * sample_target.png: The image to be detected in the sample_usage. You can delete this file and the script will be fine.
    * OffsetCalc.jar: It's only a Java tool to calculate the offset to transform an XY point into another one. It's useful if you want to use apply_offset function (from image_search.au3). Both things are only necessary when it's hard to find a version of the target image with upper left pixel in the way mentioned. As you can imagine, the idea is to detect another image and then apply the offset to get the real coordinates of the original target image.
    Happy Detections
    Lasker image_search.zip
  3. Like
    guestscripter reacted to gillall in ImageSearch Usage Explanation   
    Thank you for you attention.
    I find a solution for the problem in this topic.
    Below the working script code with modifications for solve the problem. The @OSVersion don't returns WIN_10 in Windows 10, returns 9600. But at last the script is finding the image on screen with right coordinates.
    #include <ImageSearch2015.au3> AutoItSetOption("MouseCoordMode", 1) #AutoIt3Wrapper_Res_HiDpi=Y HotKeySet("p", "checkForImage") HotKeySet("o", "showCoords") If @OSVersion="WIN_10" Then DllCall("Shcore.dll","long","PROCESS_DPI_AWARENESS",1) Else DllCall("User32.dll","bool","SetProcessDPIAware") EndIf Global $x = 0, $y = 0 ConsoleWrite(@OSBuild & @CR) ConsoleWrite(@DesktopWidth & @CR & @DesktopHeight & @CR) Func checkForImage() Local $search = _ImageSearch("tst.bmp", 1, $x, $y, 0) If $search = 1 Then ConsoleWrite($x & @CR & $y & @CR) MouseMove($x, $y, 0) EndIf EndFunc ;==>checkForImage Func showCoords() $mousepos = MouseGetPos() ToolTip($mousepos[0] & "," & $mousepos[1]) ConsoleWrite($mousepos[0] & @CR & $mousepos[1] & @CR) EndFunc ;==>showCoords While 1 Sleep(200) WEnd  
  4. Like
    guestscripter reacted to SmOke_N in Attaching a GUI to Another Window   
    I have code somewhere that provides an example. If I find the link I'll post in this post.

    Edit:

    I couldn't find the code I used, but I remembered something called "AnyGUI" from years ago.

    Anyway, I don't know if it still works, but if you look at the AnyGUI.au3, worse case, you can see how to handle it.

    This way you won't need to worry about moving the gui/control, it will be embedded in the window itself.

    http://www.autoitscript.com/forum/index.php?showtopic=9517&view=findpost&p=638738

    Edit 2:

    After looking at it, it certainly could be written much better, but I think it will serve the needs you are wanting as it is.
  5. Like
    guestscripter reacted to Affe in Attaching a GUI to Another Window   
    Decided to remove the entire thing as an AdLibRegister since it was slowing down the program.

    Instead, I made a separate peripheral program to do this for me. Dramatically boosts performance of the main program and improves the performance of the window mover itself.

    Now I call it from the main program with:


    ;Run the window watching program Global $watchprog = Run(@ScriptDir & "\Tools\Watch.exe " & $GUITitle & " " & $win & " " & WinGetProcess($GUITitle) & " " & $Triangle[0] & " " & $Triangle[1]) ;Let's keep this here in case some idiot deletes the watcher file If $watchprog = 0 Then AdlibRegister("WatchWindow", 750)
    And here is the code for Watch.exe:


    Opt("WinTitleMatchMode", 3) Opt("TrayIconHide", 1) If $CmdLine[0] <= 0 Then Exit Global $GUITitle = $CmdLine[1] Global $ParentTitle = $CmdLine[2] Global $process = $CmdLine[3] Global $T1 = $CmdLine[4] ;this is a x offset Global $T2 = $CmdLine[5] ;this is a y offset Global $ParentHandle GetWindow() While 1 WatchWindow() Sleep(50) WEnd Func GetWindow() $winlist = WinList($ParentTitle) If $winlist[0] > 0 Then For $x = 0 to UBound($winlist) - 1 If StringLen($winlist[$x]) = 3 Then $ParentHandle = WinGetHandle($winlist[$x]) ExitLoop EndIf Next Exit 1 Exit EndFunc Func WatchWindow() $pos = WinGetPos($ParentHandle) If WinActive($ParentHandle) Then ;~ If WinGetState($GUITitle) >= 0 Then WinSetState($GUITitle, "", @SW_SHOW) Sleep(10) ElseIf WinExists($ParentHandle) = 0 Then MsgBox(4096, "Closed", "Parent window has closed and will now quit.", 60) ProcessClose($process) Exit 1 Else If WinActive($GUITitle) Then Return ;~ If WinGetState($ParentTitle) > 2 Then WinSetState($GUITitle, "", @SW_HIDE) EndIf ;Set Z Order ; This is the _WinAPI_SetWindowPos function to put the toolbar just above the NonAutoIt app in the z-order DllCall("user32.dll", "bool", "SetWindowPos", "hwnd", $GUITitle, "hwnd", $ParentHandle, "int", $pos[0] + $T1 - 5, "int", $pos[1] + $T2 + 130, "int", 200, "int", 200, "uint", 0x0010) ; $SWP_NOACTIVATE ;~ Sleep(10) WinMove($GUITitle, "", $pos[0] + $T1 - 5, $pos[1] + $T2 + 130) EndFunc ;==>WatchWindow
    On a side note, the option WinTitleMatchMode doesn't seem to work with the option 3 (exact match). It will return partial matches (example, I have a window open named Watch, and a window opened named Watcher. WinList("Watch") will return both Watch and Watcher, and WinGetPos("Watch") also has a chance of falsely returning Watcher's position)
  6. Like
    guestscripter reacted to Melba23 in Attaching a GUI to Another Window   
    Affe,

    Looks pretty close to what I use:

    Func _GUI_Match() ; If NonAutoItApp minimised, then hide GUI and do nothing If BitAND(WinGetState($hNonAutoItApp_Wnd), 16) = 16 Then GUISetState(@SW_HIDE, $hGUI) $fGUI_Vis = False ; If NonAutoItApp not minimised Else ; Hide GUI when NonAutoItApp not active If BitAND(WinGetState($hNonAutoItApp_Wnd), 8) <> 8 And $fGUI_Vis = True Then GUISetState(@SW_HIDE, $hGUI) $fGUI_Vis = False ; Show GUI when it is ElseIf BitAND(WinGetState($hNonAutoItApp_Wnd), 8) = 8 And $fGUI_Vis = False Then GUISetState(@SW_SHOWNOACTIVATE, $hGUI) $fGUI_Vis = True EndIf ; If visible check GUI position If $fGUI_Vis = True Then ; Move if required Local $aNonAutoItApp_Pos = WinGetPos($hNonAutoItApp_Wnd) If $aNonAutoItApp_Pos[0] <> $iLast_X Or $aNonAutoItApp_Pos[1] <> $iLast_Y Then $iLast_X = $aNonAutoItApp_Pos[0] $iLast_Y = $aNonAutoItApp_Pos[1] Local $aNonAutoItApp_Client_Size = WinGetClientSize($hNonAutoItApp_Wnd) WinMove($hGUI, '', $aNonAutoItApp_Pos[0] + 360, $aNonAutoItApp_Pos[1] + ($aNonAutoItApp_Pos[3] - $aNonAutoItApp_Client_Size[1]) - 5, $iGUI_Width, 18) EndIf EndIf EndIf EndFunc ;==>_GUI_MatchBut then I do not move the app I have attached to very much, so the "choppiness" is not that much of a problem.

    M23
  7. Like
    guestscripter reacted to pecloe in Borderless, Titleless Background Window   
    try this

    #include <GuiConstants.au3> GuiCreate("",400, 300, -1,-1, BitOr($WS_POPUP,$WS_DLGFRAME), $WS_EX_TOOLWINDOW) GUISetBkColor(0xadd8e6);;; lightblue GuiSetState() While 1 Sleep(1000) WEnd
  8. Like
    guestscripter reacted to SmOke_N in Borderless, Titleless Background Window   
    That was in the example I gave above pecloe
  9. Like
    guestscripter reacted to Malkey in how to i draw one rectangle on screen?   
    Here is a simple example at draws the pixels of a rectangle to the desktop,

    #include <WinAPI.au3> _WinAPI_DrawRect(20, 20, @DesktopWidth / 2, @DesktopHeight / 2, 0x0000FF) Func _WinAPI_DrawRect($start_x, $start_y, $iWidth, $iHeight, $iColor) Local $hDC = _WinAPI_GetWindowDC(0) ; DC of entire screen (desktop) Local $tRect = DllStructCreate($tagRECT) DllStructSetData($tRect, 1, $start_x) DllStructSetData($tRect, 2, $start_y) DllStructSetData($tRect, 3, $iWidth) DllStructSetData($tRect, 4, $iHeight) Local $hBrush = _WinAPI_CreateSolidBrush($iColor) _WinAPI_FrameRect($hDC, DllStructGetPtr($tRect), $hBrush) ; clear resources _WinAPI_DeleteObject($hBrush) _WinAPI_ReleaseDC(0, $hDC) EndFunc ;==>_WinAPI_DrawRect
    Here is a more complex example that draws your rectangles to a layered window on the desktop.

    #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> ; Modified from http://www.autoitscript.com/forum/index.php?s=&showtopic=97126&view=findpost&p=698489 Opt("MustDeclareVars", 1) Opt("GUIOnEventMode", 1) Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client Main() Func Main() Local $hBitmap, $hGui, $hGraphic, $hImage2, $GuiSizeX = @DesktopWidth, $GuiSizeY = @DesktopHeight Local $GuiSize = 70, $hWnd, $hDC, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend Local $iX1 = 0, $iY1 = 0, $tPoint, $pPoint, $hBMPBuff, $hGraphicGUI, $hPen, $aMPos, $aMPosNew Local $iOpacity = 255, $dll = DllOpen("user32.dll") $hGui = GUICreate("L1", $GuiSizeX, $GuiSizeY, -1, -1, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST)) GUISetState() _GDIPlus_Startup() $hWnd = _WinAPI_GetDC(0) $hDC = _WinAPI_CreateCompatibleDC($hWnd) $hBitmap = _WinAPI_CreateCompatibleBitmap($hWnd, $GuiSizeX, $GuiSizeY) _WinAPI_SelectObject($hDC, $hBitmap) $hGraphic = _GDIPlus_GraphicsCreateFromHDC($hDC) $hBMPBuff = _GDIPlus_BitmapCreateFromGraphics($GuiSizeX, $GuiSizeY, $hGraphic) $hGraphicGUI = _GDIPlus_ImageGetGraphicsContext($hBMPBuff) _GDIPlus_GraphicsClear($hGraphic); Add ,0x01000000) to disable underling desktop $hPen = _GDIPlus_PenCreate(0xffff0000, 3) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $GuiSizeX);$iWidth ) DllStructSetData($tSize, "Y", $GuiSizeY);$iHeight) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", 1) $tPoint = DllStructCreate($tagPOINT); Create point destination structure here $pPoint = DllStructGetPtr($tPoint); Create pointer to this dll data structure, $pPTDest parameter DllStructSetData($tPoint, "X", $iX1) DllStructSetData($tPoint, "Y", $iY1) _WinAPI_UpdateLayeredWindow($hGui, $hWnd, $pPoint, $pSize, $hDC, $pSource, 0, $pBlend, $ULW_ALPHA) Do Select Case _IsPressed("01", $dll); Ctrl mouse button to move $aMPos = MouseGetPos() Do Sleep(10) Until Not _IsPressed("01", $dll) $aMPosNew = MouseGetPos() ;_GDIPlus_GraphicsDrawLine($hGraphic, $aMPosNew[0], $aMPosNew[1], $aMPos[0], $aMPos[1], $hPen) ; I used _Iif() from Misc.au3 instead using of _Min() from Math.au3. _GDIPlus_GraphicsDrawRect($hGraphic, _Iif($aMPos[0] < $aMPosNew[0], $aMPos[0], $aMPosNew[0]), _Iif($aMPos[1] < $aMPosNew[1], $aMPos[1], $aMPosNew[1]), Abs($aMPosNew[0] - $aMPos[0]), Abs($aMPosNew[1] - $aMPos[1]), $hPen) _WinAPI_UpdateLayeredWindow($hGui, $hWnd, 0, $pSize, $hDC, $pSource, 0, $pBlend, $ULW_ALPHA) Case _IsPressed("04", $dll) Or _IsPressed("11", $dll) ; Middle mouse button 0r Ctrl key <======= Clear screen of rectangles. _GDIPlus_GraphicsClear($hGraphic) _WinAPI_UpdateLayeredWindow($hGui, $hWnd, 0, $pSize, $hDC, $pSource, 0, $pBlend, $ULW_ALPHA) EndSelect Sleep(50) Until _IsPressed("1B", $dll); ESC key DllClose($dll) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphicGUI) _GDIPlus_GraphicsDispose($hGraphic) _WinAPI_ReleaseDC(0, $hWnd) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hDC) _GDIPlus_Shutdown() EndFunc ;==>Main
  10. Like
    guestscripter reacted to slightly_abnormal in Set HOT KEYS for up to 64 of your most frequently used programs and files.   
    well.. i'll say this..
    this was a pain in the ass! it works, but causes problems

    #Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown. $prefsitem = TrayCreateItem("Preferences") TrayCreateItem("") $aboutitem = TrayCreateItem("About") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $prefsitem Msgbox(64,"Preferences:","OS:" & @OSVersion) Case $msg = $aboutitem Msgbox(64,"About:","AutoIt3-Tray-sample") Case $msg = $exititem ExitLoop EndSelect WEnd Exit

    while this worked perfectly for me, no problems.

    #notrayicon Opt("TrayMenuMode",1) Opt("TrayOnEventMode",1) $Preferences_tray = TrayCreateItem("Preferences") TrayItemSetOnEvent($Preferences_tray,"_Preferences") $About_tray = TrayCreateItem("About") TrayItemSetOnEvent($About_tray,"_About") $exit_tray = TrayCreateItem("Exit") TrayItemSetOnEvent($exit_tray,"_Exit") TraySetState() While 1 ;Script sleep (100) WEnd Func _About() Msgbox(64,"About:","AutoIt3-Tray-sample") EndFunc Func _Preferences() Msgbox(64,"Preferences:","OS:" & @OSVersion) EndFunc Func _Exit() exit EndFunc
  11. Like
    guestscripter reacted to amakrkr in Checking if process is suspended/hanged/not responding   
    Hello everyone,

    after searching this forum ower and ower again i couldn't find solution to my problem or i didn't understand hints that were given in some of the threads i found.

    Let me explain what am i trying to do.

    I have a program that hangs from time to time for many different reasons. Now what am i trying to do is to write an AutoIt script that will be checking if program is running as it should or if its hanged/crashed/not responding (i dont know if those program states are all the same).

    After some searching on forum i found a code which is calling a user32.dll function called "IsHungAppWindow" (see code bolow):


    If _NotResponding("Calculator", "", 1) Then MsgBox(1,"Test","Process hanged") Else MsgBox(1,"Test","Process not hanged") EndIf Func _NotResponding($title, $text, $closeIfHung = 0) $hWnd = WinGetHandle($title, $text) If $hWnd == "0" Then MsgBox(1,"Tets","Window not found") EndIf $retArr = DllCall("user32.dll", "int", "IsHungAppWindow", "hwnd", $hWnd) If @error == 0 Then If $retArr[0] == 1 Then If $closeIfHung Then ProcessClose(WinGetProcess($title, $text)) EndIf Return 1 EndIf Else Return 0 EndIf EndFunc
    I was using windows Calculator to test this code. So what i did was i downloaded some program from CodeProject which is desigend to Suspend process ... and above posted code does not return correct MSGBox.

    I am not sure if code doesnt work or the entire logic is wrong?

    I hope some of you could help me a bit.


    Thank you for your replays.

    Best regards.
  12. Like
    guestscripter reacted to argumentum in Control Viewer - AutoIt Window Info Tool   
    There you go
     
  13. Like
    guestscripter got a reaction from WiValdiBB in ImageSearch Usage Explanation   
    You're going in the right direction I think by how you are considering usage of your $marker variabl.
    The main thing you need to do is use the Returned Data in $marker from the _ImageSearch function to change the starting points for the next search on every loop after every previous result.
    Only on the first search do you want the search to begin at 0,0 which are your $yy and $$xx variables.
    You want to update those variables after every previous result.
    You're gonna get in twouble here if that's game automation related, tss tss tss
    Don't have the time right now to write or test any actual script for you but I hope the idea is clearer now
  14. Like
    guestscripter reacted to suhungmung in Google spreadsheets   
    I know this post is old,
    Here is what I do to update google spreadsheet
    1) Create a form
    2) Fill the form using the elements of the IE page or even BETTER
    Prepopulate the form using URL parameters
    https://docs.google.com/support/bin/answer.py?hl=en&answer=160000
  15. Like
    guestscripter reacted to suhungmung in Google spreadsheets   
    Also look at the best answer:
    http://www.google.com/support/forum/p/Google%20Docs/thread?tid=541020dc61ae94c5&hl=en

    Just create a IE object, give URL something like
    https://spreadsheets.google.com/formResponse?formkey=dHNSSjMxSG1yZUVESlpyVE92aXBncVE6MQ&ifq&entry.1.single=A&entry.2.single=B&entry.3.single=C&entry.0.single=D&submit=Submit and navigate to that URL.
  16. Like
    guestscripter reacted to Terenz in Get last review date (Amazon)   
    One of the many ways
    #include <Array.au3> Local $sProductID = "B01BGFBUC4" ; //Amazon product ID Local $sURL = "http://www.amazon.com/One-Persons-Craziness-R-T-Ojas-ebook/product-reviews/" & $sProductID & "/ref=cm_cr_dp_see_all_btm?ie=UTF8&showViewpoints=1&sortBy=bySubmissionDateDescending&filterByStar=two_star"; Local $sSource = BinaryToString(InetRead($sURL, 1)) Local $sReview = StringRegExp($sSource, '(?:<span class="a-size-base a-color-secondary review-date">)(.*?)(?:</span>)', 3) If Not @error And IsArray($sReview) Then _ArrayDisplay($sReview, "DEBUG") MsgBox(0, "Last review", $sReview[UBound($sReview) - 1]) EndIf  
  17. Like
    guestscripter reacted to KutayAltinoklu in ImageSearch Usage Explanation   
    Thank You Very Much You Just Saved My Life
    I Have Signed Up To Say Thank You But I Think I Love Autoit So I will use my account to.
  18. Like
    guestscripter got a reaction from Zero_T in ImageSearch Usage Explanation   
    I just got it to work!
    I was having much trouble, reading all the threads and posts related to ImageSearch, and I'd like to help others now.
    Now got it to work as a x64 and also as a x32 script using both DLLs accordingly (on a Windows 8.1 x64 PC)
    One of the steps I took in debugging was putting this into (the top of) my script:
    $sOSArch = @OSArch ;Check if running on x64 or x32 Windows ;@OSArch Returns one of the following: "X86", "IA64", "X64" - this is the architecture type of the currently running operating system. ConsoleWrite("$sOSArch=" & $sOSArch & @CR) $sAutoItX64 = @AutoItX64 ;Check if using x64 AutoIt ;@AutoItX64 Returns 1 if the script is running under the native x64 version of AutoIt. ConsoleWrite("$sAutoItX64=" & $sAutoItX64 & @CR)In any case you want to be consistent about 32bit or 64bit usage, and use the right DLL etc.
    What also really helped was putting in lots of debugging and error handling to zoom in on whatever specific part isn't working and why.
    Credits to Centrally (very helpful usage explanation and re-uploading the files) and kangkeng for making this possible in AutoIt, as well Miguel7 from the AutoHotKey forum who also posted some helpful advice.
    I've attached a zipped folder containing all of the needed Dlls and my customised Library, which also contains an example and some debugging: ImageSearch2015.zip

    Take a look inside ImageSearch2015.au3 here if you like:
    Edit: also uploaded "ImageSearch15.au3", a version of "my" ImageSearch Library without the built-in Example and Debugging
    (will require the Dlls in the .zip file though): ImageSearch15.au3
    I hope this helps somebody! Let me know any feedback/issues.
  19. Like
    guestscripter got a reaction from Chiitus in ImageSearch Usage Explanation   
    I just got it to work!
    I was having much trouble, reading all the threads and posts related to ImageSearch, and I'd like to help others now.
    Now got it to work as a x64 and also as a x32 script using both DLLs accordingly (on a Windows 8.1 x64 PC)
    One of the steps I took in debugging was putting this into (the top of) my script:
    $sOSArch = @OSArch ;Check if running on x64 or x32 Windows ;@OSArch Returns one of the following: "X86", "IA64", "X64" - this is the architecture type of the currently running operating system. ConsoleWrite("$sOSArch=" & $sOSArch & @CR) $sAutoItX64 = @AutoItX64 ;Check if using x64 AutoIt ;@AutoItX64 Returns 1 if the script is running under the native x64 version of AutoIt. ConsoleWrite("$sAutoItX64=" & $sAutoItX64 & @CR)In any case you want to be consistent about 32bit or 64bit usage, and use the right DLL etc.
    What also really helped was putting in lots of debugging and error handling to zoom in on whatever specific part isn't working and why.
    Credits to Centrally (very helpful usage explanation and re-uploading the files) and kangkeng for making this possible in AutoIt, as well Miguel7 from the AutoHotKey forum who also posted some helpful advice.
    I've attached a zipped folder containing all of the needed Dlls and my customised Library, which also contains an example and some debugging: ImageSearch2015.zip

    Take a look inside ImageSearch2015.au3 here if you like:
    Edit: also uploaded "ImageSearch15.au3", a version of "my" ImageSearch Library without the built-in Example and Debugging
    (will require the Dlls in the .zip file though): ImageSearch15.au3
    I hope this helps somebody! Let me know any feedback/issues.
  20. Like
    guestscripter reacted to ravkr in SunMoon calculator   
    This script calculates information about the Moon and the Sun (position on the sky, rise, transit, set, Moon phase etc.) Just enter your longitude and latitude wait a second  
      Maybe I'll add ISS, asteroids and planets but I don't promise anything.   Needed help with translating! If you want to translate it to your language just copy section (eg. [English]) from lang.ini, translate all messages and post it here   Download link: http://ravkr.duckdns.org/autoit/sunmoon_v1.zip Report any bugs.   Feedback is welcome   PS. It's my first script published on this forum
  21. Like
    guestscripter reacted to Enforcer in CPU,RAM,TIME Widgets   
    Hello, just sharing my good old
    CPU, RAM, TIME widget.

    CONTY.rar
  22. Like
    guestscripter reacted to JohnOne in Global Pause, and general pause functions.   
    I've decided to dedicate this thread to general pause functions.   This is a general in script Pause function. It requires no global variables, just the function and a hotkey linked to it. It's so small I just put the example in with it.. HotKeySet("{PAUSE}", "_Pause") HotKeySet("{Esc}", "_Exit") While 3 Sleep(500) ConsoleWrite("Testing 123..." & @LF) ;Your code starts in this main loop WEnd Func _Pause() Local Static $bPaused = False $bPaused = Not $bPaused While $bPaused Sleep(333) WEnd EndFunc ;==>_Pause Func _Exit() Exit EndFunc ;==>_Exit
  23. Like
    guestscripter reacted to JohnOne in Global Pause, and general pause functions.   
    I've made a makeshift universal pause function hack, which works by an external script controlling AutoIt's tray pause capability.
     
    Here's how it works,,,
     
    You Include the GlobalPause.au3 in your script, when you do that and run your script, it writes Pause.au3 to your script folder. Pause.au3 is the binary string which you see in GlobalPause.au3, it's just much neater to write it this way, The actual code of Pause.au3 is below.
     
    Your script (shown below as TestingPause.au3) needs everything you see in it except the Sleep and ConsoleWrite which is just there for demonstration purposes.
     
    It's pretty self explanatory really, you hit pause key and it should  pause your script immediately, you press it again and it will resume it as though you hit the pause button in the system tray. That is all it is, automating that button and a bit of logic, the reason is just convenience and I've seen many people wanting a boil in the bag pause function.
     
    Most of the automation code comes from M32 / rover in >this post, or one similar to it (cannot quite remember, I found a few), with a few adjustments.
     
    Here is the setback, your script's system tray icon must be visible in the tray and not hidden, I simply cannot find a way to automate the hidden ones. You can make it stay there by using the customize icon link in the hidden tray.
     
    The Code

     The Include: GlobalPause.au3
     

    The test script: TestingPause.au3
     

    The code which the included binary resolves to: Pause.au3
     
     
    It's trivial to get all this working with your compiled scripts, or have the Pause.au3 compiled, in fact that's how I started it, but then thought about non compiled scripts and changed it.
    Probably mostly just help noob botters, but I hope someone at least gets some use from it, basically just saves you writing your embedded pause function. And this probably won't even work on a machine other than my own. 
    EDIT: This thread now includes other more general Pause implementations.
    >General pause function for hot key.
    >General pause function for gui button.
    >Classic MsgBox pause.
    >Pause via Tray Menu.
    Please feel free to add any other pause implementations.
    The Zip for global pause:
    GlobalPause.zip
  24. Like
    guestscripter reacted to Iczer in AutoIt Snippets   
    function without arrays and dependences to calculate number of days in any month in any year
    For $i = 1 to 12 ConsoleWrite(_DaysInMonth($i,2000)&@CRLF) Next Func _DaysInMonth ($iMonth,$iYear) return 28 + Mod($iMonth + Floor($iMonth / 8), 2) + Mod(2, $iMonth) + Floor((2 - Mod(Mod($iYear, 4) * (Mod($iYear, 100) + Mod($iYear, 400)) + 2, (Mod($iYear, 4) * (Mod($iYear, 100) + Mod($iYear, 400)) + 1))) / $iMonth) + Floor(1/$iMonth) - Floor((1 - Mod((Mod($iYear, 4) * (Mod($iYear, 100) + Mod($iYear, 400)) + 2), (Mod($iYear, 4) * (Mod($iYear, 100) + Mod($iYear, 400)) + 1)))/$iMonth) EndFunc
  25. Like
    guestscripter reacted to Geir1983 in Poker Hand evaluator plugin   
    Glad I could help I run a virtual machine with 32 bit OS so i did not have any troubble with 64 bit OS.

    Not sure if I am doing something wrong or just dont understand the return types from the analysis. When analyzing 5 and 6 card i get hand categories that are not within 1-9 range. Is it some other bitshift operation that is needed for the return of functions "AnalyzeHand5" and "AnalyzeHand6" perhaps?

    Here is an example of my return:

    12:31:13, Startup
    12:31:14, Dealt Hand: Kc, Td
    12:31:14, ChenStartHandFormula() rating: 6 of hand: Kc - Td
    12:31:14, Dealt Flop: Th, 8s, 4d
    12:31:14, AnalyzeHand5() My Hand Category: 2665, My Category Strength: 3061
    12:31:14, Dealt Turn: 8d
    12:31:14, AnalyzeHand6() My Hand Category: 6646, My Category Strength: 2865
    12:31:14, Dealt River: Ad
    12:31:14, AnalyzeHand() My Hand Category: 3, My Category Strength: 385
    12:31:14, Complete Hand: Kc, Td - Th, 8s, 4d, 8d, Ad

    Any suggestions?

    Edit:
    @Malkey: For the PluginOpen i used this:
    $handEval = PluginOpen(@ScriptDir & "handEval.dll")
×
×
  • Create New...