All Activity

This stream auto-updates   

  1. Past hour
  2. #RequireAdmin #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <WinAPIGdi.au3> #include <Array.au3> #include <WinAPIDiag.au3> $Imglocation = @ScriptDir&"\Image\testimg.bmp" _GDIPlus_Startup() Local $Bitmap = _GDIPlus_BitmapCreateFromFile($Imglocation) Local $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($Bitmap) Local $imgSize = _WinAPI_GetBitmapDimension($hBitmap) Local $imgBits = DllStructCreate('dword[' & (DllStructGetData($imgSize, 'X') * DllStructGetData($imgSize, 'Y')) & ']') _WinAPI_GetBitmapBits($hBitmap, DllStructGetSize($imgBits), DllStructGetPtr($imgBits)) _WinAPI_DisplayStruct($imgBits) MsgBox(0, "", DllStructGetData($imgBits, 1, 1)) _GDIPlus_Shutdown()
  3. Today
  4. @tubaba, Welcome to our forums. I see that the shared rar file contains only an executable file and no sourcefiles. The executable is not a standard AutoIt3 compiled file and honestly do not know why I would trust to run that! Anybody with a sane mind will not simply run this. Jos
  5. Welcome to the forums @tubaba Looks nice. Very much like the one from "Alt - Q" Looks like an example app. Where is the example script ?
  6. Hopefully you can add something to collect #AutoIt3Wrapper directions and fileinstall as a feature that will cover up all that this will need IMO, And the synchronize option could be just a checkmark to always synchronize with a simple log file to keep trace of - newly synced ..
  7. Hi! Today I want to show you my current AutoIt project: MySciTE4Au3Jump. What is Myscitejump? Myscitejump is a helper tool for writing autoit3 Sctipt scripts with the SciTE editor. It can use the control directives in the script (statements that begin with #), custom Functions (UDF), and annotation sections. displayed in a list to the body of the box. It provides a quick and efficient way to jump functionality without scrolling through the entire script to find the specific functions you are looking for, control instructions, and comments. It also provides the ability to collapse statements. Collapses the statement to the deepest depth. Make the script look a glance. Important: The first time you use Myscitejump, you must establish a database. Use the second page "refreshing include databases" button. sorry for my bad english^^ MySciTEJump1.4.6build20171119.rar
  8. Hi all, Anyone have any idea how to close all open tabs except a specific one I manually open. Assuming I don't know what is open in all the tabs except just the one I want to keep open. I didn't want to use sendkeys and I was trying to use the following code to list the title (or url) of the 3 open tabs and after I got that part working I would just close the other 2. This sample only displays the title of the first open tab #include <IE.au3> Const $ie_new_in_tab = 0x0800 $oIE = _IECreate("") __IENavigate($oIE, "", 1, $ie_new_in_tab) ;(obj,url,wait,param) __IENavigate($oIE, "", 1, $ie_new_in_tab) ;(obj,url,wait,param) Local $aIE[1] $aIE[0] = 0 Local $i = 1, $oIE While 1     $oIE = _IEAttach("", "instance", $i)     If @error = $_IEStatus_NoMatch Then ExitLoop     ConsoleWrite(_IEPropertyGet($oIE, "title") & @CRLF)     ReDim $aIE[$i + 1]     $aIE[$i] = $oIE ;each item holds object     $aIE[0] = $i ;first item holds count     $i += 1 WEnd MsgBox($MB_SYSTEMMODAL, "Browsers Found", "Number of browser instances in the array: " & $aIE[0]) ; This doesn't return the list of tabs in the console just the first tab Thanks for any and all help
  9. Thanks for the reply but I solved the problem, putting "0" on "_IECreate(0)" alone doesn't work, but I tried to do it this way "_IECreate("",0,0)". it works, Now if it still is good, to anyone I would like to ask another question on this thread, I tried another code: ; Script Start - Add your code below here $var = "jhetro" $var2 = "jhetro" $var3 = "jhetro" if $var == $var2 Or $var3 Then MsgBox($MB_SYSTEMMODAL, "Warning", "INVADING, opening my files are prohibited") endif and it doesn't show any messageBox, why? I tried some other codes andi thisnk it's because of the "Or" statement,:)
  10. Hello guys, i'm the new one. I'm learning to using autoit. I have a question: Is there a way to copy text from a website follow example "ABC001, ABC002... ABCxxx" Like this, i want to copy thueacc2471 and input it to another tab.Is it possible ? Thank in advance.
  11. Read the help file entry for _IECreate. There's a parameter that allows you to control the visibility of the browser window.
  12. Hi I am able to get rid of the Regex complexity and to be easier, how can I use _StringBetween succession or another? thanks. #include <Array.au3> #include <String.au3> $string = _oHTTPGet("") $string = StringRegExpReplace($string, '(?s)[\n\r\t\v]', '') $string = StringStripWS($string, 7) $aData = _StringBetween($string, '<loc>','</loc>') For $j = 0 To UBound($aData) - 1 If IsArray($aData) Then ConsoleWrite("Line : " & @ScriptLineNumber & " : " & $aData[$j] & @CRLF) $string2 = _oHTTPGet($aData[$j]) $string2 = StringRegExpReplace($string2, '(?s)[\n\r\t\v]', '') $string2 = StringStripWS($string2, 7) $aPostData = _StringBetween($string2, '</head>','<footer') For $s = 0 To UBound($aPostData) - 1 If IsArray($aPostData) Then $StringBetw2 = _StringBetween($aPostData[$s], '<div class="entry-content">','<span class="synved-social-container');My question is exactly for this line $StringBetw2 = StringRegExpReplace($StringBetw2, "(?is)(<script[^>]+javascript.*?/script>)", "") $StringBetw2 = StringRegExpReplace($StringBetw2, '(?s)<.*?>', "" & @CRLF) $StringBetw2 = StringRegExpReplace($StringBetw2, '(&nbsp;)+', "") ConsoleWrite("Line : " & @ScriptLineNumber & " : " & $StringBetw2 & @CRLF) Else ConsoleWrite("Line : " & @ScriptLineNumber & " : " & " Problem " & @CRLF) EndIf Next EndIf Next Func _oHTTPGet($aUrL) Local $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("GET", $aUrL, False) $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:55.0) Gecko/20100101 Firefox/55.0") $oHTTP.Send() If @error Then ConsoleWrite("Line : " & @ScriptLineNumber & " Not Connect " & @CRLF) $oHTTP = 0 Return SetError(1) EndIf If $oHTTP.Status = 200 Then Local $sReceived = $oHTTP.ResponseText $oHTTP = Null Return $sReceived EndIf $oHTTP = Null Return -1 EndFunc
  13. HEY man I hope you wouldn't mind me asking another question, is there any way I can use @SW_HIDE as a parameter in an the script: #include <IE.au3> $oIE = _IECreate(@SW_HIDE) _IENavigate($oIE, "") I tried but it still shows the window, is it possible with autoIT?
  14. It is about 50 years since I last did linear algebra.
  15. @Deye Yes it does have an independent "Include" directory alongside the program. Since it already houses the compiler with the application itself the include directory is automatically chosen by the compiler that is bundled with the application this is why I added a Synchronize option. so if you have a script that uses a custom udf you can just hit synchronize and it will copy that UDF to the local include library. But it if your thinking that it detects the script first then copies only the used includes. Actually it doesn't. It copies the Whole installed include library.
  16. You're welcome...
  17. HEY man I can't edit my reply(can't find the edit button) and I found the IE management thanks
  18. WTH, how come I did not see that one, well is there really a documentation in the help file? can't seem to ind it
  19. @jhave21 if you were in that thread already, you should have noticed two things: The post is 11 years old! The last post very clearly states - the latest and greatest when it comes to documentation is included in the current release of AutoIt. Look in the AutoIt help file under IE Management
  20. Hello all, I'm new here and I just started learning AutoIT a few days ago, And I would like to use IE.au3 and the thing is I downloaded documentation zip file from this thread and Nothing showing up take a look: thanks
  21. @mrPuh welcome to the forum. How about posting your code, rather than expecting us to guess? I have some plink scripts, and have not seen this.
  22. The truly useless key nowadays, is the "Scroll Lock". So I use as a "play a macro ON" key. In this case for speaker volume control. #include <WinAPIvkeysConstants.au3> Global $hDLL = DllOpen("user32.dll") OnAutoItExitRegister("OnAutoItExit") Func OnAutoItExit() DllClose($hDLL) EndFunc main() Func main() Local $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If Not $iScrollState Then Send("{SCROLLLOCK}") $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If Not $iScrollState Then Exit MsgBox(262144+16, StringTrimRight(@ScriptName,4), 'failed to turn on "Scroll Lock"',5) If $iScrollState Then Send("{SCROLLLOCK}") $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If $iScrollState Then Exit MsgBox(262144+16, StringTrimRight(@ScriptName,4), 'failed to turn off "Scroll Lock"',5) ; the above code is to make sure we are affecting the keyboard $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) Local $iScrollStateWas = $iScrollState While 1 $iScrollState = BitAND(_WinAPI_Key_GetState($VK_SCROLL, $hDLL), 1) If $iScrollStateWas <> $iScrollState Then $iScrollStateWas = $iScrollState If $iScrollState Then ToolTip("SCROLLLOCK is ON") HotKeySet("{PAUSE}","f_PAUSE") HotKeySet("{UP}","f_UP") HotKeySet("{DOWN}","f_DOWN") HotKeySet("{ESC}","f_ESC") Else HotKeySet("{PAUSE}") HotKeySet("{UP}") HotKeySet("{DOWN}") HotKeySet("{ESC}") ToolTip("") EndIf EndIf Sleep(50) WEnd EndFunc Func f_PAUSE() Send("{VOLUME_MUTE}") ToolTip("VOLUME_MUTE") Send("{SCROLLLOCK OFF}") ; return keyboard use EndFunc ; by {SCROLLLOCK OFF} Func f_UP() Send("{VOLUME_UP}") ToolTip("VOLUME_UP") EndFunc Func f_DOWN() Send("{VOLUME_DOWN}") ToolTip("VOLUME_DOWN") EndFunc Func f_ESC() Exit ; just in case you hide the Tray icon EndFunc Func _WinAPI_Key_GetState($vKey, $vDLL = 'user32.dll') ; read help on _WinAPI_GetAsyncKeyState() and DllOpen() Local $aRet = DllCall($vDLL, 'short', 'GetKeyState', 'int', $vKey) If @error Then Return SetError(@error, @extended, 0) Return $aRet[0] EndFunc ;==>_WinAPI_GetKeyState Func _WinAPI_Key_Pressed($vKey, $vDLL = 'user32.dll') ; read help on _IsPressed(), but use Virtual-Key Codes (WinAPIvkeysConstants.au3) Local $a_R = DllCall($vDLL, "short", "GetAsyncKeyState", "int", $vKey) If @error Then Return SetError(@error, @extended, False) Return BitAND($a_R[0], 0x8000) <> 0 EndFunc ;==>_IsPressed Also here is the version of _IsPressed() I use.
  23. Yesterday
  24. Yes, it was just a proof of concept version. What I would do is to create a bitmap with a rectangle (different color of course) which will be also rotated and check for the color. This will work also for images with transparent parts. Of course your math solution is much cooler! Well done!
  25. Ok.. So the FINAL WORKING code is DONE! You guys ROCK! I've attached the program if anyone wants to try it/see what I was trying to do.. It opens an excel file, reads all the sample ID's and corresponding test codes, and assigns it to a machine if the test code is new, or generates the sampleid/testcode for each device if it's not new or after you select the device that hte test code corresponds to! You guys genuinely rock...! Note: Some functions that are network dependent and how the excel is generated were deleted ExcelLoaderFinished.au3 MC_SampleDueRpt.xls
  26. Sorry I didn't have much time for lengthy explanation. Nice to know you've got it.
  27. Your approach is surprisingly performant, given that it has a for loop that is executed many times. It appears to me that it will fail if, in traversing the image, it simultaneously encounters two black pixels before reaching a corner triangle. I realize that this is unlikely. In order to run your code, I ran it on a 1024x768 version of pergola.jpg; otherwise on my 1920x1024 monitor, the Rotate button was off screen. I have revisited my code, improving the time it takes to do the cropping. While it was recreating the control, it now adds borders to the displayed version, the borders being the colour of the client-area background. What was taking about 130 msec snow takes about 36. Also, there is now no flicker. The script, with the new code, is below: #include <ButtonConstants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars',1) GUIRegisterMsg($WM_MOUSEWHEEL, "WM_MOUSEWHEEL") GUIRegisterMsg($WM_PAINT,'WM_PAINT') Global $gX0=10,$gX1=580,$gY0,$gY1,$gForm1,$glblPic,$gCtlWid,$gCtlHt,$imgWid,$imgHt Global $ghCanvas,$ghImage,$ghPen,$gGraphicPic,$ghBitmap main() Func main() $gCtlWid = 893 $gCtlHt = 480 $gForm1 = GUICreate("Form1", $gCtlWid+50, 601, 192, 114) $glblPic = GUICtrlCreateLabel("", 8, 8, $gCtlWid, $gCtlHt) Local $btnRotate = GUICtrlCreateButton("Rotate", 472, 560, 65, 25) Local $btnExit = GUICtrlCreateButton(" Exit ",600,560) GUISetState(@SW_SHOW) Local $oldY0,$oldY1 _GDIPlus_Startup() $ghPen = _GDIPlus_PenCreate(0xFF999999,2) $ghImage = _GDIPlus_ImageLoadFromFile('H:\b\pergola.jpg') Local $hnd = GUICtrlGetHandle($glblPic) $gGraphicPic = _GDIPlus_GraphicsCreateFromHWND($hnd) $gY0 = 400 $gY1 = 400 $imgWid = _GDIPlus_ImageGetWidth($ghImage) $imgHt = _GDIPlus_ImageGetHeight($ghImage) $ghBitmap = _GDIPlus_BitmapCreateFromScan0($imgWid, $imgHt) $ghCanvas = _GDIPlus_ImageGetGraphicsContext($ghBitmap) ; Loop until the user exits. While True If $gY0<>$oldY0 Or $gY1<>$oldY1 Then Paint() $oldY0 = $gY0 $oldY1 = $gY1 Else Switch GUIGetMsg() Case $GUI_EVENT_CLOSE,$btnExit ExitLoop Case $btnRotate Local $hImageClone=_GDIPlus_BitmapCreateFromScan0($imgWid, $imgHt) Local $hGfxClone=_GDIPlus_ImageGetGraphicsContext($hImageClone) ; rotate about centre Local $gMatrix = _GDIPlus_MatrixCreate() _GDIPlus_MatrixTranslate($gMatrix, $imgWid/2, $imgHt/2) Local $deg = Angle($gY1-$gY0, $gX1-$gX0) _GDIPlus_MatrixRotate($gMatrix, -$deg) _GDIPlus_MatrixTranslate($gMatrix, -$imgWid/2, -$imgHt/2) _GDIPlus_GraphicsSetTransform($hGfxClone, $gMatrix) _GDIPlus_GraphicsDrawImageRect($hGfxClone,$ghImage,0,0,$imgWid,$imgHt) _GDIPlus_GraphicsDispose($hGfxClone) $hGfxClone=_GDIPlus_ImageGetGraphicsContext($ghImage) ; See deskew notes document Local $ang = Abs($deg*3.14159/180) Local $cos = cos($ang), $sin = sin($ang), $tan = tan($ang) Local $w2cos = $imgWid/2*$cos, $w2sin = $imgWid/2*$sin Local $h2cos = $imgHt/2*$cos, $h2sin = $imgHt/2*$sin Local $nsrcX = ($imgHt/2 - $w2sin - $h2cos)*$tan - $w2cos + $h2sin + $imgWid/2 Local $nsrcY = ($imgWid/2 + $w2cos - $h2sin)*$tan - $w2sin - $h2cos + $imgHt/2 Local $nSrcWidth = $imgWid - 2*$nSrcX Local $nSrcHeight = $imgHt - 2*$nSrcY ; crop to screen, centering within control _GDIPlus_GraphicsClear($hGfxClone,0xFFD4D0C8) ; client area background colour Local $nDstX = ($imgWid-$nSrcWidth)/2 Local $nDstY = ($imgHt-$nSrcHeight)/2 ; draw a portion of image object $hImageClone on the image that $hGfxClone points to _GDIPlus_GraphicsDrawImageRectRect($hGfxClone,$hImageClone, _ $nSrcX,$nSrcY,$nSrcWidth,$nSrcHeight,$nDstX,$nDstY,$nSrcWidth,$nSrcHeight) _GDIPlus_ImageDispose($hImageClone) $gy0 = 400 $gy1 = 400 Paint() Local $hImageClone2 = _GDIPlus_BitmapCloneArea($ghImage,$nsrcX,$nsrcY,$nSrcWidth,$nSrcHeight) _GDIPlus_ImageSaveToFile($hImageClone2,'H:\b\1.jpg') _GDIPlus_ImageDispose($hImageClone2) ShellExecute('H:\b\1.jpg') EndSwitch EndIf WEnd ; Clean up resources _GDIPlus_MatrixDispose($gMatrix) _GDIPlus_ImageDispose($ghCanvas) _GDIPlus_ImageDispose($ghImage) _GDIPlus_ImageDispose($ghBitmap) _GDIPlus_PenDispose($ghPen) _GDIPlus_GraphicsDispose($gGraphicPic) _GDIPlus_Shutdown() EndFunc Func WM_MOUSEWHEEL($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Local Const $MK_SHIFT=0x4,$MK_CONTROL= 0x8 Local Const $kYmax=$gCtlHt-1,$kDelta=2 Local $vec = GUIGetCursorInfo($gForm1) If $vec[4] = $vec[4]=$glblPic Then Local $iDelta = BitShift($wParam, 16) ; positive = up Local $iKeys = _WinAPI_LoWord($wParam) If BitAND($iKeys,$MK_CONTROL)=$MK_CONTROL Then If BitAND($iKeys,$MK_SHIFT)=$MK_SHIFT Then ; do nothing Else If $iDelta > 0 And $gY0>3 Then $gY0 -= $kDelta If $iDelta < 0 And $gY0<$kYmax Then $gY0 += $kDelta EndIf Else If BitAND($iKeys,$MK_SHIFT)=$MK_SHIFT Then If $iDelta > 0 And $gY1>3 Then $gY1 -= $kDelta If $iDelta < 0 And $gY1<$kYmax Then $gY1 += $kDelta Else If $iDelta > 0 And $gY0>3 Then $gY0 -= $kDelta If $iDelta < 0 And $gY0<$kYmax Then $gY0 += $kDelta If $iDelta > 0 And $gY1>3 Then $gY1 -= $kDelta If $iDelta < 0 And $gY1<$kYmax Then $gY1 += $kDelta EndIf EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_MOUSEWHEEL Func Paint() _GDIPlus_GraphicsClear($ghCanvas,0) _GDIPlus_GraphicsDrawImageRect($ghCanvas, $ghImage, 0,0, $gCtlWid, $gCtlHt) _GDIPlus_GraphicsDrawLine($ghCanvas, $gX0, $gY0, $gX1, $gY1, $ghPen) _GDIPlus_GraphicsDrawImageRect($gGraphicPic, $ghBitmap, 0, 0, $imgWid, $imgHt) EndFunc Func WM_PAINT() _WinAPI_RedrawWindow($gForm1, 0, 0, $RDW_UPDATENOW) Paint() _WinAPI_RedrawWindow($gForm1, 0, 0, $RDW_VALIDATE) EndFunc Func Angle($y, $x) ;return value is in degree Local Const $fPi = ACos(-1), $fPi2 = ACos(-1) / 2, $fRad = 180 / $fPi Switch True Case ($x > 0) Return ATan($y / $x) * $fRad Case ($x < 0 And $y >= 0) Return ATan($y / $x + $fPi) * $fRad Case ($x < 0 And $y < 0) Return ATan($y / $x - $fPi) * $fRad Case ($x = 0 And $y > 0) Return $fPi2 * $fRad Case ($x = 0 And $y < 0) Return -$fPi2 * $fRad Case ($x = 0 And $y = 0) Return 0 EndSwitch EndFunc
  28. Thank you, I could find this very useful thread (with all the explanations) thanks to your hint : As far as I'm concerned, this topic can now be closed.
  1. Load more activity