48 posts in this topic
Compiling scripts from console with AutoIt3Wrapper
Backstory to understand my need:
I'm building something similar to what Chunk VNC was, using the Single Click function from UltraVNC to provide remote support.
My "little monster" is actually working, but the "solution" will have 3 modules:
SUPPORT: Users will open or install so IT Pros can access their system. VIEWER: IT Pros use to connect to User systems and perform their maintenance GENERATOR: The IT Pro uses to define the configuration for both the SUPPORT and VIEWER apps, like language files for text, SERVER address and ports, Company name, etc. I've attached a screenshot of the SUPPORT app that is done.
Before anyone points the finger, no I'm not planning on just copying the AutoIt3 files to my project folder and distribute them, I intend to get the IT Pro who will use the GENERATOR to install SciTE and AutoIt3 then the GENERATOR will use them to compile the other two apps.
The thing is, I need this to be simple, I thought about the GENERATOR having a single screen where the IT Pro can fill in all the information, select the language file and so on, then the GENERATOR compiles both "au3" sources for the SUPPORT and VIEWER.
I'm using the ResourceEx UDF from Guiness and MetroUI UDF from BBs19. I even made some changes to the MEtroUI, that I shared here.
This project will be uploaded to my Github account as soon I get this GENERATOR working, so people can actually use it.
As explained, I need to compile the AU3 source files and perform an Resource Update. SciTE does that for me, right, but I just find sloppy making the GENERATOR open the script on the installed SciTE, clicking in the menus, waiting the process to end and then exit.
When I hit the Compile or Build on SciTE, it generates this output:
Spoiler >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /NoStatus /prod /in "E:\_ARQUIVOS\PROJETOS\PROJETO INTERMIX\VERSION\0.1.0\SOURCE\client\IntermixClient.au3"
+>17:34:35 Starting AutoIt3Wrapper v.16.306.1237.0 SciTE v.18.104.22.168 Keyboard:00010416 OS:WIN_10/ CPU:X64 OS:X64 Environment(Language:0416) CodePage:0 utf8.auto.check:4 # detect ascii high characters and if none found set default encoding to UTF8 and do not add BOM
+> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\Fernando\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Fernando\AppData\Local\AutoIt v3\SciTE
>Running AU3Check (22.214.171.124) from:C:\Program Files (x86)\AutoIt3 input:E:\_ARQUIVOS\PROJETOS\PROJETO INTERMIX\VERSION\0.1.0\SOURCE\client\IntermixClient.au3
+>17:34:35 AU3Check ended.rc:0
>Running:(126.96.36.199):C:\Program Files (x86)\AutoIt3\aut2exe\aut2exe.exe /in "E:\_ARQUIVOS\PROJETOS\PROJETO INTERMIX\VERSION\0.1.0\SOURCE\client\IntermixClient.au3" /out "C:\Users\Fernando\AppData\Local\AutoIt v3\Aut2exe\~AU8787.tmp.exe" /nopack /icon "img\icon.ico" /comp 2
+>17:34:37 Aut2exe.exe ended.C:\Users\Fernando\AppData\Local\AutoIt v3\Aut2exe\~AU8787.tmp.exe. rc:0
>17:34:37 Performing the Program Resource Update steps:
...>Updating Program Version information.
...>Adding / Removing 14 resource(s).
>17:34:37 Program Resource updating finished successfully.
+>17:34:37 Created program:E:\_ARQUIVOS\PROJETOS\PROJETO INTERMIX\VERSION\0.1.0\COMPILADO\IntermixClient.Exe
+>17:34:38 AutoIt3Wrapper Finished.
>Exit code: 0 Time: 3.515
I've tried emulating this using the promt with console commands:
Spoiler AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /NoStatus /prod /in "E:\_ARQUIVOS\PROJETOS\PROJETO INTERMIX\VERSION\0.1.0\SOURCE\client\IntermixClient.au3"
Spoiler aut2exe.exe /in "E:\_ARQUIVOS\PROJETOS\PROJETO INTERMIX\VERSION\0.1.0\SOURCE\client\IntermixClient.au3" /out "E:\_ARQUIVOS\PROJETOS\PROJETO INTERMIX\VERSION\0.1.0\COMPILADO\IntermixClient.Exe" /nopack /icon "img\icon.ico" /comp 2
It returns an error saying it was not possible to perform a resource update, poiting an TMP file on the ".../AppData/Local/AutoIt3/".
As I understand, it runs the AutoIt3Wrapper, then the Wrapper should call the Aut2Exe to compile the script and then the Wrapper incorporate the resources into the compiled Script. It generates the file into a TMP one then copies to the directory defined in the Wrapper Directive.
I know this seems strange, that you think I might be trying to pack AutoIt into my project with no F*** given, no... I just want to automate the compilation process, if there's no solution using console commands, I'll need to automate the process sending keyboard and mouse commands, what will be ugly and problematic.
So... any help is a heaven's gift at this point.
Best way to play little video inside a Gui
I would like to insert a video player inside the gui Autoit, preferably one with a free license such as Media Player Classic or VLC, I saw in the forum but I found examples of many years ago.
Some examples links or advice would be much help
Two images in one GUI control with ability to move image
Hello. I'm trying to make a form with two pictures and one button. But pictures must overlap one another. First picture I'm getting from screenshot of another window, but second picture must be with alfa channel and positioning on that first image.
Something like that:
#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> #include <ScreenCapture.au3> Global Const $AC_SRC_ALPHA = 1 $Form1_1 = GUICreate("Document", 701, 671, -1, -1) GUISetBkColor(0xFFFFFF) $Pic1 = GUICtrlCreatePic("", 8, 8, 409, 657) $Button1 = GUICtrlCreateButton("Take Picture", 424, 8, 161, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Generate() EndSwitch WEnd Func Generate() Local $hBMP, $hBitmap, $hGraphic, $WindowToCapture WinActivate("Notepad") $WindowToCapture = ControlGetHandle("Notepad", "", "[CLASS:Edit; INSTANCE:1]") $hBMP = _ScreenCapture_CaptureWnd ( '', $WindowToCapture,4,4,400,470,False) ; Initialize GDI+ library _GDIPlus_Startup() $PicHandle = GUICtrlGetHandle($Pic1) $myGuiHandle = ControlGetHandle("Document", "", $PicHandle) $TransparentButtonTest = GUICreate("", 0, 0, 390, 130, $WS_EX_MDICHILD, $WS_EX_LAYERED, $myGuiHandle) $hImageButton = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\2-f.png") SetBitMap($TransparentButtonTest, $hImageButton, 255) GUISetState() WinActivate("Document") ; Draw bitmap to GUI $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBMP) $hGraphic = _GDIPlus_GraphicsCreateFromHWND(GUICtrlGetHandle($Pic1)) _GDIPlus_GraphicsDrawImage($hGraphic, $hBitmap, 0, 100) ; Clean up resources _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap) _WinAPI_DeleteObject($hBMP) ; Shut down GDI+ library _GDIPlus_Shutdown() EndFunc Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap But the most interesting, that I need to move second picture(png FromFile) by draging it with mouse ontop of first image.
Can you tell me what I have done wrong and maybe there is some easier ways to do this?
No carriage return in label
My program generates a huge lot of numbers that has to be displayed in a label. Usually there are around 100 thousand and 1 million numbers, so I obviously have certain problems with space. I get the data into the label, but it's all in one line and simply exceeds the label (by a couple of million pixels, but never mind that)... Of course it won't fit into a 200x200 big label either, but it'd look a lot nicer. I don't even need to scroll in it.
The only thing in need is an automatic @CRLF at the border of the label.
Something like the style $ES_MULTILINE for the input box.
Here's the most important stuff from the GUI.
Local $gui = GUICreate("Crypt", 630, 440) Local $in = GUICtrlCreateInput("", 10, 10, 300, 300, $ES_MULTILINE) ; need something like $ES_MULTILINE just one line later in this code Local $out = GUICtrlCreateLabel("", 320, 10, 300, 300) ; instead of "", please imagine a random number between 1e5 and 1e6 here please ; a lot of buttons that don't matter right now GUISetBkColor(0x111111, $gui) GUICtrlSetBkColor($in, 0xEEEEEE) GUICtrlSetBkColor($out, 0xEEEEEE) ; again a lot of button configuartion that's completely unnecessary right now GUICtrlSetColor($in, 0x111111) GUICtrlSetColor($out, 0x111111) ; same as before GUISetFont(13, 200, 0, "Candara", $gui) GUICtrlSetFont($in, 13, 200, 0, "Candara") GUICtrlSetFont($out, 13, 200, 0, "Candara") ; still configuation for the buttons Local $data0 = "" ; some unimportant variables GUISetState(@SW_SHOW, $gui) ; switch from GUIGetMsg() in an infinite while-loop Thanks!
Is it possible to embed the SciTE editor within an AutoIt GUI?
Hi, I would like to know if it's possible to use the SciTE editor within an AutoIt GUI just to have the formatting capabilities and color highlight of the AutoIt script for little snippets of code (it would be enougt just the editor with the formatting capabilities without the option of running the script or other advanced functionalities)
I mean in a way similar to what you can do with a browser when you use the _IECreateEmbedded() function for example to embed the browser within a GUI. (I don't even know if it's possible)
Any suggestion is welcome.