Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/30/2015 in all areas

  1. I didn't create this, I found it here: http://sourceforge.net/projects/autoitc/ i tested it with simple things like a msgbox, and it works fine, but it's very limited how many commands it supports. i though I share it, would be great if it were able to compile any script to c++ ========================================================================== AutoItC 0.1.0 (alpha) ========================================================================== WARNING: This is an Alpha Version. Several features may be missing or incomplete. Content of this file: 1. Directory Structure Overview 2. How To Start 3. AutoItC-Converter 4. License ========================================================================== 1. Directory Structure Overview ========================================================================== /include The header files for the runtime library of AutoItC /intern The source files for the runtime library of AutoItC - This folder might not exist in the binary-only version of AutoItC /AutoItC-Converter The source files of AutoItC-Converter.exe - This folder might not exist in the binary-only version of AutoItC /AutoItC-Converter.exe Command line tool which converts the AutoIt-script to C++-files /Compiler.au3 AutoIt-script which automates the compiling process /Compiler.exe Compiled version of Compiler.au3 /libAutoItC.a Runtime library ========================================================================== 2. How to start ========================================================================== AutoItC is Windows only. You need at least gcc 4.7 for compiling C++ to executables.. Before using AutoItC add the path of gcc to the environment variable PATH or modify Compiler.ini. Run Compiler.exe or Compiler.au3 and select the input and output file and do the compiling automatically. You can also do the code generation with AutoItC-Converter and then compile and link manually with the command line. See 2. AutoItC-Converter for more details about the options. ========================================================================== 3. AutoItC-Converter ========================================================================== AutoItC-Converter is a command line tool which converts the AutoIt script to C++. Options: -iPATH path to include files (e.g. -i..\include) if not set, no includes-directory exists -fFILE process FILE -fFILE must be set or the compiler will break with an error message -oFILE write the output into FILE default is out.cpp -l print a short version of the license (GPL) AutoItC.zip
    4 points
  2. Just a fast hack for next Thursday. Maybe too early but who cares... Source: ;coded by UEZ build 2016-01-08 ;~ #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "BassConstants.au3" #include "Bass.au3" _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iFrames = 0, $iShowFPS = 0, $fTimer, $bExit, $aAudio Global Const $iW = @DesktopWidth, $iH = @DesktopHeight, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ Simple Firework by UEZ" Global Const $fPi = ACos(-1), $fRad = $fPi / 180, $iMaxParticles = 51, $iFireworks = 10, $iParticleSize = 4 Global $iElements = 9, $aCoords[$iFireworks][$iElements + $iMaxParticles * 4 - 3] ;don't touch these values AutoItSetOption("GUIOnEventMode", 1) GDIPlus_SimpleFirework() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_SimpleFirework() $bExit = False $hGUI = GUICreate($sTitle & 0, $iW, $iH, 0, 0, $WS_POPUP) GUISetState(@SW_SHOW, $hGUI) WinSetTrans($hGUI, "", 0xF8) GUISetCursor(16, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrush = _GDIPlus_BrushCreateSolid(0xFFE0E0E0), _ $hBrush_Clr = _GDIPlus_BrushCreateSolid(0x70000000), _ $hBrush_Txt = _GDIPlus_BrushCreateSolid(0x10202020), $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xA0505050), _ $hFormat = _GDIPlus_StringFormatCreate(), $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily = _GDIPlus_FontFamilyCreate("Impact"), $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont = _GDIPlus_FontCreate($hFamily, $iH / 4.5), $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout = _GDIPlus_RectFCreate(0, 0, $iW, $iH), $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 150, 32) _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) Local $iX, $iY, $j = -2^32 + 1, $bAudio = True ;init sound _BASS_STARTUP() _BASS_Init(0, -1, 44100, 0, "") If @error Then $bAudio = False Local $aAudio[$iFireworks][2], $hAudio_Whoa, $hAudio_BgNoise For $iY = 0 To $iFireworks - 1 ;generated firework particles GenCoordinates($iY, $aCoords, 1.5, 3.5, 1, 5.5) If $bAudio Then $aAudio[$iY][0] = _BASS_StreamCreateFile(False, @ScriptDir & "\" & Random(1, 7, 1) & ".mp3", 0, 0, 0) $aAudio[$iY][1] = 0 EndIf Next $hAudio_Whoa = _BASS_StreamCreateFile(False, @ScriptDir & "\ApplauseWoah.mp3", 0, 0, 0) $hAudio_BgNoise = _BASS_StreamCreateFile(False, @ScriptDir & "\BgNoise.mp3", 0, 0, 0) _BASS_ChannelPlay($hAudio_BgNoise, True) $iFPS = 0 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") AdlibRegister("CalcFPS", 1000) Local $iAlpha, $iCounterFX = 0, $iCounterParticles = 0 $fTimer = TimerInit() Do DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush_Clr, "float", 0, "float", 0, _ "float", $iW, "float", $iH) ;erase canvas background _GDIPlus_GraphicsDrawStringEx($hCanvas, "Happy new year 2016", $hFont, $tLayout, $hFormat, $hBrush_Txt) ;draw background message text For $iY = 0 To $iFireworks - 1 ;calculate and draw firework particles If $aCoords[$iY][1] > $aCoords[$iY][4] Then ;draw rocket only until explosion $aCoords[$iY][0] += $aCoords[$iY][2] ;x vector $aCoords[$iY][1] -= Abs($aCoords[$iY][3] * 10) ;y vector should be in upper direction only _GDIPlus_BrushSetSolidColor($hBrush, 0x60909090) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hCanvas, "handle", $hBrush, "float", $aCoords[$iY][0], "float", $aCoords[$iY][1], "float", 2, "float", 2) $iCounterParticles += 1 For $iX = $iElements To UBound($aCoords, 2) - 5 Step 4 $aCoords[$iY][$iX] = $aCoords[$iY][0] ;copy x position $aCoords[$iY][$iX + 1] = $aCoords[$iY][1] ;copy y position Next Else For $iX = $iElements To UBound($aCoords, 2) - 5 Step 4 $aCoords[$iY][$iX] += $aCoords[$iY][$iX + 2] ;x coordinate $aCoords[$iY][$iX + 1] += $aCoords[$iY][$iX + 3] + $aCoords[$iY][8] ;y coordinate $aCoords[$iY][$iX + 2] *= 0.98 ;neg. accelaration of x vector $aCoords[$iY][$iX + 3] *= 0.98 ;neg. accelaration of y vector $iAlpha = $aCoords[$iY][6] > 0xFF ? 0xFF : $aCoords[$iY][6] Switch $aCoords[$iY][7] ;choose color mode Case 0 To 3 _GDIPlus_BrushSetSolidColor($hBrush, Int($iAlpha) * 0x1000000 + $aCoords[$iY][5]) Case Else Switch Mod($j, 3) Case 0 _GDIPlus_BrushSetSolidColor($hBrush, Int($iAlpha) * 0x1000000 + 0x10000 * Random(0xD0, 0xFF, 1) + 0x100 * Random(0xD0, 0xFF, 1) + Random(0xD0, 0xFF, 1)) Case Else _GDIPlus_BrushSetSolidColor($hBrush, Int($iAlpha) * 0x1000000 + 0x10000 * Random(0x40, 0xA0, 1) + 0x100 * Random(0x40, 0xA0, 1) + Random(0x40, 0xA0, 1)) EndSwitch $j += 1 EndSwitch ;draw only visible particles If BitAND($aCoords[$iY][$iX] > -1, $aCoords[$iY][$iX] < $iW, $aCoords[$iY][$iX + 1] > -1, $aCoords[$iY][$iX + 1] < $iH) Then DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hCanvas, "handle", $hBrush, _ "float", $aCoords[$iY][$iX], "float", $aCoords[$iY][$iX + 1], _ "float", $iParticleSize, "float", $iParticleSize) ;draw firework particles $iCounterParticles += 1 EndIf Next $aCoords[$iY][6] *= 0.933 ;decrease alpha channel $aCoords[$iY][8] *= 1.075 ;gravity accelaration (y axis) -> earth's gravitational force simulation If Not $aAudio[$iY][1] And $bAudio Then ;play audio fx _BASS_ChannelPlay($aAudio[$iY][0], False) $aAudio[$iY][1] = 1 $iCounterFX += 1 EndIf If $aCoords[$iY][6] < 0x08 Then ;reset firework elements $aAudio[$iY][1] = 0 GenCoordinates($iY, $aCoords) EndIf EndIf Next If $iCounterFX > 2 Then _BASS_ChannelPlay($hAudio_Whoa, False) EndIf _GDIPlus_GraphicsDrawStringEx($hCanvas, "FPS: " & $iShowFPS & @CRLF & "Particles: " & $iCounterParticles, $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) ;draw background message text _WinAPI_BitBlt($hDC, 0, 0, $iW, $iH, $hDC_backbuffer, 0, 0, $SRCCOPY) ;blit drawn bitmap to GUI $iCounterFX = 0 $iCounterParticles = 0 $iFPS += 1 $iFrames += 1 If $bExit Then ExitLoop Until Not Sleep(10) AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_FontDispose($hFont) _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_Txt) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC, $DC_obj) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete($hGUI) If $bAudio Then For $iY = 0 To $iFireworks - 1 _BASS_ChannelStop($aAudio[$iY][0]) Next _BASS_ChannelStop($hAudio_Whoa) _BASS_ChannelStop($hAudio_BgNoise) _BASS_Free() EndIf EndFunc ;==>GDIPlus_SimpleFirework Func GenCoordinates($iY, ByRef $aCoords, $fVXmin = 2.5, $fVXmax = 15.5, $fVYmin = 1.5, $fVYmax = 5.5) Local $aColors[7] = [0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF7514, 0xFFFFFF, 0x40E0D0] $aCoords[$iY][0] = $iWh ;x coordinate (x coordinate of starting point) $aCoords[$iY][1] = $iH ;y coordinate (y coordinate of starting point) $aCoords[$iY][2] = Random($fVXmin, $fVXmax) * (Random(0, 1, 1) = 0 ? -1 : 1) ;x vector (direction of rocket) $aCoords[$iY][3] = Random($fVYmin, $fVYmax) * (Random(0, 1, 1) = 0 ? -1 : 1) ;y vector (direction of rocket) $aCoords[$iY][4] = Random($iH * 0.15, $iH * 0.35) ;area of detonation ;~ $aCoords[$iY][5] = 0x10000 * Random(0x40, 0xE0, 1) + 0x100 * Random(0x40, 0xE0, 1) + Random(0x40, 0xE0, 1) ;random color $aCoords[$iY][5] = $aColors[Random(0, 6, 1)] ;random color $aCoords[$iY][6] = 0x250 ;alpha channel value $aCoords[$iY][7] = Random(0, 8, 1) ;value for color mode $aCoords[$iY][8] = 0.15 ;gravity accelaration (y axis) initial value Local $iX, $fSpeed, $fRadius, $iFX = Random(1, 20, 1), $e = Random(5, 25), $h = 0, $g = 360 / ($iMaxParticles - 1), _ $j = 360 / 10, $jj = $j, $k = Random(0.5, 1.5), $kk = Random(1, 3.5), $l = 0 For $iX = $iElements To UBound($aCoords, 2) - 5 Step +4 Switch $iFX Case 1 To 3 $fSpeed = Cos($g * $iFX * $e * $iX) * $e $fRadius = $fSpeed / 2 Case 4 To 6 $fSpeed = Sin($iX / 7.85) * $e ;particle speed (explosion strength) $fRadius = $fSpeed / 2 Case 7 To 9 $fSpeed = Tan($iX / 2) + $e ;particle speed (explosion strength) $fRadius = $fSpeed / 2 Case 10 To 12 $fSpeed = Cos($iX / 2.5) + $e ;particle speed (explosion strength) $fRadius = $fSpeed / 2 Case 13 To 15 ;create circular effect $fSpeed = Random($e, $e + 0.333333) ;particle speed (explosion strength) $fRadius = $fSpeed / 2 Case 16 To 18 $fSpeed = $e $fRadius = $k $h = $jj $jj += $j If $jj > 360 Then $jj = $j - $l $k += $kk $l += Random(1, 15) EndIf Case Else $fSpeed = Random(5, 25) ;particle speed (explosion strength) $fRadius = $fSpeed / 2 EndSwitch $aCoords[$iY][$iX + 2] = ($fSpeed + Cos($h * $fRad) * $fRadius) - $fSpeed ;x vector particle speed $aCoords[$iY][$iX + 3] = ($fSpeed + Sin($h * $fRad) * $fRadius) - $fSpeed ;y vector particle speed $h += $g ;next angle Next EndFunc ;==>GenCoordinates Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS & " / Ø " & Round($iFrames / TimerDiff($fTimer) * 1000, 4) $iFPS = 0 EndFunc ;==>CalcFPS Sound FX and other files are in the archive only! Sounds best with earphones Speed: ~17 FPS on Intel Core i5 4300U @ 2.6 GHz CPU (1600x900). If it is too slow on your machine decrease the values for $iMaxParticles and $iFireworks. Download available in download section. Use e.g. 7-Zip to open archive. Happy new year...
    4 points
  3. suppose your program has a service-like functionality, i.e. launch at Windows startup, constantly running in the background, no GUI (e.g. TCP server). you could write it as a service (with this marvelous UDF), or you could install it as a scheduled task. Windows Task Scheduler has an API, and is also manageable by WMI. but if you are not a seasoned developer, the simplest way is to call schtasks.exe to create the task (as well as validate and run it). unfortunately, schtasks.exe does not directly support all options and settings of a task. tasks created by schtasks.exe have some undesirable settings enabled by default, such as "Start the task only if the computer is on AC power", "Stop if the computer switches to battery power", and the most annoying is of course, "Stop the task if it runs longer than 3 days". to overcome this, we write an XML file with the desired options configured, and call schtasks.exe to create the task by that XML file. this topic uses two files: 1) the tasked script itself, which - in this example - is used only to log the used and free space of the system drive: #RequireAdmin #AutoIt3Wrapper_Res_Fileversion=0.0.0.0 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Change2CUI=Y #NoTrayIcon Global $sDrive = StringLeft(@WindowsDir, 3) Global $sFile = $sDrive & 'Au3task_VolLog.csv' Global $sLastMinute = '' Global $nDriveSpaceTotal=0 Global $nDriveSpaceFree=0 While True If Not FileExists($sFile) Then FileWriteLine($sFile, 'Time,Used Space [MB],Free Space [MB]') If @SEC = '00' And @MIN <> $sLastMinute Then $nDriveSpaceTotal=Round(DriveSpaceTotal($sDrive)) $nDriveSpaceFree=Round(DriveSpaceFree($sDrive)) FileWriteLine($sFile, @YEAR & '/' & @MON & '/' & @MDAY & ' ' & @HOUR & ':' & @MIN & ':' & @SEC & ',' & $nDriveSpaceTotal - $nDriveSpaceFree & ',' & $nDriveSpaceFree) $sLastMinute = @MIN EndIf Sleep(100) WEnd compile this script and name it au3@task.exe to run the example setup script hereunder. note the wrapper directives!. 2) the setup script (which you can run without compiling). this installs the compiled task above to the root of the system drive, and configures a task to run it at startup as the local SYSTEM account: (EDIT: updated setup script with a subfolder for the task is in post #2 hereunder) #RequireAdmin #AutoIt3Wrapper_Res_Fileversion=0.0.0.0 #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_UseX64=y #NoTrayIcon #include <MsgBoxConstants.au3> Global $sTitle = 'au3@task Setup' Global $sDrive = StringLeft(@WindowsDir, 3) Global $sTaskName = 'au3@task' If AlreadyInstalled() Then If MsgBox($MB_ICONQUESTION + $MB_YESNO, $sTitle, 'Uninstall? ') = $IDYES Then If Uninstall() Then MsgBox($MB_ICONINFORMATION, $sTitle, 'Uninstallation completed successfully. ') Else MsgBox($MB_ICONERROR, $sTitle, 'Uninstallation error. ') EndIf Else MsgBox($MB_ICONINFORMATION, $sTitle, 'Uninstallation aborted. ') EndIf Else If MsgBox($MB_ICONQUESTION + $MB_YESNO, $sTitle, 'Install? ') = $IDYES Then If Install() Then If MsgBox($MB_ICONQUESTION + $MB_YESNO, $sTitle, 'Installation completed successfully. Run task now? ') = $IDYES Then If RunWait('schtasks.exe /Run /TN ' & $sTaskName, '', @SW_HIDE) = 0 Then MsgBox($MB_ICONINFORMATION, $sTitle, 'Task is running. ') Else MsgBox($MB_ICONERROR, $sTitle, 'Error running the task. ') EndIf Else MsgBox($MB_ICONINFORMATION, $sTitle, 'Done. ') EndIf Else MsgBox($MB_ICONERROR, $sTitle, 'Installation error. ') EndIf Else MsgBox($MB_ICONINFORMATION, $sTitle, 'Installation aborted. ') EndIf EndIf Func AlreadyInstalled() If Not FileExists($sDrive & 'au3@task.exe') Then Return False If RunWait('schtasks.exe /Query /TN ' & $sTaskName, '', @SW_HIDE) <> 0 Then Return False Return True EndFunc ;==>AlreadyInstalled Func Install() If Not FileInstall('au3@task.exe', $sDrive, 1) Then Return False Local $sXML = _ '<?xml version="1.0" encoding="UTF-16"?>' & @CRLF & _ '<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">' & @CRLF & _ ' <Triggers>' & @CRLF & _ ' <BootTrigger>' & @CRLF & _ ' <Enabled>true</Enabled>' & @CRLF & _ ' </BootTrigger>' & @CRLF & _ ' </Triggers>' & @CRLF & _ ' <Principals>' & @CRLF & _ ' <Principal id="Author">' & @CRLF & _ ' <UserId>S-1-5-18</UserId>' & @CRLF & _ ' <RunLevel>HighestAvailable</RunLevel>' & @CRLF & _ ' </Principal>' & @CRLF & _ ' </Principals>' & @CRLF & _ ' <Settings>' & @CRLF & _ ' <MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>' & @CRLF & _ ' <DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>' & @CRLF & _ ' <StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>' & @CRLF & _ ' <AllowHardTerminate>false</AllowHardTerminate>' & @CRLF & _ ' <StartWhenAvailable>false</StartWhenAvailable>' & @CRLF & _ ' <RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>' & @CRLF & _ ' <IdleSettings>' & @CRLF & _ ' <StopOnIdleEnd>true</StopOnIdleEnd>' & @CRLF & _ ' <RestartOnIdle>false</RestartOnIdle>' & @CRLF & _ ' </IdleSettings>' & @CRLF & _ ' <AllowStartOnDemand>true</AllowStartOnDemand>' & @CRLF & _ ' <Enabled>true</Enabled>' & @CRLF & _ ' <Hidden>false</Hidden>' & @CRLF & _ ' <RunOnlyIfIdle>false</RunOnlyIfIdle>' & @CRLF & _ ' <WakeToRun>false</WakeToRun>' & @CRLF & _ ' <ExecutionTimeLimit>PT0S</ExecutionTimeLimit>' & @CRLF & _ ' <Priority>7</Priority>' & @CRLF & _ ' </Settings>' & @CRLF & _ ' <Actions Context="Author">' & @CRLF & _ ' <Exec>' & @CRLF & _ ' <Command>ExePath</Command>' & @CRLF & _ ' </Exec>' & @CRLF & _ ' </Actions>' & @CRLF & _ '</Task>' $sXML = StringReplace($sXML, 'ExePath', $sDrive & 'au3@task.exe') Local $sFileXML = @TempDir & '\au3@task.xml' FileDelete($sFileXML) FileWrite($sFileXML, $sXML) If FileRead($sFileXML) <> $sXML Then Return False If RunWait('schtasks.exe /Create /XML "' & $sFileXML & '" /TN ' & $sTaskName, '', @SW_HIDE) <> 0 Then Return False FileDelete($sFileXML) Return True EndFunc ;==>Install Func Uninstall() RunWait('schtasks.exe /End /TN ' & $sTaskName, '', @SW_HIDE) If RunWait('schtasks.exe /Delete /F /TN ' & $sTaskName, '', @SW_HIDE) <> 0 Then Return False Sleep(3000) If Not FileDelete($sDrive & 'au3@task.exe') Then Return False Return True EndFunc ;==>Uninstall note: the XML file embedded in the script was exported from a task already configured with the required options. the registration components were stripped. if you wish to configure other settings, you can study the XML schema, or simply configure a task manually and export it to XML. tested on Windows 7 Ultimate 64-bit. enjoy!
    1 point
  4. If the color you're looking for is red $color_to_find = 0xFFFF0000 0xFF = no transparency, FF0000 = Red
    1 point
  5. Just a heads up, _GDIPlus_BitmapGetPixel returns the alpha channel too (the transparency) so it would be formatted 0xFF000000 and 0x00000000
    1 point
  6. You can use GDIPlus _GDIPlus_BitmapGetPixel to get the pixel color in a memory object. I think ImageSearchDLL.dll has a function that lets you search in hBitmap (Like ImageSearchEx instead of just ImageSearch. I can't confirm this, I just think I saw something about this) Look at the _GDIPlus_BitmapGetPixel in the help file, and you could do your own shade variation by subtracting/adding your tolerance to the color to find It would look something like $pixel_color = Hex(_GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY), 8) If ($pixel_color < Hex($color_to_find + $color_tolerance, 8) and $pixel_color > Hex($color_to_find - $color_tolerance, 8)) Then(I think my math is right on that, you might want to double check that)
    1 point
  7. @argumentum: you're not a pain, argumentum, you helped to improve the E4A environment, so thank you! Re. MV's fixed path, I was recently changing that module's internals, and I guess I forgot to remove my own hard-coded patches (you may have noticed the remark "; TESTING <<<<<<<<<<<<<<<<<<<" right above it; the original line was immediately below it, commented out, but your own fix does the trick too, of course). I'll try to be more careful next year (but you know how it is with new year's resolutions...). MV/MatrixViewer's reliance on Eigen4AutoIt.au3 also means that I cannot supply those as precompiled exes in future, hmmmm... Re. $EIGEN_DLLPATH, this is intentional. I require the user to go into Eigen4AutoIt.au3 once and edit that path manually, so the copyright message has to be consciously encountered. You can store an explicit path there instead, or do something fancier, as you did. But this one is not an oversight. And it's very nice to hear that you like E4A, much appreciated; I spent a lot of time figuring out its fundamental structure before coding a single line, which is quite different from Eigen's own approach in some respects (no vector definitions, no dinstinction between arrays and matrices, coming up with consistent, predictable function names, alias wrappers, and so forth). Hope it is helpful in some way (see the Tutorials and test scripts to get a handle on the possibilities). PS re-patched v2.5 uploaded.
    1 point
  8. What's on fire? Do you seriously think people can help you when you are this vague? So, when you want us to see whether we can help, you better start giving all details of what you want to do and, more importantly, what you already have tried. Jos Jos
    1 point
  9. I don't quite understand, the Imagesearch function and PixelSearch do exactly what you're asking. What are you trying to automate?
    1 point
  10. An updated version 2.5 is now available, which should work without requiring additional msvcr* dlls. I managed to recompile static versions of both IrrlichtWrapper and Irrlicht (in the updated bundle), but had to disable DX8 and DX9 support in the latter (tried various ancient SDKs to find a number of missing header files, to no avail; E4A uses OpenGL, so it's not needed here anyway). Ergo, these Irrlicht dll's are not for general Irrlicht usage, so please do not complain if you use them elsewhere and then discover that the DirectX 3D rendering doesn't work, because it's slightly absenterino. I also spotted (and cleaned up) some stray test messages I'd accidentally left in the MV module. Apologies to anyone who already downloaded v2.5...
    1 point
  11. Hello. #include <WinAPI.au3> _ForceRemove("anydll.dll") Func _ForceRemove($sModuleName) Local $hModule=_winapi_GetModuleHandle($sModuleName) If Not $hModule then Return Do ;Some sleep if is needed Until _winapi_FreeLibrary($hModule)=True EndFunc Saludos
    1 point
  12. Use MsgBox instead of ConsoleWrite
    1 point
  13. wakillon

    Calendar Select

    No need to get the ctrl bkground color ! #Region ;************ Includes ************ #include <GuiConstantsEx.au3> #include <WinAPIGdi.au3> #EndRegion ;************ Includes ************ Opt ( 'MustDeclareVars', 1 ) Global $icontrol, $iNumber, $hGUI, $Button1, $Button2, $msg, $iDayCount = 31 $hGUI = GUICreate("Select days of the month", 290, 260, -1, -1) GUISetFont(9, 0, 4, "Comic Sans MS", 2) $Button1 = GUICtrlCreateButton("Return", 55, 210, 80, 40) $Button2 = GUICtrlCreateButton("Cancel", 160, 210, 80, 40) Local $IX = 10, $IY = 10 Dim $aRcntrls[$iDayCount+1][3] For $i = 1 To $iDayCount If $IX = 290 Then $IX = 10 $IY += 40 EndIf $aRcntrls[$i][0] = GUICtrlCreateGraphic($IX, $IY, 30, 30) $aRcntrls[$i][1] = GUICtrlGetHandle($aRcntrls[$i][0]) GUICtrlSetBkColor(-1, 0xffffff) GUICtrlCreateLabel($i, $IX + 4, $IY + 4, 22, 22) GUICtrlSetBkColor(-1, 0xffffff) If Mod ( $i -1, 3 ) = 0 Then GUICtrlSetBkColor ( $aRcntrls[$i][0], 0X1BDC8 ) GUICtrlSetBkColor ( $aRcntrls[$i][0] +1, 0X1BDC8 ) $aRcntrls[$i][2] = True EndIf $IX += 40 Next GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $Button2 $aRcntrls = 0 Exit Case $Button1 $icontrol = "" For $i = 1 To $iDayCount If $aRcntrls[$i][2] Then $icontrol &= $i & "," Next MsgBox(0, "", StringTrimRight($icontrol, 1)) Case $aRcntrls[1][0] To $aRcntrls[$iDayCount][0] For $i = 1 To $iDayCount If $msg = $aRcntrls[$i][0] Then If $aRcntrls[$i][2] = True Then $aRcntrls[$i][2] = "" GUICtrlSetBkColor($aRcntrls[$i][0], 0xffffff) GUICtrlSetBkColor($aRcntrls[$i][0] + 1, 0xffffff) Else GUICtrlSetBkColor($aRcntrls[$i][0], 0X1BDC8) GUICtrlSetBkColor($aRcntrls[$i][0] + 1, 0X1BDC8) $aRcntrls[$i][2] = True EndIf EndIf Next EndSwitch Sleep ( 10 ) WEnd
    1 point
  14. trancexx

    API Upload XML WinHttp

    $sFileToUpload = "C:\Users\Arlen\Desktop\premisa mrotal.txt" $XML = '<form method="post" action="' & $sURL & '" enctype="multipart/form-data">' & @CRLF $XML &= '<input type="hidden" name="MAX_FILE_SIZE" >' & @CRLF $XML &= '<input type="hidden" name="UPLOAD_IDENTIFIER" >' & @CRLF $XML &= '<input type="hidden" name="extra_info" >' & @CRLF $XML &= '<input type="file" name="userfile" >' & @CRLF $XML &= '</form>' $hConnect = $XML ;<!!! ; Fill the form $sHTML = _WinHttpSimpleFormFill($hConnect, $hOpen, _ Default, _ "name:MAX_FILE_SIZE", $sMaxFileSize, _ "name:UPLOAD_IDENTIFIER", $sUpload_Identifier, _ "name:extra_info", $sExtraInfo, _ "name:userfile", $sFileToUpload) ;...
    1 point
  15. Seriously? You're going to post that? Did you even LOOK in the file WinAPIvkeysConstants.au3? Instead of asking the question, wouldn't it have been MUCH faster to TEST it? Then you would have known that wasn't what I suggested at all.
    1 point
  16. If you only want to send fgh, use this (or add in the d on the send)...if you DON'T want to wait for the control to be unpressed, then delete the first 2 _isPressed: Run("Notepad") HotKeySet("^d", "_dfgh") ;ctrl and d. using a key you are sending will render you in an awkward loop While 3 Sleep(333) ;keep script alive WEnd Func _dfgh() While _IsPressed("A2") Or _IsPressed("A3") Or _IsPressed("44") WEnd Send("fgh") EndFuncActually, this works well: Run("Notepad") HotKeySet("^d", "_dfgh") ;ctrl and d. using a key you are sending will render you in an awkward loop While 3 Sleep(333) ;keep script alive WEnd Func _dfgh() While (_IsPressed("A2") Or _IsPressed("A3")) And _IsPressed("44") WEnd Send("fgh") EndFunc
    1 point
  17. mLipok

    dBase udf and dll

    QUESTIONS: Who is the license owner for attached DLL ? What type of license is for this DLL ? btw. Pretty good UDF One remark: for the functions header use the standard headers you can add this using SciTE4AutoIt by pressing CTRL+ALT+H
    1 point
  18. wakillon

    SDL2 Let It Snow

    A little try with SDL 2 Library and SDL 2 GFX. SDL2_Let It Snow.au3 Press "Esc" for quit. Edit : SDL2.dll and SDL2-Gfx.dll are now located in the tempdir and not called in memory.
    1 point
×
×
  • Create New...