Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/22/2018 in all areas

  1. 1 line Run("calc.exe")
    4 points
  2. Neutro

    AS400 tasks automation

    Hey guys! Here are some informations on how to automate AS400 tasks with AutoIT. AS400 are mainframes made by IBM and used mainly in professional workplaces. First you need to launch an IBM Iseries console to the AS400. It looks like this: As it is a regular window, you can use the "AutoIT Window Info" tool and functions like "ControlSetText", "ControlClick" to automate the login process. Notice that the name of the window (in the top left of the above screenshot) is "Session A". This is because it is the first Iseries window that is opened on the client computer. If you do not close it and open another one, the next one will be named "Session B". The third one "Session C"... Once you're logged into the Iseries console interface, the OS400 login window shows up: Use this code to create an autoIT object linked to the iseries console: global $oOIA = ObjCreate("PCOMM.autECLOIA") $oOIA.SetconnectionByName("A") global $oPS = ObjCreate("PCOMM.autECLPS") $oPS.SetConnectionByName("A") The letter "A" is a reference to the name of the session displayed in the iseries console window, as explained before. Change it to another letter if you have multiples iseries console windows opened at the same time. Then there are 3 main functions that you can use to interact with the interface: $oOIA.WaitForInputReady() ;waits for the interface to be ready for input. $oPS.SetCursorPos(6, 53) ;put the cursor of the interface to position X = 6, Y = 53 $oPS.SendKeys("hello world[enter]") ;write the text "hello world" where the cursor of the interface is then press the enter/return key $result = $oPS.SearchText("banana") ;search for the text "banana" on the interface screen. Returns "True" if found, "False" if not. The function "WaitForInputReady" is badfully not very reliable. For better results, use the fuction "SearchText" in a while loop to wait for a specific text to appear on the interface if you want to be sure that the interface is ready for input. With these 3 functions you can pretty much do anything you would do manually on an Iseries console. Special keys for the "SendKeys" function can be found using the virtual keyboard included in the iseries console software. Enjoy Original post (credit to @DangerousDan and @bwochinski) for helping me understand the above stuff ^^):
    1 point
  3. Subz

    Need help with my variables

    You can use something like the following, you also need to be exitloop in your while-wend otherwise your script won't allow you to proceed, personally I'd drop the while-wend or use GuiCtrlSetOnEvent mode then it won't cause any issues. #include "misc.au3" ;_sendEx("keys");$keys will not be sent until CTRL, ALT, SHIFT are released back into the wild Func _SendEx($keys) While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12") sleep(50) WEnd Send($keys) EndFunc;==>_SendEx #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("ExpandVarStrings", 1) $p20 = PixelGetColor(1238, 125) $p30 = PixelGetColor(1243, 125) $p40 = PixelGetColor(1251, 125) $p50 = PixelGetColor(1259, 125) $p60 = PixelGetColor(1268, 125) $p75 = PixelGetColor(1280, 125) $p85 = PixelGetColor(1288, 125) $p90 = PixelGetColor(1291, 128) $p95 = PixelGetColor(1296, 125) $r20 = PixelGetColor(1238, 141) $r30 = PixelGetColor(1243, 141) $r40 = PixelGetColor(1251, 141) $r50 = PixelGetColor(1259, 141) $r60 = PixelGetColor(1268, 141) $r75 = PixelGetColor(1280, 141) $r85 = PixelGetColor(1288, 141) $r90 = PixelGetColor(1291, 141) $r95 = PixelGetColor(1296, 141) #Region ### START Koda GUI section ### Form=C:\Users\jmvpe\Desktop\autoit test menu\form3.kxf Global $Form1_1 = GUICreate("Form1", 458, 303, -1, -1) Global $startb = GUICtrlCreateButton("Start", 200, 192, 107, 33) Global $pauseb = GUICtrlCreateButton("Pause", 312, 192, 107, 33) Global $exitb = GUICtrlCreateButton("Exit", 256, 232, 107, 33) Global $percentages = GUICtrlCreateLabel("% Legend", 72, 24, 51, 17) Global $Label1 = GUICtrlCreateLabel("60% - $p60$", 24, 152, 65, 17) Global $Label2 = GUICtrlCreateLabel("30% - $p30$", 24, 80, 65, 17) Global $Label3 = GUICtrlCreateLabel("40% - $p40$", 24, 104, 65, 17) Global $Label4 = GUICtrlCreateLabel("50% - $p50$", 24, 128, 65, 17) Global $Label5 = GUICtrlCreateLabel("20% - $p20$", 24, 56, 65, 17) Global $Label6 = GUICtrlCreateLabel("75% - $p75$", 24, 176, 65, 17) Global $Label7 = GUICtrlCreateLabel("85% - $p85$", 24, 200, 65, 17) Global $Label8 = GUICtrlCreateLabel("90% - $p90$", 24, 224, 65, 17) Global $Label9 = GUICtrlCreateLabel("95% - $p95$", 24, 248, 65, 17) Global $Label10 = GUICtrlCreateLabel("60% - $r60$", 112, 152, 66, 17) Global $Label11 = GUICtrlCreateLabel("30% - $r30$", 112, 80, 66, 17) Global $Label12 = GUICtrlCreateLabel("40% - $r40$", 112, 104, 66, 17) Global $Label13 = GUICtrlCreateLabel("50% - $r50$", 112, 128, 66, 17) Global $Label14 = GUICtrlCreateLabel("20% - $r20$", 112, 56, 66, 17) Global $Label15 = GUICtrlCreateLabel("75% - $r75$", 112, 176, 66, 17) Global $Label16 = GUICtrlCreateLabel("85% - $r85$", 112, 200, 66, 17) Global $Label17 = GUICtrlCreateLabel("90% - $r90$", 112, 224, 66, 17) Global $Label18 = GUICtrlCreateLabel("95% - $r95$", 112, 248, 66, 17) Global $Label19 = GUICtrlCreateLabel("Leve ", 232, 48, 64, 17) Global $Label20 = GUICtrlCreateLabel("Pesado ", 232, 80, 72, 17) Global $LeveP = GUICtrlCreateInput("", 304, 48, 121, 21) Global $PesadoP = GUICtrlCreateInput("", 304, 80, 121, 21) Global $Label21 = GUICtrlCreateLabel("Roxa", 232, 120, 50, 17) Global $RoxaP = GUICtrlCreateInput("", 304, 120, 121, 21) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $startb $verificarv = GUICtrlRead($PesadoP) $verificarm = GUICtrlRead($RoxaP) While 1 If ($verificarv <> "0xDB4F4F") And ($verificarm = "0x807DFF") Then _SendEx("{F5}") sleep(400) ElseIf ($verificarv = "0xDB4F4F") And ($verificarm <> "0x807DFF") Then _SendEx("{F8}") sleep(600) Else If ($verificarv <> "0xDB4F4F") And ($verificarm <> "0x807DFF") Then _SendEx("{F5}") sleep(600) EndIf EndIf WEnd Case $exitb Exit Case $pauseb EndSwitch WEnd
    1 point
  4. Ascer

    WIA.Vector resize image

    Hello, Do you have any idea to resize Vector graphic using some maths trick? It's example to create Vector image 10x10px and write A Local $a10x10 = [ _ 1,1,1,1,1,1,1,1,1,1, _ 1,1,1,0,0,0,0,1,1,1, _ 1,1,0,0,1,1,0,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,1,0,0,0,0,0,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,0,0,0,1,1,0,0,0,1, _ 1,1,1,1,1,1,1,1,1,1 _ ] Local $oVector = ObjCreate("WIA.Vector.1") If Not IsObj($oVector) Then ConsoleWrite("+++ Error " & @error & " durning create a Vector.object." & @CRLF) Exit EndIf Local $iBlue = 0xFF0000FF ; ARGB color Local $iWhite = 0xFFFFFFFF ; adding pixels to vector For $i = 0 To UBound($a10x10) - 1 Local $iPixel = $a10x10[$i] Local $iColor = $iBlue If $iPixel = 0 Then $iColor = $iWhite $oVector.Add($iColor) Next ; create a img 10x10 px Local $oImg = $oVector.ImageFile(10, 10) ; path to file Local $sPath = @ScriptDir & "\Vector.bmp" ; delete previous file if exits. FileDelete($sPath) ; save img to script direction. $oImg.SaveFile($sPath) ; show result, you have to use 800% size to see effects. ShellExecute("Vector.bmp")
    1 point
  5. UEZ

    WIA.Vector resize image

    Well, for quadratic array this works but not for the other non quadratic one. #include <Array.au3> Local $a20x10 = [ _ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, _ 1,0,1,1,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1, _ 1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,0,1, _ 1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,0,1,1, _ 1,0,1,1,1,0,1,0,0,0,0,1,1,1,1,1,0,1,1,1, _ 1,0,1,1,1,0,1,0,1,1,1,1,1,1,1,0,1,1,1,1, _ 1,0,1,1,1,0,1,0,1,1,1,1,1,1,0,1,1,1,1,1, _ 1,0,1,1,1,0,1,0,1,1,1,1,1,0,1,1,1,1,1,1, _ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,1, _ 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 _ ] Local $a10x10 = [ _ 1,1,1,1,1,1,1,1,1,1, _ 1,1,1,0,0,0,0,1,1,1, _ 1,1,0,0,1,1,0,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,1,0,0,0,0,0,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,1,0,1,1,1,1,0,1,1, _ 1,0,0,0,1,1,0,0,0,1, _ 1,1,1,1,1,1,1,1,1,1 _ ] Local $oVector = ObjCreate("WIA.Vector.1") Local $oImageProcess = ObjCreate("WIA.ImageProcess") If Not IsObj($oVector) Then ConsoleWrite("+++ Error " & @error & " durning create a Vector.object." & @CRLF) Exit EndIf If Not IsObj($oImageProcess) Then ConsoleWrite("+++ Error " & @error & " durning create a ImageProcess.object." & @CRLF) Exit EndIf Local $iBlue = 0x0000FF ; RGB color Local $iWhite = 0xFFFFFF Local $fScaleX = 20, $fScaleY = 20, $iUboundX = 20, $iUboundY = 10 Local $aVector_scaled = ScaleVectorArray1D($a20x10, $iUboundY, $iUboundX, $fScaleX, $fScaleY) ; adding pixels to vector For $i = 0 To UBound($aVector_scaled) - 1 Local $iPixel = $aVector_scaled[$i] Local $iColor = $iBlue If $iPixel = 0 Then $iColor = $iWhite $oVector.Add($iColor) Next ; create a img 10x10 px Local $oImg = $oVector.ImageFile($fScaleX * $iUboundX, $fScaleY * $iUboundY) ; path to file Local $sPath = @ScriptDir & "\Vector.bmp" ; delete previous file if exits. FileDelete($sPath) ; save img to script direction. $oImg.SaveFile($sPath) ; show result, you have to use 800% size to see effects. ShellExecute("Vector.bmp") Func ScaleVectorArray1D($aVector1D, $iUboundY, $iUboundX, $iScaleX = 20, $iScaleY = 20) Local $aVector2D[$iUboundY][$iUboundX] Local $c = 0, $x, $y For $y = 0 To UBound($aVector2D) - 1 For $x = 0 To UBound($aVector2D, 2) - 1 $aVector2D[$y][$x] = $aVector1D[$c] $c += 1 Next Next Local $iUB2x = UBound($aVector2D, 2) * $iScaleX, $iUB2y = UBound($aVector2D) * $iScaleY Local $aVector1D_new[$iUB2x * $iUB2y], $dx = UBound($aVector2D, 2) / $iUB2x, $dy = UBound($aVector2D) / $iUB2y $c = 0 For $y = 0 To $iUB2y - 1 For $x = 0 To $iUB2x - 1 $aVector1D_new[$c] = $aVector2D[$y * $dy][$x * $dx] $c += 1 Next Next Return $aVector1D_new EndFunc Working on it... fixed it.
    1 point
  6. 1. Description. Udf working with MSDN System.Collections.ArrayList. Allow you to make fast operations on huge arrays, speed is even x10 better than basic _ArrayAdd. Not prefered for small arrays < 600 items. 2. Requirements .NET Framework 1.1 - 4.5 (on this version Microsoft destroy old rules) System Windows 3. Possibilities. ;=============================================================================================================== ; UDF Name: List.au3 ; ; Date: 2018-02-17, 10:52 ; Description: Simple udf to create System Collections as ArrayList and make multiple actions on them. ; ; Function(s): _ListCreate -> Creates a new list ; _ListCapacity -> Gets a list size in bytes ; _ListCount -> Gets items count in list ; _ListIsFixedSize -> Get bool if list if fixed size ; _ListIsReadOnly -> Get bool if list is read only ; _ListIsSynchronized -> Get bool if list is synchronized ; _ListGetItem -> Get item on index ; _ListSetItem -> Set item on index ; ; _ListAdd -> Add item at end of list ; _ListClear -> Remove all list items ; _ListClone -> Duplicate list in new var ; _ListContains -> Get bool if item is in list ; _ListGetHashCode -> Get hash code for list ; _ListGetRange -> Get list with items between indexs ; _ListIndexOf -> Get index of item ; _ListInsert -> Insert a new item on index ; _ListInsertRange -> Insert list into list on index ; _ListLastIndexOf -> Get index last of item ; _ListRemove -> Remove first found item ; _ListRemoveAt -> Remove item in index ; _ListRemoveRange -> Remove items between indexs ; _ListReverse -> Reverse all items in list ; _ListSetRange -> Set new value for items in range ; _ListSort -> Sort items in list (speed of reading) ; _ListToString -> Get list object name ; _ListTrimToSize -> Remove unused space in list ; ; Author(s): Ascer ;=============================================================================================================== 4. Downloads List.au3 5. Examples SpeedTest _ArrayAdd vs ListAdd SpeedTest ArraySearch vs ListIndexOf Basic usage - crating guild with members
    1 point
  7. Jeet24, Welcome to the AutoIt forums. You specifically need the WinAPIConv fix, but as mentioned in the post I suggest downloading all 3. M23
    1 point
  8. If you're using the latest version of AutoIT, there is a fix that was posted in the sticky at the top of this support forum.
    1 point
  9. Beated my own expectation down to 3 lines and shortened in bytes (using the $fcBtn makes it shorter could have made it $f offcourse but goal was not to obfuscate) local $fcBtn=GUICtrlCreateButton, $j=0, $2=0, $amsg[]=[0,0,0,0,0], $BA[] = ["7", "8", "9", "+", "C", "4", "5", "6", "-", "SqRt", "1", "2", "3", "*", ".", "0", "(", ")", "/", "="], $hGui = GUICreate("Calc", 360, 330, 229, 118), $f=GUISetFont(18, 400, 0, "MS Sans Serif"), $D = GUICtrlCreateInput("", 8, 8, 344, 31, BitOR(0x00000080, 2)), $1 = GUISetState(@SW_SHOW),$2 = $fcBtn($BA[0],7,50,65, 63) , $2 = $fcBtn($BA[1],77,50,65, 63) ,$2 = $fcBtn($BA[2],147,50,65, 63) ,$2 = $fcBtn($BA[3],217,50,65, 63) ,$2 = $fcBtn($BA[4],287,50,65, 63) ,$2 = $fcBtn($BA[5],7,120,65, 63) ,$2 = $fcBtn($BA[6],77,120,65, 63) ,$2 = $fcBtn($BA[7],147,120,65, 63) ,$2 = $fcBtn($BA[8],217,120,65, 63) ,$2 = $fcBtn($BA[9],287,120,65, 63) ,$2 = $fcBtn($BA[10],7,190,65, 63) ,$2 = $fcBtn($BA[11],77,190,65, 63) ,$2 = $fcBtn($BA[12],147,190,65, 63) ,$2 = $fcBtn($BA[13],217,190,65, 63) ,$2 = $fcBtn($BA[14],287,190,65, 63) ,$2 = $fcBtn($BA[15],7,260,65, 63) ,$2 = $fcBtn($BA[16],77,260,65, 63) ,$2 = $fcBtn($BA[17],147,260,65, 63) ,$2 = $fcBtn($BA[18],217,260,65, 63) ,$2 = $fcBtn($BA[19],287,260,65, 63) Do Until ((assign("aMsg",GUIGetMsg(1))=1) and ($aMsg[2]=0 ? $2=0 : (GUICtrlRead($aMsg[0]) = "C" ? GUICtrlSetData($D, "") : GUICtrlRead($aMsg[0]) = "SqRt" ? GUICtrlSetData($D, Sqrt(Execute(GUICtrlRead($D)))) : GUICtrlRead($aMsg[0]) = "=" ? GUICtrlSetData($D, Execute(GUICtrlRead($D))) : GUICtrlSetData($D, GUICtrlRead($D) & GUICtrlRead($aMsg[0]))) and ($aMsg[0]=-3))=true) or ($aMsg[0] = -3) ; $GUI_EVENT_CLOSE I think I am out of tricks but maybe an MVP knows how to get it into a one liner
    1 point
×
×
  • Create New...