Leaderboard
Popular Content
Showing content with the highest reputation on 05/27/2025 in Posts
-
autoit problem
Musashi and one other reacted to pixelsearch for a topic
Yes that's the reason, for example with a simplified script (Esc to quit the script), have a look at the Console #include <File.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declaration Opt("GUIOnEventMode", 1) ; Event Mode ON Global $aTradeRows[0] Global $AllertNotify Global $gGroupDynamic = 0 ConsoleWrite("$gGroupDynamic = " & $gGroupDynamic & @crlf) main() While 1 Sleep(100) WEnd ;=========================== Func main() ; === GUI === Local $guiWidth = 685, $guiHeight = 40 $AllertNotify = GUICreate("Trades", $guiWidth, $guiHeight, -1, -1, _ BitOR($WS_POPUP, $WS_BORDER, $WS_CLIPSIBLINGS)) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") WinSetOnTop($AllertNotify, "", 1) GUISetState(@SW_SHOW) LoadTradesFromFile() AdlibRegister("ReloadTrades", 3000) EndFunc ;=========================== Func LoadTradesFromFile() Local $symbol = "symbol" Local $ticket = "ticket" Local $net = "net" Local $text = StringFormat("%s | %s", $symbol, $net) Local $textSize = StringLen($text) * 7 ; Associa label e button al gruppo dinamico! Local $label = GUICtrlCreateLabel($text, 10, 10, $textSize, 22, 0, $gGroupDynamic) ConsoleWrite("$label = " & $label & " $gGroupDynamic = " & $gGroupDynamic & @crlf) _ArrayAdd($aTradeRows, $label) Local $btn = GUICtrlCreateButton($ticket, 10 + $textSize, 10, 60, 24, $gGroupDynamic) ConsoleWrite("$btn = " & $btn & " $gGroupDynamic = " & $gGroupDynamic & @crlf) GUICtrlSetData($btn, $ticket) _ArrayAdd($aTradeRows, $btn) Local $tradeCount = 1 ; Bottone "Chiudi tutto" fuori dal ciclo, associato anch'esso al gruppo Local $closeAllBtnX = 685 - 35 Local $btnCloseAll = GUICtrlCreateButton("X", $closeAllBtnX + 10, 5, 20, 20, $gGroupDynamic) ConsoleWrite("$btnCloseAll = " & $btnCloseAll & " $gGroupDynamic = " & $gGroupDynamic & @crlf & @crlf) Return $tradeCount EndFunc ;=========================== Func ReloadTrades() If $gGroupDynamic Then GUICtrlDelete($gGroupDynamic) ; cancella il contenitore $gGroupDynamic = GUICtrlCreateGroup("", 0, 0, 685, 30) ; contenitore invisibile ConsoleWrite("$gGroupDynamic = " & $gGroupDynamic & @crlf) GUICtrlSetState($gGroupDynamic, $GUI_HIDE) ReDim $aTradeRows[0] LoadTradesFromFile() GUICtrlSetState($gGroupDynamic, $GUI_SHOW) EndFunc ;=========================== Func _Exit() Exit EndFunc $gGroupDynamic = 0 $label = 3 $gGroupDynamic = 0 $btn = 4 $gGroupDynamic = 0 $btnCloseAll = 5 $gGroupDynamic = 0 $gGroupDynamic = 6 $label = 7 $gGroupDynamic = 6 $btn = 8 $gGroupDynamic = 6 $btnCloseAll = 9 $gGroupDynamic = 6 $gGroupDynamic = 6 $label = 10 $gGroupDynamic = 6 $btn = 11 $gGroupDynamic = 6 $btnCloseAll = 12 $gGroupDynamic = 6 You apply the value of $gGroupDynamic to your 3 controls, in Style or ExStyle and it creates a mess. For example, see how a value of 6 changes the button style in this script, turning it to a checkbox : #include <GUIConstantsEx.au3> Example() Func Example() Local $hGUI = GUICreate("Example", 300, 200) ; Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; ok Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25, 6) ; Style 2 to 7 => checkbox, style 10 hides etc... GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example2 points -
As you can see, I can't test the script, so I'm just speculating At first glance, there are some irregularities here Local $label = GUICtrlCreateLabel($text, $x, $y + 3, $textSize, 22, 0, $gGroupDynamic) Local $btn = GUICtrlCreateButton($ticket, $x + $textSize, $y - 1, 60, 24, $gGroupDynamic) Local $btnCloseAll = GUICtrlCreateButton("X", $closeAllBtnX + 10, 5, 20, 20, $gGroupDynamic) you use as style or as exStyle to $gGroupDynamic = GUICtrlCreateGroup("", 0, 0, 685, 30) ; contenitore invisibile which doesn't seem right to me.2 points
-
AutoIt Snippets
ioa747 and one other reacted to argumentum for a topic
; from an Admin CMD run: ; SETX PROMPT $E[32m$C$E[94m$D@$T$E[32m$F-[$E[90m$P$E[32m]$_$G$E[33m ; to set it systemwide If Not FileExists(@TempDir & "\YouAreHERE") Then DirCreate(@TempDir & "\YouAreHERE") ; Run(@ComSpec & " /K @SET PROMPT=$E[32m$C$E[94m$D@$T$E[32m$F-[$E[90m$P$E[32m]$_$G$E[33m", @TempDir & "\YouAreHERE") ; date@time Run(@ComSpec & " /K @SET PROMPT=$E[32m$C$E[94m" & @UserName & "@" & @ComputerName & "$E[32m$F-[$E[90m$P$E[32m]$_$S$E[33m", @TempDir & "\YouAreHERE") May be silly but this "most awesome codeā¢" opens a cmd in a folder without consequence and leaves a prompt with enough room to type even in long paths. For more "prompt creativity", visit https://ss64.com/nt/prompt.html Edit: made an icon for it too cmdWprompt.ico.zip2 points -
open-webui-ToTray ( Help area )
ioa747 reacted to argumentum for a topic
What's New in Version 0.0.0.4 Fixed default phython's expected folder Fixed default run and update commands Better INI file comment handling Some function refactoring.1 point -
Process Suspend
argumentum reacted to joiner for a topic
Good day. Sorry for not responding. I was busy with my main job. I excluded the use of inno setup from the project. I also excluded Scripting.Dictionary. The constructor itself uses Scripting.Dictionary, and in the installation file I use Map I wrote a simple library to make it convenient. I left the archiver. Now the archives and installer files are written to the program body. Then they are extracted as needed or at the user's discretion. Let me remind you that the described problem was found in a small number of users. After changing the code, the problem went away. On Windows 10 for sure. With Windows 11, there was a problem with the program for those whose computer was not designed for this operating system. Stripped-down builds of the operating system were installed. It always works fine on my PC. In both operating systems. I hope the developers will leave Map among other functions I can put: the problem is solved Thank you1 point -
Pointer to a pointer
argumentum reacted to jugador for a topic
Get time to test custom object with CoMarshalInterface and CoUnmarshalInterface function. worked well between threads within a single process. But I failed to make it worked between multiple process as the CLSID and IID is not registered. So to make it work one have to implement IMarshal interface https://learn.microsoft.com/en-us/windows/win32/api/objidl/nn-objidl-imarshal If the IMarshal interface is not implemented properly then IMarshal::UnmarshalInterface may not be invoked when CoUnmarshalInterface is called. Global $IID_IMyInterface = "{12345678-9abc-4def-8901-23456789abcd}" Local $t_TestObj Local $tagMessage_IUnknown = "GetMessage hresult();" Local $o_TestObj = _ObjectFromTag("__MyInterface_", $tagMessage_IUnknown, $t_TestObj, Default, $IID_IMyInterface) Code for CoMarshalInterface & CoUnmarshalInterface ; #FUNCTION# ============================================================================= ; Name ..........: __CoMarshalInterface ; ======================================================================================== Func __CoMarshalInterface($pStm, $pUnk, $riid = "{00000000-0000-0000-C000-000000000046}", $dwDestContext = 0, $mshlflags = 0) Local $triid = __CLSIDFromString($riid) Local $aResult = DllCall("ole32.dll", "int", "CoMarshalInterface", "ptr", $pStm, _ ;~ A pointer to the stream to be used during marshaling. "ptr", DllStructGetPtr($triid), _ ;~ This interface must be derived from the IUnknown interface. "ptr", $pUnk, _ ;~ This interface must be derived from the IUnknown interface. "dword", $dwDestContext, _ ;~ MSHCTX_LOCAL = 0 "ptr", 0, _ "dword", $mshlflags) ;~ MSHLFLAGS_NORMAL = 0 If @error Or $aResult[0] <> 0 Then Return SetError(1) Return $aResult[0] EndFunc ; #FUNCTION# ============================================================================= ; Name ..........: __CoUnmarshalInterface ; ======================================================================================== Func __CoUnmarshalInterface($pStm, $riid) Local $triid = __CLSIDFromString($riid) Local $aResult = DllCall("ole32.dll", "int", "CoUnmarshalInterface", "ptr", $pStm, "ptr", DllStructGetPtr($triid), "ptr*", 0) If @error Or $aResult[0] <> 0 Then Return SetError(1) Return $aResult[3] ;~ <<==(ppv)Pointer to the unmarshaled interface EndFunc I will not try further with a custom object to make it work across multiple processes, as implementing the IMarshal interface is out of my league. Edit: I am bad at giving up I managed to implement the IMarshal interface and made a custom object work across multiple processes, with the help of the IClassFactory interface for temporary registration of the CLSID.1 point -
open-webui-ToTray ( Help area )
ioa747 reacted to argumentum for a topic
What's New in Version 0.0.0.3 Added "cmdForUdate". The default is the command to update open-webui, but you can put anything there. If "cmdForUdate" is empty, the context menu will not show the option. So that's how you hide the menu entry. Added environment variables. By default sets or adds "WEBUI_AUTH=True". If you don't want it set to "WEBUI_AUTH=". To have these be applied set DoEnvSet=1 Added, given that you may not ever double click to see the window, to do something else. Added something else. There is a ExtraCmd area where you can have an extra menu entry that executes whaever you declare. For more help look in https://www.autoitscript.com/autoit3/docs/functions/ShellExecute.htm because that is what it does/runs. The default example is to open your current session of open-webui ( http://localhost:8080/?temporary-chat=true ) I did that because that's what I'll use it for. In regards to WEBUI_AUTH=False, it will bypass asking for an email/password if it never had a user in it's users DB. In python one can have a virtual environment and that keeps things neat. In the verbatim words of an AI: Why a Virtual Environment is Preferable (and why users don't know): Users, especially those new to development or specific tools, often aren't aware of the benefits of virtual environments. The "default install" often means installing directly into the system's Python environment, which can lead to: Dependency Conflicts: Different projects might require different versions of the same library. Installing globally can cause these versions to clash, breaking one or both projects. System Pollution: The global environment can become cluttered with many packages, some of which are no longer needed, making it harder to manage. Reproducibility Issues: It's harder to guarantee that a project will run the same way on another machine if its dependencies are tangled with system-wide installations. Permissions Problems: Installing globally often requires administrative privileges, which can be a security risk or an annoyance. Virtual environments (like venv in Python) solve these problems by creating isolated spaces for each project, allowing them to have their own dependencies without interfering with others. So, how do I get that venv done ? SET WEBUI_AUTH=False python -m venv C:\open-webui-venv CD /d C:\open-webui-venv\Scripts python.exe -m pip install --upgrade pip open-webui 1st line is to bypass the login. Since you're gonna use it at home might as well not have users. 2nd line is to set the venv ( virtual environment ) 3rd line is to change the working directory to the one where our new venv has the executables 4th line is to finally install the open-webui. Then you're ready to run it ( open-webui.exe serve --host 0.0.0.0 --port 8080 ) to test that it all runs. That's what these 4 lines do. What is as default in my setup is without this venv but I had no idea of it's existence until @ioa747 called my attention. We also have an update menu entry thanks to @ioa747 telling me to do it, that admittedly does come in handy as updates come in quite often as I later found out. And that, I think wraps it up.1 point