Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/05/2024 in all areas

  1. Andreik

    Slideshow UDF

    This is a basic UDF to create nice slideshows. There are a lot of customizable options so it might be useful in some projects. Here is an example: #AutoIt3Wrapper_AU3Check_Parameters=-d -w 1 -w 2 -w 4 -w 5 -w 6 -w 7 #Au3Stripper_Parameters=/sf /sv /mo /rm /rsln #include "Slideshow.au3" Global $avImage[4] = [ _ 'https://lh5.googleusercontent.com/p/AF1QipM3jIOsqrISfcKwgYLYF8-9DyAzQiUyWmB35nBj=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipMPb5fGtzZz2ZJFd20CV2trNzmxNOYLv4abJSfi=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPLOXRwTpKbFxNNLTmiLrIJlG_H3h4VU6HShLwf=w540-h312-n-k-no', _ 'https://lh5.googleusercontent.com/p/AF1QipPNiwx1lGPxcHJzKTMRl5Cyr1SOjS05yHbif8BE=w540-h312-n-k-no' _ ] Global $asCaptions[4] = ['Pico do Fogo', 'Praia da Chave', 'Buracona - Blue Eye Cave', 'Deserto de Viana'] Global $mOptions[] $mOptions['ImageType'] = 'URL' $mOptions['Captions'] = $asCaptions $mOptions['ShowCaptions'] = True Global $sTitle = 'Cape Verde' Global $sText = 'Cape Verde or Cabo Verde, officially the Republic of Cabo Verde, is an archipelago and island country of West Africa in the central Atlantic Ocean, ' & _ 'consisting of ten volcanic islands with a combined land area of about 4,033 square kilometres (1,557 sq mi). These islands lie between 600 and 850 kilometres ' & _ '(320 and 460 nautical miles) west of Cap-Vert, the westernmost point of continental Africa. The Cape Verde islands form part of the Macaronesia ecoregion, ' & _ 'along with the Azores, the Canary Islands, Madeira, and the Savage Isles.' Global $sExtraText = "Cape Verde's official language is Portuguese. The recognized national language is Cape Verdean Creole, which is spoken by the vast " & _ "majority of the population. As of the 2021 census the most populated islands were Santiago, where the capital Praia is located (269,370), São Vicente (74,016), " & _ "Santo Antão (36,632), Fogo (33,519) and Sal (33,347). The largest cities are Praia (137,868), Mindelo (69,013), Espargos (24,500) and Assomada (21,297)." Global $sCopyright = 'Sources for pictures and data are from google.com and wikipedia.com' Global $hGUI, $cTitle, $cText, $cExtra, $cCopyright, $mSlideshow _GDIPlus_Startup() $hGUI = GUICreate('Slideshow', 870, 450) $cTitle = GUICtrlCreateLabel($sTitle, 10, 10, 300, 60) $cText = GUICtrlCreateLabel($sText, 10, 90, 300, 240) $cExtra = GUICtrlCreateLabel($sExtraText, 10, 330, 850, 80) $cCopyright = GUICtrlCreateLabel($sCopyright, 10, 420, 850, 20) $mSlideshow = _GUICtrlSlideshow_Create($hGUI, 320, 10, 540, 312, $avImage, $mOptions) GUICtrlSetFont($cTitle, 35, 600, 0, 'Segoe UI') GUICtrlSetFont($cText, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cExtra, 11, 500, 0, 'Segoe UI') GUICtrlSetFont($cCopyright, 11, 500, 2, 'Segoe UI') GUICtrlSetColor($cTitle, 0x000060) GUICtrlSetColor($cCopyright, 0x800000) GUISetState(@SW_SHOW, $hGUI) While True If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_PREV_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_PREV) If _GUICtrlSlideshow_ButtonEvent($mSlideshow, $SLIDESHOW_NEXT_BTN) Then _GUICtrlSlideshow_ShowSlide($mSlideshow, $BTN_EVENT_NEXT) Switch GUIGetMsg() Case -3 ExitLoop EndSwitch WEnd _GUICtrlSlideshow_Delete($mSlideshow) _GDIPlus_Shutdown() There might be some hidden bugs. If you encounter any just let me know. Tip: use SlideshowEx.au3 if you don't want to preload the images Slideshow.au3SlideshowEx.au3
    1 point
  2. This UDF provides 2 functions to read data directly from xlsx files or to output data as xlsx file. Only the cell contents are considered - no cell formatting and the like. It is therefore explicitly not a full replacement for the Excel UDF, since its scope goes well beyond that. But to quickly read in data or to work with xlsx files without having Excel installed, the UDF can be quite useful. There may also be specially formatted xlsx files which I have not yet encountered during testing and which may cause problems. In this case it is best to make a message about it here and upload the file. Note: xlsx files must be unpacked for reading. To make this as fast as possible it is recommended to put a >>7za.exe<< file into the script directory, otherwise a slow alternative will be used. Otherwise an example says more than 1000 words: >>sourcecode and download on github<< Changelog:
    1 point
  3. Danyfirex

    RegisterSyncCallback

    Here a sample for passing two parameters (You would need to make it more dinamically) #include <winapi.au3> #include <Memory.au3> MsgBox(0, "Main Thread", "GetCurrentThreadId: " & DllCall("kernel32.dll", "handle", "GetCurrentThread")[0]) Local $pCB = _RegisterSyncCallback(_MyFn, 2) ;~ Local $pCB = _DllCallBackRegisterNormal(_MyFn) Local $tParameters = DllStructCreate("int Value1;int Value2") $tParameters.Value1 = 10 $tParameters.Value2 = 30 ;~ DllCallAddress("int", $pCB, "ptr", DllStructGetPtr($tParameters)) ConsoleWrite("DllStructGetPtr($tParameters): " & DllStructGetPtr($tParameters) & @CRLF) DllCall("kernel32.dll", "hwnd", "CreateThread", "ptr", 0, "dword", 0, "long", $pCB, "ptr", DllStructGetPtr($tParameters), "long", 0, "int*", 0) MsgBox(0, "", "Click To Exit") Exit Func _MyFn($arg1,$arg2) MsgBox(0, "_MyFn - Child Thread", "GetCurrentThreadId: " & DllCall("kernel32.dll", "handle", "GetCurrentThread")[0] & @CRLF & "$arg1: " & Int($arg1) & @CRLF & "$arg2: " & Int($arg2)) EndFunc ;==>_MyFn Func _DllCallBackRegisterNormal($Function) Local $hHandle = DllCallbackRegister($Function, "int", "ptr") Return DllCallbackGetPtr($hHandle) EndFunc ;==>_DllCallBackRegisterNormal Func _RegisterSyncCallback($Function, $iParamCount = 0, $iOptions = 0) Local Static $hGUI Local Static $pSendMessage Local Static $iMsg If Not $hGUI Then $hGUI = GUICreate("RegisterSyncCallback_Msg", 300, 200) $iMsg = 0x8000 GUIRegisterMsg($iMsg, RegisterSyncCallback_Msg) $pSendMessage = DllCall("Kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("user32.dll"), "str", "SendMessageW")[0] ConsoleWrite("$hGUI: " & Hex($hGUI) & @CRLF) ConsoleWrite("$pSendMessage: " & Hex($pSendMessage) & @CRLF) ConsoleWrite("$iMsg: " & Hex($iMsg) & @CRLF) EndIf If @AutoItX64 Then Return MsgBox(0, "Error", "This is a x86 Sample :(") ;add x64 code yourself Local $pRemoteCode = _MemVirtualAlloc(0, 96, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE) If Not $pRemoteCode Then MsgBox(0, "Error", "_MemVirtualAlloc :(") Local $tCodeBuffer = DllStructCreate("byte[96]", $pRemoteCode) Local $hHandle = DllCallbackRegister($Function, "int", "int;int") ;hardcode one parameter Local $sOPCode = "0x68" & SwapEndian($pRemoteCode + 30) & _ "8D4424085068" & SwapEndian($iMsg) & "68" & SwapEndian($hGUI) & _ "B8" & SwapEndian($pSendMessage) & "FFD0C2" & StringLeft(SwapEndian($iParamCount * 4), 4) & _ SwapEndian(DllCallbackGetPtr($hHandle)) & SwapEndian($iParamCount) DllStructSetData($tCodeBuffer, 1, $sOPCode) ConsoleWrite("$tCodeBuffer: " & DllStructGetData($tCodeBuffer, 1) & @CRLF) Return $pRemoteCode EndFunc ;==>_RegisterSyncCallback Func RegisterSyncCallback_Msg($hWnd, $iMsg, $wParam, $lParam) ConsoleWrite(">RegisterSyncCallback_Msg Called" & @CRLF) ConsoleWrite("$hWnd: " & Hex($hWnd) & @CRLF) ConsoleWrite("$iMsg: " & Hex($iMsg) & @CRLF) ConsoleWrite("$wParam: " & Hex($wParam) & @CRLF) ConsoleWrite("$lParam: " & Hex($lParam) & @CRLF) Local $tStruct = DllStructCreate("ptr pFunction", $lParam) Local $tNParameters = DllStructCreate("ptr NParameters", $lParam + 4) Local $tStructParameters = DllStructCreate("ptr", $wParam) ConsoleWrite("$tStruct.pFunction: " & $tStruct.pFunction & @CRLF) ConsoleWrite("$tNParameters.NParameters: " & $tNParameters.NParameters & @CRLF) Local $aValues[$tNParameters.NParameters] For $i = 0 To $tNParameters.NParameters - 1 $aValues[$i] = DllStructGetData(DllStructCreate("int", DllStructGetData($tStructParameters, 1) + ($i * 4)),1) ConsoleWrite($aValues[$i] & @CRLF) Next DllCallAddress("int", $tStruct.pFunction, "int", $aValues[0],"int",$aValues[1]) Return 1 EndFunc ;==>RegisterSyncCallback_Msg Func SwapEndian($hex) Return Hex(BitOR(BitOR(BitOR(BitShift($hex, 24), _ BitAND(BitShift($hex, -8), 0x00FF0000)), _ BitAND(BitShift($hex, 8), 0x0000FF00)), _ BitShift($hex, -24)), 8) EndFunc ;==>SwapEndian 1: Don't now ask to the owner of the function haha (just don't want to look deeply) 2:I seems to be it needs some code interaction before run the other threads, sleep works For $i = 1 to 5 $tParameters.Value1=$i DllCall("kernel32.dll", "hwnd", "CreateThread", "ptr", 0, "dword", 0, "long", $pCB, "ptr",DllStructGetPtr($tParameters), "long", 0, "int*", 0) Sleep(100) ;need some autoit interaction Next 3: Already added using to struct and checking in the structure parameters but AutoIt does not allow to push parameters as ahk so you need to probably add some if with @NumParams. Saludos
    1 point
  4. Thanks heaps ioa - really appreaciate it Yeah, certainly we need a way to set a value from outside the GUI. I was going to try and see if I can get GuiCtrlSetData() to trigger something similar to what you've written, but I still need to do the groundwork to see if that's viable. As for the other suggestion, I appreaciate where you're coming from. Pushing the left side of the control up works the same pulling the right side down... I think we do need to choose a direction though and stick with it - just from a usability standpoint. If I cross the centre line while pulling upwards I probably don't want the control to reverse.. Or if I'm using a touch screen my finger might cover the entire control - each time i grab something it could seemingly behave differently (depending on if I'm a little bit left or right of center) .
    1 point
  5. Danyfirex

    RegisterSyncCallback

    Hello, I don't think it's going to help much but just convert it for fun. #include <winapi.au3> #include <Memory.au3> MsgBox(0, "Main Thread", "GetCurrentThreadId: " & DllCall("kernel32.dll", "handle", "GetCurrentThread")[0]) Local $pCB = _RegisterSyncCallback(_MyFn) ;~ Local $pCB = _DllCallBackRegisterNormal(_MyFn) ;~ DllCallAddress("int", $pCB, "int", 123) DllCall("kernel32.dll", "hwnd", "CreateThread", "ptr", 0, "dword", 0, "long", $pCB, "ptr", 124, "long", 0, "int*", 0) MsgBox(0, "", "Click To Exit") Exit Func _MyFn($arg) MsgBox(0, "_MyFn - Child Thread", "GetCurrentThreadId: " & DllCall("kernel32.dll", "handle", "GetCurrentThread")[0] & @CRLF & "$arg: " & Int($arg)) EndFunc ;==>_MyFn Func _DllCallBackRegisterNormal($Function) Local $hHandle = DllCallbackRegister($Function, "int", "ptr") Return DllCallbackGetPtr($hHandle) EndFunc ;==>_DllCallBackRegisterNormal Func _RegisterSyncCallback($Function, $iOptions = 0, $iParamCount = 0) Local Static $hGUI Local Static $pSendMessage Local Static $iMsg If Not $hGUI Then $hGUI = GUICreate("RegisterSyncCallback_Msg", 300, 200) $iMsg = 0x8000 GUIRegisterMsg($iMsg, RegisterSyncCallback_Msg) $pSendMessage = DllCall("Kernel32.dll", "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("user32.dll"), "str", "SendMessageW")[0] ConsoleWrite("$hGUI: " & Hex($hGUI) & @CRLF) ConsoleWrite("$pSendMessage: " & Hex($pSendMessage) & @CRLF) ConsoleWrite("$iMsg: " & Hex($iMsg) & @CRLF) EndIf If @AutoItX64 Then Return MsgBox(0, "Error", "This is a x86 Sample :(") ;add x64 code yourself Local $pRemoteCode = _MemVirtualAlloc(0, 96, $MEM_COMMIT, $PAGE_EXECUTE_READWRITE) If Not $pRemoteCode Then MsgBox(0, "Error", "_MemVirtualAlloc :(") Local $tCodeBuffer = DllStructCreate("byte[96]", $pRemoteCode) Local $hHandle = DllCallbackRegister($Function, "int", "ptr") ;hardcode one parameter Local $sOPCode = "0x68" & SwapEndian($pRemoteCode + 30) & _ "8D4424085068" & SwapEndian($iMsg) & "68" & SwapEndian($hGUI) & _ "B8" & SwapEndian($pSendMessage) & "FFD0C20400" & _ SwapEndian(DllCallbackGetPtr($hHandle)) & "01000000" DllStructSetData($tCodeBuffer, 1, $sOPCode) ConsoleWrite("$tCodeBuffer: " & DllStructGetData($tCodeBuffer, 1) & @CRLF) Return $pRemoteCode EndFunc ;==>_RegisterSyncCallback Func RegisterSyncCallback_Msg($hWnd, $iMsg, $wParam, $lParam) ConsoleWrite(">RegisterSyncCallback_Msg Called" & @CRLF) ConsoleWrite("$hWnd: " & Hex($hWnd) & @CRLF) ConsoleWrite("$iMsg: " & Hex($iMsg) & @CRLF) ConsoleWrite("$wParam: " & Hex($wParam) & @CRLF) ConsoleWrite("$lParam: " & Hex($lParam) & @CRLF) Local $tStruct = DllStructCreate("ptr pFunction", $lParam) Local $tStructParameters = DllStructCreate("ptr NParameters", $lParam + 4) Local $tStructParametersValue = DllStructCreate("ptr Value", $wParam) ConsoleWrite("$tStruct.pFunction: " & $tStruct.pFunction & @CRLF) ConsoleWrite("$tStructParameters.NParameters: " & $tStructParameters.NParameters & @CRLF) ConsoleWrite("$tStructParametersValue.Value: " & $tStructParametersValue.Value & @CRLF) DllCallAddress("int", $tStruct.pFunction, "int", $tStructParametersValue.Value) Return 1 EndFunc ;==>RegisterSyncCallback_Msg Func SwapEndian($hex) Return Hex(BitOR(BitOR(BitOR(BitShift($hex, 24), _ BitAND(BitShift($hex, -8), 0x00FF0000)), _ BitAND(BitShift($hex, 8), 0x0000FF00)), _ BitShift($hex, -24)), 8) EndFunc ;==>SwapEndian Saludos
    1 point
  6. Attached is a full Controller for SONY Cameras using the VISCA protocol, written in AutoIt. Everything required to build a EXE file is included. I wrote this software because I couldn't find decent control software for these cameras, I tried at least a dozen packages. So in my mind, anyway, it is better than anything else out there. The software will also controls several other pieces of AV equipment. The software is very specific to my application but should be easy to adapt and would make a good starting point for someone else trying to roll there own Audio Video control program. It features the following; Unlimited number of presets Macros to combine recall of presets Supports JoyStick control Supports up to 7 cameras in Daisy chain configuration. Unique Pan Tilt control pad provides variable speed control by dragging Mouse on pad, makes the cameras easy to control. Web Server allows Macros to be activated from OBS Studio Modular structure should make the code adaptable to other camera control protocols. Modular structure should make additional hardware support easy to add or remove. Will show errors during start up if hardware is not present but it will run. Serial ports configured with included INI file. Joystick response can be adjusted through settings in the INI file. Lots of documentation on how things are setup in the various source modules. Built in web server allows control from OBS Studio. Lots more documentation available wiring instructions, protocol documents for hardware etc. but that would exceed file upload size. PM me if you are interested. And thanks to everyone on this forum that provided the many libraries and bits of software used to make this project work. I couldn't have done it without the many contributors to this forum. I did my best to give the appropriate credit in each module. GeorgeController.zip Operation Instructions.pdf
    1 point
×
×
  • Create New...