-
Posts
91 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by darkshark
-
Hello everyone! At work there is a program that they call it "black screen", it's a terminal based application with some fields to enter data. It looks like this (but it's black lol): So, basically what I need to do is to enter data in the right fields and get its outputs. Is there anything in autoit that can help me to do it? Thanks in advance!
-
Remove White Spaces in image
darkshark replied to darkshark's topic in AutoIt General Help and Support
Thanks for the answer, I understood your reasoning, but not always an image will be a rectangle, sometimes it will have text, some other image ... -
Remove White Spaces in image
darkshark replied to darkshark's topic in AutoIt General Help and Support
UEZ Thanks a lot for the help, really doing it this way is much faster! I really would not be able to do it in assembly since I do not know anything about that language. I'll use this code you sent me! Thank you and good night! -
Hi, everyone! I have some pictures on my computer that I need to "remove the white parts". Basically I need to crop images only where it has some content ... I wrote this code that seems to work, but, it is very very slow ... I wonder if there is any other alternative to do this service! Attached I left the image used as test and what I expect result! If anyone could help me I would be very happy. Thank you very much #include <File.au3> #Include <GDIPlus.au3> Global $iMinX = 0 Global $iMinY = 0 Global $iMaxX = 0 Global $iMaxY = 0 _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\test.png") Local $iHeight = _GDIPlus_ImageGetHeight($hImage) Local $iWidth = _GDIPlus_ImageGetWidth($hImage) For $x = 0 To $iWidth For $y = 0 To $iHeight Local $iPixelColor = _GDIPlus_BitmapGetPixel($hImage, $x, $y) If $iPixelColor <> 4294967295 Then If $x < $iMinX or $iMinX = 0 Then $iMinX = $x EndIf If $x > $iMaxX Then $iMaxX = $x EndIf If $y < $iMinY or $iMinY = 0 Then $iMinY = $y EndIf If $y > $iMaxY Then $iMaxY = $y EndIf EndIf Next Next $hClone = _GDIPlus_BitmapCloneArea($hImage, $iMinY, $iMaxX, $iMaxY, $GDIP_PXF24RGB) _GDIPlus_ImageSaveToFile($hClone, @ScriptDir & "\croped.png") _GDIPlus_ImageDispose($hClone) _GDIPlus_ImageDispose($hImage) _GDIPlus_ShutDown ()
-
Convert VBA Autocad to Autoit
darkshark replied to darkshark's topic in AutoIt General Help and Support
Nothing I think I'm going to give up, I was wanting to create an autocad UDF but I do not think I'll be able to! Thank you very much for the help -
Convert VBA Autocad to Autoit
darkshark replied to darkshark's topic in AutoIt General Help and Support
Testing one by one i'm getting the same error: "C:\Users\rodol\Desktop\Novo(a) AutoIt v3 Script (3).au3" (8) : ==> The requested action with this object has failed.: Local $oTest1 = $oAcad.AcadMText Local $oTest1 = $oAcad^ ERROR ""C:\Users\rodol\Desktop\Novo(a) AutoIt v3 Script (3).au3" (10) : ==> The requested action with this object has failed.: Local $oTest2 = $oAcad.AcadMText.ThisDrawing Local $oTest2 = $oAcad^ ERROR" -
Convert VBA Autocad to Autoit
darkshark replied to darkshark's topic in AutoIt General Help and Support
Nothing =/ This example code works: $strActiveDocument = $oAcad.Activedocument.Name MsgBox(0,"$oAcad.Activedocument.Name",$strActiveDocument) $iBlocks = $oAcad.Activedocument.Blocks.Count MsgBox(0,"$oAcad.Activedocument.Blocks.Count",$iBlocks) For $i = 0 to $iBlocks -1 $strBlockName = $oAcad.Activedocument.Blocks.Item($i).name If $strBlockName = "TITLEBLOCK" Then $iAttributes = $oAcad.Activedocument.Blocks.Item($i).GetAttributes() MsgBox(0,"GetAttributes()",$iAttributes) EndIf Next But my code don't work =S i've tried a lot of combination, but notting -
Convert VBA Autocad to Autoit
darkshark replied to darkshark's topic in AutoIt General Help and Support
"C:\Users\admin\Desktop\autocadtest.au3" (13) : ==> The requested action with this object has failed.: $oAcad.AcadMText($oAcad.ThisDrawing.ModelSpace.AddMText($aCoords, $width, $text)) $oAcad.AcadMText($oAcad^ ERROR >Exit code: 1 Time: 0.5987 thanks for your response! -
Hi, can anyone help me, please? I need to "translate" this code in vba to autoit! This is the VBA Code: Sub Example_AddMtext() ' This example creates an MText object in model space. Dim MTextObj As AcadMText Dim corner(0 To 2) As Double Dim width As Double Dim text As String corner(0) = 0#: corner(1) = 10#: corner(2) = 0# width = 10 text = "This is the text String for the mtext Object" ' Creates the mtext Object Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text) ZoomAll End Sub I've Tried to do this: $oAcad = ObjGet("","AutoCAD.Application.20") If @error Then Msgbox(0,"ObjGet","Failed to open AutoCAD.Application.20 Object. Error code: " & hex(@error,8)) Exit Endif _Add_MText($oAcad, 0, 10, "test") Func _Add_MText($oAcad, $x, $y, $text, $width = 10) Local $aCoords[3] = [$x,$y,0] $oAcad.AcadMText.ThisDrawing.ModelSpace.AddMText($aCoords, $width, $text) Return 0 EndFunc But i'm getting this error: $oAcad.AcadMText.ThisDrawing.ModelSpace.AddMText($aCoords, $width, $text) $oAcad^ ERROR Can anyone give me a light, please? Thanks a lot
-
Find a "break" in time interval
darkshark replied to darkshark's topic in AutoIt General Help and Support
Thanks a lot for your reply! i've found the bug: In this part: $jumped = Not $jumped i replaced with this: $jumped = false and all works again!! i will fix my code in my post! Thanks again! -
Find a "break" in time interval
darkshark replied to darkshark's topic in AutoIt General Help and Support
Hello, everyone, first thank you for the answers! Today in college I thought of something to streamline the code, tested and ... WOW. The code took just 0.24 seconds to find the mistakes (on my computer). Thank @jguinch, the only problem is that as the @mikell, the code gives problem between 23:00 and 00:00 (I fixed the "bug" and worked correctly) Thank you also @Melba23 for your code and @mikell for joining the topic! @jchd, I need the full series, so I need not have any errors, so any "broken" point can be considered a mistake! There are gauges that measure each hour and more accurate measuring minute by minute! In general, the only problem is that both codes are considering only the time, and sometimes there are gaps of days (the old tide gauges stopped for maintenance) and this can give problems! I made a "kludge" in my code and he successfully found errors in a very short time! I will leave here below my solution! ( considering that the data are sorted, I check longer intervals instead of looking one by one, so need to do fewer checks! ) #include <Date.au3> Local $a = _ReadCSV(@Scriptdir & "\rqh0281a.csv") Local $iTimeDiff = _DateDiff("n", $a[0], $a[1]) Local $n = 0 ConsoleWrite("started" & @LF & "Time Difference = " & $iTimeDiff & @LF & @LF) ;"Random" numbers to jump in array. Local $jump[12] = [100000, 50000, 10000, 5000, 2000, 1000, 500, 100, 10, 5, 3, 2] Local $jumped = False $t = TimerInit() For $i = 1 To UBound($a) - 1 ;Verify if i can jump "n" rows comparing the dates and time. For $j = 0 To UBound($jump) - 1 If $i + $jump[$j] <= UBound($a) And _DateDiff("n", $a[$i - 1], $a[$i + $jump[$j]]) = $iTimeDiff * ($jump[$j] + 1) Then $i += $jump[$j] $jumped = True ExitLoop EndIf Next If Not $jumped And _DateDiff("n", $a[$i - 1], $a[$i]) <> $iTimeDiff Then ConsoleWrite($a[$i - 1] & @LF & $a[$i] & @LF & @LF) $n += 1 Else $jumped = false EndIf Next $t = TimerDiff($t) ConsoleWrite("End!" & @LF & "Verification Time = " & $t / 1000 & @LF & "errors = " & $n & @LF) Func _ReadCSV($sCSVFile) Local $sRead = FileRead($sCSVFile) Local $aDados = StringRegExp($sRead, "(?m)((?:[-\d]+[, ;]+)+\d+)", 3) Local $n = UBound($aDados) Local $aReturn[$n] For $i = 0 To $n - 1 $sStrip = StringRegExp($aDados[$i], "(\d+)", 3) If @error Then ContinueLoop $aReturn[$i] = $sStrip[0] & "/" & $sStrip[1] & "/" & $sStrip[2] & " " & $sStrip[3] & ":00:00" Next Return $aReturn EndFunc ;==>_ReadCSV -
hello people, all right? I have a CSV file with data at sea level over time! My problem is: In some parts of these data, there are failures, or data that is missing, and I need to count and locate these parts! Initially created a code that checks the difference between the times "neighbors" to find these flaws, however, it takes a long time, about 224 seconds to find the flaws ... Because the data is sorted, I thought about doing something with recursion, but I could not ... Did you manage to think of something that can make my code faster? This is my code: #include <Date.au3> Local $a = _ReadCSV(@ScriptDir & "\rqh0281a.csv") ;Time difference between 2 points Local $iTimeDiff = _DateDiff('n', $a[0], $a[1]) Local $n = 0 ConsoleWrite('started' & @LF & 'Time Difference = ' & $iTimeDiff & @LF & @LF) $t = TimerInit() For $i = 1 To UBound($a) - 1 ;Compare the time difference with inicial difference. If _DateDiff('n', $a[$i - 1], $a[$i]) <> $iTimeDiff Then $n += 1 EndIf Next $t = TimerDiff($t) ConsoleWrite('End!' & @LF & 'Verification Time = ' & $t / 1000 & @LF & "errors = " & $n & @LF) Func _ReadCSV($sCSVFile) Local $sRead = FileRead($sCSVFile) Local $aDados = StringRegExp($sRead, "(?m)((?:[-\d]+[, ;]+)+\d+)", 3) Local $n = UBound($aDados) Local $aReturn[$n] For $i = 0 To $n - 1 $sStrip = StringRegExp($aDados[$i], "(\d+)", 3) If @error Then ContinueLoop $aReturn[$i] = $sStrip[0] & "/" & $sStrip[1] & "/" & $sStrip[2] & " " & $sStrip[3] & ":00:00" Next Return $aReturn EndFunc ;==>_ReadCSV and the CSV file: CSV File Thank you very much!
-
Wow, that's Fantastic, UEz *-*
-
Got it, guys, I also was not finding a solution so I decided to ask for help here to see if anyone could help me! But the way I have to think of another way to do it! But anyway, thank you all! @Chimp I loved this script, I had never seen, he makes clear my problem hahaha. @UEZ and @czardas Thank you for trying to help me!
-
I need the points are ordered because I want to calculate the moment of inertia of the second order, the product of inertia, area, centroid, etc. in this section, this is for structural analysis! I need the coordinates follow a logical order, that part of point 1 (blue) and go to 2,3,4,5,6,7,8,9,10,11 and finish in 12 it is not necessary start from the point 1 may from another point but following the same logic! Edit: Here's The Coordinates of the vertices!
-
hi, guys, okay? Can anyone give me a light? I need to sort the coordinates of the vertices of a non-convex polygon, no matter whether it is clockwise, counterclockwise, from where or where it goes, just follow the "path" correctly! I have here the image to exemplify and an array with the coordinates of the polygon in order "not correct". Local $XY[12][3] = [[0,0], [15,0], [15,3], [0,3], [6,3], [9,3], [9,12], [6,12], [0,12], [15,12], [15,15], [0,15]] Here's what I tried to do, I tried to make the arctangent, arctangent 2, order from the center of the box that catches all vertices from the source and nothing has worked, since I drew on paper several times and I can not think in nothing! Local $XY[12][3] = [[0,0], [15,0], [15,3], [0,3], [6,3], [9,3], [9,12], [6,12], [0,12], [15,12], [15,15], [0,15]] _SortCoords($XY) _ArrayDisplay($XY) Func _SortCoords(ByRef $XY) Local $xcenter = (_ArrayMax($XY, 1, -1, -1, 0) - _ArrayMin($XY, 1, -1, -1, 0)) / 2 Local $ycenter = (_ArrayMax($XY, 1, -1, -1, 1) - _ArrayMin($XY, 1, -1, -1, 1)) / 2 For $i = 0 To UBound($XY) -1 $XY[$i][2] = atan2(($ycenter - $XY[$i][1]),($xcenter - $XY[$i][0])) Next EndFunc ;==>_SortCoords Func atan2($y, $x) Return (2 * ATan($y / ($x + Sqrt($x * $x + $y * $y)))) EndFunc If anyone can help me with this I would be immensely grateful Already thanks!
-
what's color format from _GDIPlus_BitmapGetPixel?
darkshark replied to darkshark's topic in AutoIt General Help and Support
ah, I see, thank you a lot -
hi, guys, okay? I made a simple upgrade in the UDF ImageSearch so it can search for images from the memory. It is working, as you can see in the attached file. (run the code from the desktop, as in the example he seeks the windows 10 bin). I was trying to make the code find a image in another image, however, I am unable to do this, because I can not open an image on the computer with hHandle [as _ScreenCapture ()]. If they would help further increase this UDF! Thank you ^^ ImageSearchEX.zip Edit: i'm really sorry, it's already in the forum in this link: my content is duplicated, please, close my topic and sorry for this
-
with your code, the problem still persists.... I did some tests here and managed to solve the problem. I changed the line: Global $vResult = _Excel_RangeRead($oWorkBook, Default, $oExcel.Selection, 2) per: Global $vResult = _Excel_RangeRead($oWorkBook, $oExcel.ActiveSheet.Name, $oExcel.Selection, 2) and it worked. I'm using autoit version v3.3.14.1, Microsoft Office 2013 and Windows 10! Thank you so much for your help, water. you helped me a lot. Thanks again!
-
2 i'm using this test file teste.xlsx EDIT: Sorry, in the BookAttack i'm not giving error, only in RangeRead EDIT2: updated part for obtaining a window title #include <Array.au3> #include <Excel.au3> Local $sTitle = WinGetTitle("[CLASS:XLMAIN]") Local $oExcel = _Excel_Open() Local $oWorkBook = _Excel_BookAttach($sTitle, "Title") MsgBox(0,'',@error) $oExcel.Selection.Columns.AutoFit Local $aResult = _Excel_RangeRead($oWorkbook, Default, $oExcel.Selection, 2) MsgBox(0,'',@error) _ArrayDisplay($aResult)
-
The problem persists =/ #include <Array.au3> #include <Excel.au3> Local $aWins = WinList() For $i = 1 To $aWins[0][0] If StringInStr($aWins[$i][0], " - Microsoft Excel") Then ExitLoop Next Local $oExcel = _Excel_Open() Local $oWorkBook = _Excel_BookAttach($aWins[$i][0], "Title") $oExcel.Selection.Columns.AutoFit Local $aResult = _Excel_RangeRead($oWorkbook, Default, $oExcel.Selection, 2) MsgBox(0,'',@error) _ArrayDisplay($aResult)
-
Thanks a lot, water
-
#include <Array.au3> #include <Excel.au3> Local $aWins = WinList() For $i = 1 To $aWins[0][0] If StringInStr($aWins[$i][0], " - Microsoft Excel") Then ExitLoop Next Local $oWorkBook = _Excel_BookAttach($aWins[$i][0], "Title") Local $sSelection = $oWorkBook.Application.Selection.Address(False, False) Local $aResult = _Excel_RangeRead($oWorkbook, Default, $sSelection, 2) MsgBox(0,'',@error) _ArrayDisplay($aResult)hello, I need a little help, I need to read the cells that are selected in an excel file that is already open. When I enter the code above, I get an error number 2, referring to the worksheet, however, there is no problem ... until the part to get the address of the cell the code works normally, and using the sample code _Excel_RangeRead(), the sample code also works perfectly ... I've tried using $oWorkbook.ActiveSheet, but keeps giving error.anyone help me, please? thanks a lot
-
convert address to lat lng (google maps)
darkshark replied to golfinhu's topic in AutoIt General Help and Support
why u don't use IE lib?