Leaderboard
Popular Content
Showing content with the highest reputation on 06/13/2014 in all areas
-
Few years ago Microsoft introduced new UI feature that they named Ribbon. With the release of Windows 7 they added it as standard system feature. Windows Ribbon framework. You could say it's a new technology waiting to be fully embraced. Considering AutoIt is currently in some shitty stage Ribbons are not expected to be supported natively. Which is actually good thing because otherwise some developer could have GUICtrlCreateRibbon idiotic idea. Ribbons are beautiful things. In order to work with them you have to master objects. It's COM based technology. Some people will stop reading now, but really their shame. Anyway, this example is based on work by Mr. Michael Chourdakis. Guy really took deeper dive to ribbon thematic and made few very interesting articles. All is available on internet naturally, just google Michael Chourdakis Ribbon or something like that. So, the main thing to do is create so called Ribbon Framework Object. After that you have to initialize event handlers (two callback objects made with ObjectFromTag function) and load your Ribbon. Ribbon is loaded from resource, either one of your app or some other. I have compiled resource dll for this example so that scripts could be run non-compiled and still use ribbon command bar. Example shown here is not completely dummy, it uses all of the ribbon controls. Only it doesn't do anything smart besides that. ZIP: Ribbon.zip Inside the zip there is folder called Ribbon with two files RibbonExample_NEW.au3 and RibRes.dll. Extract that folder somewhere, run RibbonExample_NEW.au3 and enjoy the Ribbon beauty. There are few comments inline for easier comprehension of the overall script code. Thanks Andreik for asking for more.1 point
-
Hello World! (always wanted to say that) Wrote this when I needed low-level access to unmountable parts of a physical drive. The resulting UDF is BuildPartitionTable, and takes as single argument a designated physical drive ID, for example: BuildPartitionTable(".physicaldrive0") for your first harddisk. This UDF scans a physical drive's partition table to fill three partition-related arrays: partition_table extracted from the MBR and its linked list(s) allocation_table entire disk mapping volumes_table subset of $allocation_table with volumes only It does NOT alter your data or drives; it just reads and reports. BuildPartitionTable.v1.1.zip (AutoIt 3.3.12-1 compliant updated version, with small example) You can use the UDF's output for low-level drive I/O (use at your own risk!), for example (NB code for this is not included): identify unallocated regions for space optimisation or hidden storage (listed in allocation table array) resize/remove existing partitions change which single partition is primary (i.e., used for booting) change an existing partition's type add new partitions of any type hide/unhide logical volumes (simply set/reset bit4 of a volume's Partition_Type in its (E)MBR partition entry) It should in theory be able to handle many types of MBR partition tables, not just Microsoft-approved ones. If you're going to analyse Linux MBRs or ancient tech, you may want to replace internal calls to _Partition_type_string() (DOS/Microsoft only) to its internal alternative _Partition_Anytype_string(), which supports many types I'd never heard of before (but results can be unreliable). Furthermore, you may be puzzled by references in the annotations to my "FATsuite UDF". Please follow the link in my signature if you wish to know more. Should the script crash or produce wrong results at your end, there's unfortunately not much I can do at this end, since the problem is likely related to the specific hardware you're testing. Of course, I'll try to fix whatever bugs I am able to reproduce... Hope it helps! RT1 point
-
Yep, 7 months later and I finally did it! It's a UDF for creating uncompressed avi:s from bitmap files (support for compressing the video, may or may not appear). The structure is very easy: Start the avi libraryCreate a avi fileAdd bitmaps to itClose the aviStop the avi libraryDownload:AVIWriter.au3 Previous downloads: 55 Example: ; Example by ProgAndy #include <ScreenCapture.au3> #include "AVIWriter.au3" Hotkeyset("{ESC}","close") Break(0) FileDelete(@DesktopDir & "\test.avi") _StartAviLibrary() $avi = _CreateAvi(@DesktopDir & "\test.avi", 5,200,200) Do $m = MouseGetPos() $hBmp = _ScreenCapture_Capture("", $m[0] - 100, $m[1] - 100, $m[0] + 100, $m[1] + 100, True) _AddHBitmapToAvi($avi, $hBmp) _WinAPI_DeleteObject($hBmp) Sleep(200) Until False Func close() _CloseAvi($avi) _StopAviLibrary() exit EndFunc;==>close Enjoy! Link to FireFox's AviScreencapture tool that relies on this udf.1 point
-
You forgot _GDIPlus_BitmapDispose($hMask) in function _GDIPlus_drawMoonPhase. Br, UEZ1 point
-
Best method to test area for color
undefinedspace reacted to bootybay for a topic
PixelSearch is using an DEC value as color afaik. But yours is HEX. #include <Debug.au3> _DebugSetup() call(testpixelsearch()) Func testpixelsearch() Local $aarray = MouseGetPos() Local $color = PixelGetColor($aarray[0], $aarray[1]) Local $shadecycle = 1 Do PixelSearch($aarray[0] - 5, $aarray[1] - 5, $aarray[0] + 5, $aarray[1] + 5, $color, $shadecycle) If @error = 0 Then ExitLoop $shadecycle += 1 Until 1 _DebugOut($shadecycle & ", " & $color & ", " & $aarray[0] & ", " & $aarray[1]) EndFunc ;==>testpixelsearch This works like a charm for me. Always on the first shadecycle whereever my mouse hovering over.1 point -
mentosan, We could have saved a lotof time if you had listened to advice I gave you in post #2. Create an ini file "Config.ini" in the same folder as your script: [SSID] 1=SSID_1 2=SSID_2 3=SSID_3 4=SSID_4 [Password] 1=PASS_1 2=PASS_2 3=PASS_3 4=PASS_4 Then start your script as follows: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> $sIni = "Config.ini" $sSSID = "" $aSSID = IniReadSection($sIni, "SSID") For $i = 1 To $aSSID[0][0] $sSSID &= "|" & $aSSID[$i][1] Next $sPass = "" $aPass = IniReadSection($sIni, "Password") For $i = 1 To $aPass[0][0] $sPass &= "|" & $aPass[$i][1] Next $hGUI = GUICreate("Test", 500, 500) ; and continue as before Now you have the ini values appearing in the combos. M231 point
-
mentosan, It seems the crystal ball is working well today - here is an example of the sort of combos you will need: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global $sSSID = "SSID_1|SSID_2|SSID_3" Global $sPass = "Pass_1|Pass_2|Pass_3" $hGUI = GUICreate("Test", 500, 500) GUICtrlCreateLabel("SSID:", 10, 10, 200, 20) $cCombo_SSID = GUICtrlCreateCombo("", 10, 30, 200, 20) GUICtrlSetData($cCombo_SSID, $sSSID) GUICtrlCreateLabel("Password:", 10, 60, 200, 20) $cCombo_Pass = GUICtrlCreateCombo("", 10, 80, 200, 20) GUICtrlSetData($cCombo_Pass, $sPass) $cStart = GUICtrlCreateButton("Start", 10, 200, 80, 30) $cStop = GUICtrlCreateButton("Stop", 100, 200, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cStart $sSSID_To_Use = GUICtrlRead($cCombo_SSID) $sPass_To_Use = GUICtrlRead($cCombo_Pass) If $sSSID_To_Use = "" Or $sPass_To_Use = "" Then MsgBox($MB_SYSTEMMODAL, "Error", "Please select both an SSID and a Password") Else MsgBox($MB_SYSTEMMODAL, "OK", "You selected:" & @CRLF & "SSID: " & $sSSID_To_Use & @CRLF & "Password: " & $sPass_To_Use) EndIf EndSwitch WEnd Press the "Start" button to see how it works. Please ask if you have any questions. M231 point
-
Many Thanks I will update the @error -1 no received data to @extended = -1 Cheers1 point
-
1 point
-
Thats it!!!!! I knew it was something simple. THANK YOU!1 point
-
Try: $text = FileReadLine ( $file, 1 ) MsgBox (1, "Hand Off 2 Complete", "yeah") $command = '"C:\Program Files\Optos\Optomap Applications\Capture2.exe"' Run ($command & " " & $text) FileClose ($file)1 point
-
#include "AVIWriter.au3" #include <GDIPlus.au3> Global $count, $hBmp _StartAviLibrary() _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile(@DesktopDir & "\aaz\1.jpg") $Width = _GDIPlus_ImageGetWidth($hImage) $Height = _GDIPlus_ImageGetHeight($hImage) $avi = _CreateAvi(@DesktopDir & "\test.avi", 5, $Width, $Height) For $count = 1 to 100 $hImage = _GDIPlus_ImageLoadFromFile(@DesktopDir & "\aaz\" & $count & ".jpg") $hBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _AddHBitmapToAvi($avi, $hBmp) _WinAPI_DeleteObject($hBmp) Sleep(100) next _GDIPlus_ImageDispose($hImage) _WinAPI_DeleteObject($hBmp) _GDIPlus_Shutdown() _CloseAvi($avi) _StopAviLibrary() exit1 point
-
How do you call this? Sprinkler? (Cleaning on exit and added monocereses $WM_PAINT that I read today) #NoTrayIcon Opt("GUIOnEventMode", 1) Global Const $GL_VERSION_1_1 = 1 Global Const $PFD_TYPE_RGBA = 0 Global Const $PFD_MAIN_PLANE = 0 Global Const $PFD_DOUBLEBUFFER = 1 Global Const $PFD_DRAW_TO_WINDOW = 4 Global Const $PFD_SUPPORT_OPENGL = 32 Global Const $GL_PROJECTION = 0x1701 Global Const $GL_COLOR_BUFFER_BIT = 0x00004000 Global Const $GL_LINES = 0x0001 Global Const $GL_SRC_COLOR = 0x0300 Global Const $GL_DST_COLOR = 0x0306 Global Const $GL_BLEND = 0x0BE2 Global Const $GL_MODELVIEW = 0x1700 Global Const $GL_DEPTH_BUFFER_BIT = 0x00000100 Global $gui = GUICreate("OpenGL", 445, 445) GUISetBkColor(0x000000) Global $dc, $rc EnableOpenGL($gui, $dc, $rc) glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)) ; initially cleaning buffers glBlendFunc($GL_SRC_COLOR, $GL_DST_COLOR) glEnable($GL_BLEND) glViewport(0, 0, 445, 445) GUISetState(@SW_SHOW, $gui) GUIRegisterMsg(0x000F, "Preserve"); $WM_PAINT GUISetOnEvent(-3, "Quit") Global $m While 1 GLDraw() $m += .0003 Sleep(10) WEnd Func GLDraw() glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)) glBegin($GL_LINES) For $i = 1 To 10 $i += 2 * ($m > .08) + 3 * ($m > .1) If $m < .12 Then $s = Random(-9, 9, 1) / 32 $t = Random(-9, 9, 1) / 35 glColor3f(1, 0, 0) glVertex2d(-$m, -2 * $m) glColor3f(0, 1, 1) glVertex2d($s - $m, $t - 2 * $m) If Not Mod(1000 * $m, 35) Then glColor3f(1, 0, 0) glVertex2d(-$m, -2 * $m) glColor3f(0, 1, 1) glVertex2d(2 * $s - $m, 2 * $t - 2 * $m) EndIf EndIf Next glColor3f(1, .3, 0) glVertex2d(0, 0) glColor3f(0, 0, 1) glVertex2d(-.25, -.5) glEnd() SwapBuffers($dc) EndFunc ;==>GLDraw Func EnableOpenGL($hwnd, ByRef $hDC, ByRef $hRC) Local $pfd = DllStructCreate("short nSize;" & _ "short nVersion;" & _ "dword dwFlags;" & _ "byte iPixelType;" & _ "byte cColorBits;" & _ "byte cRedBits;" & _ "byte cRedShift;" & _ "byte cGreenBits;" & _ "byte cGreenShift;" & _ "byte cBlueBits;" & _ "byte cBlueShift;" & _ "byte cAlphaBits;" & _ "byte cAlphaShift;" & _ "byte cAccumBits;" & _ "byte cAccumRedBits;" & _ "byte cAccumGreenBits;" & _ "byte cAccumBlueBits;" & _ "byte cAccumAlphaBits;" & _ "byte cDepthBits;" & _ "byte cStencilBits;" & _ "byte cAuxBuffers;" & _ "byte iLayerType;" & _ "byte bReserved;" & _ "dword dwLayerMask;" & _ "dword dwVisibleMask;" & _ "dword dwDamageMask;") Local $h_dc = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hwnd) DllStructSetData($pfd, "nSize", DllStructGetSize($pfd)) DllStructSetData($pfd, "nVersion", $GL_VERSION_1_1) DllStructSetData($pfd, "dwFlags", BitOR($PFD_DRAW_TO_WINDOW, $PFD_SUPPORT_OPENGL, $PFD_DOUBLEBUFFER)) DllStructSetData($pfd, "iPixelType", $PFD_TYPE_RGBA) DllStructSetData($pfd, "cColorBits", 24) DllStructSetData($pfd, "cDepthBits", 32) DllStructSetData($pfd, "iLayerType", $PFD_MAIN_PLANE) DllOpen("gdi32.dll") DllOpen("opengl32.dll") Local $iFormat = DllCall("gdi32.dll", "int", "ChoosePixelFormat", "hwnd", $h_dc[0], "ptr", DllStructGetPtr($pfd)) Local $iSetFormat = DllCall("gdi32.dll", "int", "SetPixelFormat", "hwnd", $h_dc[0], "int", $iFormat[0], "ptr", DllStructGetPtr($pfd)) Local $h_cont = DllCall("opengl32.dll", "hwnd", "wglCreateContext", "hwnd", $h_dc[0]) Local $iRet = DllCall("opengl32.dll", "int", "wglMakeCurrent", "int", $h_dc[0], "int", $h_cont[0]) $hDC = $h_dc[0] $hRC = $h_cont[0] Return 1 EndFunc ;==>EnableOpenGL Func glVertex2d($x, $y) DllCall("opengl32.dll", "none", "glVertex2d", "double", $x, "double", $y) EndFunc ;==>glVertex2d Func glBegin($mode) DllCall("opengl32.dll", "none", "glBegin", "uint", $mode) EndFunc ;==>glBegin Func glClear($mask) DllCall("opengl32.dll", "none", "glClear", "uint", $mask) EndFunc ;==>glClear Func glColor3f($red, $green, $blue) DllCall("opengl32.dll", "none", "glColor3f", "float", $red, "float", $green, "float", $blue) EndFunc ;==>glColor3f Func glEnd() DllCall("opengl32.dll", "none", "glEnd") EndFunc ;==>glEnd Func glViewport($x, $y, $width, $height) DllCall("opengl32.dll", "none", "glViewport", "int", $x, "int", $y, "int", $width, "int", $height) EndFunc ;==>glViewport Func glEnable($cap) DllCall("opengl32.dll", "none", "glEnable", "uint", $cap) EndFunc ;==>glEnable Func glBlendFunc($sfactor, $dfactor) DllCall("opengl32.dll", "none", "glBlendFunc", "uint", $sfactor, "uint", $dfactor) EndFunc ;==>glBlendFunc Func SwapBuffers($hDC) DllCall("gdi32.dll", "int", "SwapBuffers", "hwnd", $hDC) EndFunc ;==>SwapBuffers Func Quit() DllCall("opengl32.dll", "int", "wglMakeCurrent", "int", 0, "int", 0) DllCall("opengl32.dll", "hwnd", "wglDeleteContext", "hwnd", $rc) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", $gui, "hwnd", $dc) Exit EndFunc ;==>Quit Func Preserve() SwapBuffers($dc) EndFunc ;==>Preserve edit; corrected $WM_PAINT constant1 point
-
I'd recommend using functions for standard dlls. glu32.dll can be used for rounds. Opt("GUIOnEventMode", 1) Global Const $GL_VERSION_1_1 = 1 Global Const $PFD_TYPE_RGBA = 0 Global Const $PFD_MAIN_PLANE = 0 Global Const $PFD_DOUBLEBUFFER = 1 Global Const $PFD_DRAW_TO_WINDOW = 4 Global Const $PFD_SUPPORT_OPENGL = 32 Global Const $GL_PROJECTION = 0x1701 Global Const $GL_COLOR_BUFFER_BIT = 0x00004000 Global Const $GL_DEPTH_BUFFER_BIT = 0x00000100 Global $gui = GUICreate("OpenGL", 350, 350) GUISetBkColor(0xFFFFFF) Global $dc EnableOpenGL($gui, $dc) glMatrixMode($GL_PROJECTION) glViewport(0, 0, 350, 350) glClear(BitOR($GL_COLOR_BUFFER_BIT, $GL_DEPTH_BUFFER_BIT)) ; initially cleaning buffers GUISetState(@SW_SHOW) GUISetOnEvent(-3, "Quit") Global $h_quadric = gluNewQuadric() Global $m = 3 While 1 glClearColor(1, 1, 1, 1) ; background glClear($GL_COLOR_BUFFER_BIT) If $m > 50 Then $m = 3 glColor3f(1, .4, .7) gluSphere($h_quadric, 0.75, $m, 20) SwapBuffers($dc) Sleep(100) $m += 1 WEnd Func EnableOpenGL($hwnd, ByRef $hDC) Local $pfd = DllStructCreate("short nSize;" & _ "short nVersion;" & _ "dword dwFlags;" & _ "byte iPixelType;" & _ "byte cColorBits;" & _ "byte cRedBits;" & _ "byte cRedShift;" & _ "byte cGreenBits;" & _ "byte cGreenShift;" & _ "byte cBlueBits;" & _ "byte cBlueShift;" & _ "byte cAlphaBits;" & _ "byte cAlphaShift;" & _ "byte cAccumBits;" & _ "byte cAccumRedBits;" & _ "byte cAccumGreenBits;" & _ "byte cAccumBlueBits;" & _ "byte cAccumAlphaBits;" & _ "byte cDepthBits;" & _ "byte cStencilBits;" & _ "byte cAuxBuffers;" & _ "byte iLayerType;" & _ "byte bReserved;" & _ "dword dwLayerMask;" & _ "dword dwVisibleMask;" & _ "dword dwDamageMask;") Local $h_dc = DllCall("user32.dll", "hwnd", "GetDC", "hwnd", $hwnd) DllStructSetData($pfd, "nSize", DllStructGetSize($pfd)) DllStructSetData($pfd, "nVersion", $GL_VERSION_1_1) DllStructSetData($pfd, "dwFlags", BitOR($PFD_DRAW_TO_WINDOW, $PFD_SUPPORT_OPENGL, $PFD_DOUBLEBUFFER)) DllStructSetData($pfd, "iPixelType", $PFD_TYPE_RGBA) DllStructSetData($pfd, "cColorBits", 24) DllStructSetData($pfd, "cDepthBits", 32) DllStructSetData($pfd, "iLayerType", $PFD_MAIN_PLANE) DllOpen("gdi32.dll") DllOpen("opengl32.dll") DllOpen("glu32.dll") Local $iFormat = DllCall("gdi32.dll", "int", "ChoosePixelFormat", "hwnd", $h_dc[0], "ptr", DllStructGetPtr($pfd)) Local $iSetFormat = DllCall("gdi32.dll", "int", "SetPixelFormat", "hwnd", $h_dc[0], "int", $iFormat[0], "ptr", DllStructGetPtr($pfd)) Local $h_cont = DllCall("opengl32.dll", "hwnd", "wglCreateContext", "hwnd", $h_dc[0]) Local $iRet = DllCall("opengl32.dll", "int", "wglMakeCurrent", "int", $h_dc[0], "int", $h_cont[0]) $hDC = $h_dc[0] Return 1 EndFunc ;==>EnableOpenGL Func glClear($mask) DllCall("opengl32.dll", "none", "glClear", "uint", $mask) EndFunc ;==>glClear Func glClearColor($red, $green, $blue, $alpha) DllCall("opengl32.dll", "none", "glClearColor", "float", $red, "float", $green, "float", $blue, "float", $alpha) EndFunc ;==>glClearColor Func gluNewQuadric() $h_qu = DllCall("glu32.dll", "hwnd", "gluNewQuadric") Return $h_qu[0] EndFunc ;==>gluNewQuadric Func gluSphere($h_q, $radius, $slices, $stacks) DllCall("glu32.dll", "none", "gluSphere", "hwnd", $h_q, "double", $radius, "int", $slices, "int", $stacks) EndFunc ;==>gluSphere Func glColor3f($red, $green, $blue) DllCall("opengl32.dll", "none", "glColor3f", "float", $red, "float", $green, "float", $blue) EndFunc ;==>glColor3f Func glMatrixMode($mode) DllCall("opengl32.dll", "none", "glMatrixMode", "uint", $mode) EndFunc ;==>glMatrixMode Func glViewport($x, $y, $width, $height) DllCall("opengl32.dll", "none", "glViewport", "int", $x, "int", $y, "int", $width, "int", $height) EndFunc ;==>glViewport Func SwapBuffers($hDC) DllCall("gdi32.dll", "int", "SwapBuffers", "hwnd", $hDC) EndFunc ;==>SwapBuffers Func Quit() Exit EndFunc ;==>Quit1 point