Leaderboard
Popular Content
Showing content with the highest reputation on 08/26/2021 in all areas
-
3 points
-
Do we want the Null-Coalescing Operator in Autoit?
Earthshine and one other reacted to jchd for a topic
This is a schema design question. Having Null for non-graduates is perfectly consistent in some cases. But then you need ... where graduationDate is Null because using = Null won't work. In this and many other cases, you can regard Nulls as "we don't have this information, or the provided value is invalid". When I write "I don't know" there is not a way to say "maybe, maybe not" with some vague notion of probability between both. Having a separate boolean column is redondant in this case. If for instance you can have students graduated or not in more than one domain, then this isn't correct.2 points -
Hello. I did create these few functions several months ago. I post here, if it can interest someone. These functions based on WMI queries allow you to manage printers : add / delete printer, driver, port, or obtain configuration, set default printer ... I let you discover it with the code. Here is the list of the available functions : _PrintMgr_AddLocalPort _PrintMgr_AddLPRPort _PrintMgr_AddPrinter _PrintMgr_AddPrinterDriver _PrintMgr_AddTCPIPPrinterPort _PrintMgr_AddWindowsPrinterConnection _PrintMgr_CancelAllJobs _PrintMgr_CancelPrintJob _PrintMgr_EnumPorts _PrintMgr_EnumPrinter _PrintMgr_EnumPrinterConfiguration _PrintMgr_EnumPrinterDriver _PrintMgr_EnumPrinterProperties _PrintMgr_EnumPrintJobs _PrintMgr_EnumTCPIPPrinterPort _PrintMgr_Pause _PrintMgr_PortExists _PrintMgr_PrinterExists _PrintMgr_PrinterSetComment _PrintMgr_PrinterSetDriver _PrintMgr_PrinterSetPort _PrintMgr_PrinterShare _PrintMgr_PrintTestPage _PrintMgr_RemoveLocalPort _PrintMgr_RemoveLPRPort _PrintMgr_RemovePrinter _PrintMgr_RemovePrinterDriver _PrintMgr_RemoveTCPIPPrinterPort _PrintMgr_RenamePrinter _PrintMgr_Resume _PrintMgr_SetDefaultPrinter And some examples : #include <Array.au3> #include "PrintMgr.au3" _Example() Func _Example() ; Remove a printer called "My old Lexmark printer" : _PrintMgr_RemovePrinter("My old Lexmark printer") ; Remove the driver called "Lexmark T640" : _PrintMgr_RemovePrinterDriver("Lexmark T640") ; Remove the TCP/IP printer port called "TCP/IP" _PrintMgr_RemoveTCPIPPrinterPort("MyOLDPrinterPort") ; Add a driver, called "Samsung ML-451x 501x Series", and driver inf file is ".\Samsung5010\sse2m.inf" _PrintMgr_AddPrinterDriver("Samsung ML-451x 501x Series", "Windows NT x86", @ScriptDir & "\Samsung5010", @ScriptDir & "\Samsung5010\sse2m.inf") ; Add a TCP/IP printer port, called "MyTCPIPPrinterPort", with IPAddress = 192.168.1.10 and Port = 9100 _PrintMgr_AddTCPIPPrinterPort("MyTCPIPPrinterPort", "192.168.1.10", 9100) ; Add a printer, give it the name "My Printer", use the driver called "Samsung ML-451x 501x Series" and the port called "MyTCPIPPrinterPort" _PrintMgr_AddPrinter("My Printer", "Samsung ML-451x 501x Series", "MyTCPIPPrinterPort") ; Set the printer called "My Printer" as default printer _PrintMgr_SetDefaultPrinter("My Printer") ; Connect to the shared printer "\\192.168.1.1\HPDeskjetColor") _PrintMgr_AddWindowsPrinterConnection("\\192.168.1.1\HPDeskjetColor") ; List all installed printers Local $aPrinterList = _PrintMgr_EnumPrinter() _ArrayDisplay($aPrinterList) ; List all printers configuration Local $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration() _ArrayDisplay($aPrinterConfig) ; List all installed printer drivers Local $aDriverList = _PrintMgr_EnumPrinterDriver() _ArrayDisplay($aDriverList) ; Retrieve the printer configuration for the printer called "Lexmark T640" $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration("Lexmark T640") _ArrayDisplay($aPrinterConfig) ; Add a local printer port (for a file output) _PrintMgr_AddLocalPort("c:\temp\output.pcl") ; Remove the local port _PrintMgr_RemoveLocalPort("c:\temp\output.pcl") ; Enum a print job Local $aJobList = _PrintMgr_EnumPrintJobs() _ArrayDisplay($aJobList) EndFunc ;==>_Example Download link : PrintMgr_Example.au3 PrintMgr.au31 point
-
Version 2021.8.30.2
10,231 downloads
Use MouseClick() need: #RequireAdmin Dll is already integrated in UDF ! ; #INDEX# =============================================================== ; Title .........: ImageSearch ; AutoIt Version : 3.x ; Language ......: English ; Description ...: Check image Appears or Not and Return the position of an image on the desktop ; Author(s) .....: Dao Van Trong - TRONG.LIVE ; ======================================================================= ; #CURRENT# ============================================================= ; _ImageSearch ; _ImageSearch_Area ; _ImageSearch_Wait ; _ImageSearch_WaitArea ; ======================================================================== ;========================================================================= ; ; Author:...........: AutoIT VietNam : Dao Van Trong - TRONG.LIVE ; Description:......: Check image Appears or Not ; Find and return the position of an image on the desktop ; Syntax:........... _ImageSearch_Area, _ImageSearch ; Parameter(s):..... $_ImagePath: The image to locate on the desktop ; May be a list of image by delimited by "|" ; i.e: $_ImagePath = "image1.bmp|image2.bmp|image3.bmp" ; $P_x1 $P_y1: Position of 1st point ; $P_x2 $P_y2: Position of 2nd point - Default is last botton right of desktop ; $_Tolerance: 0 for no tolerance (0-255). Needed when colors of image differ from desktop. e.g GIF ; $_CenterPos: boolen. True will return $array[1] x $array[2] is center of image found. ; False will return top-left position ; Return Value(s):.. Return an array has 3 item ; On Success: $array[0] 1 ; On Failure: $array[0] 0 ; DLL not found or other error: $array[0] -1 ; $array[1] x $array[2]: position of image what found on desktop ; ; Note:............. Use _ImageSearch to search the entire desktop ; _ImageSearch_Area to specify a desktop region to search ; $_ImagePath with more item need more time appear on screen before function can detect. ; Decrease sleep time in the loop to detect faster. But less performance. I.e CPULoad increased ; ;======================================================================== EG 1: ;~ Opt("MustDeclareVars", 1) ;~ #AutoIt3Wrapper_UseX64=y ;~ #AutoIt3Wrapper_Change2CUI=y #RequireAdmin #include "_ImageSearch_UDF.au3" HotKeySet("{Esc}", "_Exit") ; Press ESC for exit Func _Exit() Exit 0 EndFunc ;==>_Exit Global Const $Ask_On_Found = 0 Global Const $Mouse_Move_On_Found = 1 Global Const $Mouse_Click_On_Found = 0 Global Const $iSleep_Time=500 Global $sCount = 0, $_Image_1 = @ScriptDir & "\example.bmp" ; First, use this function to create a file bmp, maybe a desktop icon for example') MsgBox(64 + 262144, 'ImageSearch', 'At first, create a file bmp,' & @CRLF & 'photos that will search on the screen!') _ImageSearch_Create_BMP($_Image_1) ConsoleWrite("! Search for images: " & $_Image_1 & @CRLF & '! Searching on the screen ...' & @CRLF) While 1 ToolTip('(Press ESC for EXIT) Searching ...', 1, 1) Sleep($iSleep_Time) $sCount += 1 Local $return = _ImageSearch($_Image_1) If $return[0] = 1 Then ConsoleWrite('- [' & $sCount & '] Image found:' & " X=" & $return[1] & " Y=" & $return[2] & @CRLF) If $Mouse_Move_On_Found Then MouseMove($return[1], $return[2]) Sleep($iSleep_Time) EndIf If $Mouse_Click_On_Found Then MouseClick("left", $return[1], $return[2]) ToolTip('(Press ESC for EXIT) - [' & $sCount & "] Image found:" & " X=" & $return[1] & " Y=" & $return[2], 1, 1) If $Ask_On_Found Then Local $ask = MsgBox(6 + 262144, 'Success [' & $sCount & ']', 'Image found:' & " X=" & $return[1] & " Y=" & $return[2]) If $ask = 2 Or $ask = 3 Or $ask = 5 Or $ask = 7 Then Exit ;No, Abort, Cancel, and Ignore If $ask = 10 Then _ImageSearch_Create_BMP($_Image_1) ; Continue ;Try Again EndIf EndIf Sleep(200) WEnd Video demo: [+] When any problem or error occurs, please make sure that:- Downloaded and used the latest version.- Set screen Screen Scale and layout = 100%- Installed display driver.- Tried turning off the antivirus- Full installation: Microsoft Visual C++ Redistributable 2005->2022 [+] You can download the AIO version of the Visual C++ Redistributable here: -> https://www.mediafire.com/file/0ak8dcj9mdn7nyq/VisualCppRedist_AIO_2005-2022_x86_x64_%5Btrong.live%5D.zip/file -> FOR Windows XP: https://www.mediafire.com/file/5m5lnr1kfg73tc9/VisualCppRedist_AIO_2005-2019_x86_XP_%5Btrong.live%5D.zip/file <!> Password for Extract: trong.live [+] The last full version of SCITE4AutoIT supports windows XP: https://www.autoitscript.com/autoit3/scite/download/archive/v19.1127.1402.0-SciTE4AutoIt3.exe1 point -
After EmguCV (OpenCV wrapper) UDF , I wanted to improve the concept of generating autoit udf bindings from c/c++ source files. GTK was a project that get my attention. That means: It is a heavy UDF with more that 8900 functions since they were generated from the gtk source files Complex gtk applications can be done with the UDF Functions keep the same name as in the source files prefixed with an underscore. The project is available here Prerequisites Download and extract gtk-autoit-bindings-v1.0.0-rc.0.7z into a folder Download and extract gtk-windows-4.3.2.7z into a folder Examples The classic Hello World #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** Opt("MustDeclareVars", 1) #Region ; when you don't know where the functions are ; - include all files ; - use Ctrl+J at each function to go to their location ; - add an include of the located file ; - redo until all your functions are found ; - then you can remove the include of gtk_all.au3 which is two times slower to start with ; #include "gtk-autoit-bindings\gtk_all.au3" #EndRegion ; when you don't know where the functions are #Region ; when you know where the functions are #include "gtk-autoit-bindings\include\glib-2.0\gio\gapplication.au3" #include "gtk-autoit-bindings\include\glib-2.0\gobject\gobject.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtkapplication.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtkapplicationwindow.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtkbutton.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtkwindow.au3" #EndRegion ; when you know where the functions are #include "gtk-autoit-bindings\gtk_callback.au3" #include "gtk-autoit-bindings\gtk_extra.au3" _Gtk_Open("gtk-windows-4.3.2\bin") main() _Gtk_Close() Func print_hello($widget, $data) ConsoleWrite("Hello World" & @CRLF) EndFunc ;==>print_hello Func activate($app, $user_data) Local $window = _gtk_application_window_new($app) _gtk_window_set_title($window, "Window") _gtk_window_set_default_size($window, 200, 200) Local $button = _gtk_button_new_with_label("Hello World") _g_signal_connect($button, "clicked", _gtk_callback("print_hello"), NULL) _gtk_window_set_child($window, $button) _gtk_window_present($window) EndFunc ;==>activate Func main() Local $app = _gtk_application_new("com.autoitscript.gtk.example", $G_APPLICATION_FLAGS_NONE) _g_signal_connect($app, "activate", _gtk_callback("activate"), NULL) Local $status = _g_application_run($app, 0, 0) _g_object_unref($app) EndFunc ;==>main A more complex one #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; Sources: ; https://docs.gtk.org/gtk4/getting_started.html#packing-buttons-with-gtkbuilder Opt("MustDeclareVars", 1) #Region ; when you don't know where the functions are ; - include all files ; - use Ctrl+J at each function to go to their location ; - add an include of the located file ; - redo until all your functions are found ; - then you can remove the include of gtk_all.au3 which is two times slower to start with ; #include "gtk-autoit-bindings\gtk_all.au3" #EndRegion ; when you don't know where the functions are #Region ; when you know where the functions are #include "gtk-autoit-bindings\include\glib-2.0\gio\gapplication.au3" #include "gtk-autoit-bindings\include\glib-2.0\gio\gfile.au3" #include "gtk-autoit-bindings\include\glib-2.0\glib\gmem.au3" #include "gtk-autoit-bindings\include\glib-2.0\gobject\gobject.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtkapplication.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtkbuilder.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtkscrolledwindow.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtkstack.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtktextbuffer.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtktextview.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtkwidget.au3" #include "gtk-autoit-bindings\include\gtk-4.0\gtk\gtkwindow.au3" #EndRegion ; when you know where the functions are #include "gtk-autoit-bindings\gtk_callback.au3" #include "gtk-autoit-bindings\gtk_extra.au3" Local $application = DllStructCreate("ptr window; ptr stack") _Gtk_Open("gtk-windows-4.3.2\bin") main() _Gtk_Close() Func application_init($app) ; Construct a GtkBuilder instance and load our UI description Local $builder = _gtk_builder_new() _gtk_builder_add_from_file($builder, "window.ui", Null) $application.window = _gtk_builder_get_object($builder, "window") $application.stack = _gtk_builder_get_object($builder, "stack") ; We do not need the builder any more _g_object_unref($builder) _gtk_window_set_application($application.window, $app) EndFunc ;==>application_init Func activate($app, $user_data) application_init($app) ; show these files by default Local $argv[2] = ["main.au3", "window.ui"] Local $file For $i = 0 To UBound($argv) - 1 $file = _g_file_new_for_path($argv[$i]) open_file($file) _g_object_unref($file) Next _gtk_window_present($application.window) EndFunc ;==>activate Func open_file($file) Local $contents = DllStructCreate("ptr value") Local $length = DllStructCreate("uint64 value") Local $basename = _g_file_get_basename($file) Local $scrolled = _gtk_scrolled_window_new() _gtk_widget_set_hexpand($scrolled, True) _gtk_widget_set_vexpand($scrolled, True) Local $view = _gtk_text_view_new() _gtk_text_view_set_editable($view, False) _gtk_text_view_set_cursor_visible($view, False) _gtk_scrolled_window_set_child($scrolled, $view) _gtk_stack_add_titled($application.stack, $scrolled, $basename, $basename) If _g_file_load_contents($file, Null, $contents, $length, Null, Null) Then Local $buffer = _gtk_text_view_get_buffer($view) _gtk_text_buffer_set_text($buffer, $contents.value, $length.value) _g_free($contents.value) EndIf _g_free($basename) EndFunc ;==>open_file Func open($app, $files, $n_files, $hint) Local $windows = _gtk_application_get_windows($app) Local $win If $windows Then $windows = DllStructCreate($tagGList, $windows) $win = $windows.data Else application_init($app) $win = $application.window EndIf $files = DllStructCreate("ptr value[" & $n_files & "]", $files) For $i = 1 To $n_files open_file($files.value(($i))) Next _gtk_window_present($win) EndFunc ;==>open Func main() Local $argc = UBound($CmdLine) Local $argv = DllStructCreate("ptr value[" & $argc & "]") ; create an array to keep reference to structs until the end of the function Local $tmp[$argc] Local $str For $i = 0 To $argc - 1 $str = $CmdLine[$i] $tmp[$i] = DllStructCreate("char value[" & BinaryLen(StringToBinary($str)) + 1 & "]") $tmp[$i].value = $str $argv.value(($i + 1)) = DllStructGetPtr($tmp[$i]) Next Local $app = _gtk_application_new("com.autoitscript.gtk.example", $G_APPLICATION_HANDLES_OPEN) _g_signal_connect($app, "activate", _gtk_callback("activate"), Null) ; _g_signal_connect($app, "open", _gtk_callback("open", "none:cdecl", "ptr;ptr;int;str"), Null) ; on windows, argv is completely ignored ; it is directly taken from the command line ; see https://gitlab.gnome.org/GNOME/glib/-/blob/2.69.2/gio/gapplication.c#L2460 Local $status = _g_application_run($app, $argc, $argv) _g_object_unref($app) Return $status EndFunc ;==>main window.ui <?xml version="1.0" encoding="UTF-8"?> <interface> <object id="window" class="GtkWindow"> <property name="title" translatable="yes">Example Application</property> <property name="default-width">600</property> <property name="default-height">400</property> <child type="titlebar"> <object class="GtkHeaderBar" id="header"> <child type="title"> <object class="GtkStackSwitcher" id="tabs"> <property name="stack">stack</property> </object> </child> </object> </child> <child> <object class="GtkBox" id="content_box"> <property name="orientation">vertical</property> <child> <object class="GtkStack" id="stack"/> </child> </object> </child> </object> </interface> More examples are available here A note on performance Before trying to convert everything to the autoit equivalent, keep in mind that autoit is slow when dealing with loops. For that reason, I recommend to create a dll that export functions that do the loops. autoit-addon is a dll project example.1 point
-
Regex help
Musashi reacted to JockoDundee for a topic
Wouldn’t the assignment statement to $target, even if short enough, need to come before the RegEx?1 point -
It appears that these lines are copied from SecurityConstants.au3 -- Global Enum $TOKENPRIMARY = 1, $TOKENIMPERSONATION Global Enum $SECURITYANONYMOUS = 0, $SECURITYIDENTIFICATION, $SECURITYIMPERSONATION, $SECURITYDELEGATION You can comment them out in the ImageSearch UDF, but then you will likely need to #include SecurityConstants.au31 point
-
Or you can use this : While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $P_VPOREFDATE _GUICtrlDTP_GetSystemTimeEx(GUICtrlGetHandle($P_VPOREFDATE)) $test_dt = @error = $GDT_NONE ? "" : GUICtrlRead($P_VPOREFDATE) ConsoleWrite("<" & $test_dt & ">" & @CRLF) EndSwitch WEnd1 point
-
You used the same variable in two different loops ; #71 For $i = 0 To _VectorOfVectorOfPointGetSize($contoursVect) - 1 ; #134 For $i = 0 To _VectorOfVectorOfDMatchGetSize($knn_matches) - 1 ; change it to For $j = 0 To _VectorOfVectorOfDMatchGetSize($knn_matches) - 1 _VectorOfVectorOfDMatchGetItemPtr($knn_matches, $j, $tVectorDMatchPtr)1 point
-
Do we want the Null-Coalescing Operator in Autoit?
Earthshine reacted to JockoDundee for a topic
Yes, I would agree. I was copying you Yes, agree. I guess I’ve never been totally happy with nulls, although thankful to have them. I don’t like how they are not transitive, although again I understand the argument. Anyway, I think AutoIt would be better with some form of them, besides null=0.1 point -
IniWrite returning zero on a file that is not read only
WhaleJesus reacted to Danp2 for a topic
A strategically placed ConsoleWrite would have identified the issue right away. You might want to give that a shot next time.1 point -
_Timer_GetIdleTime won't trigger
JockoDundee reacted to Musashi for a topic
Try this : #Region Init #include <AutoItConstants.au3> ;~ #include "ALK-Bots.au3" ;~ #include "Access_UDF.au3" #include <Array.au3> #include <MsgBoxConstants.au3> #include <File.au3> #include <FileConstants.au3> #include <Date.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <DateTimeConstants.au3> #include <Timers.au3> AutoItSetOption("WinTitleMatchMode", 2) ; Break für Abbruch HotKeySet("{BREAK}", "ExitScript") HotKeySet("{PAUSE}", "ExitScript") Global $Array, $ArrayError, $bSendNotification Func ExitScript() If MsgBox(4, "Break", "Break gedrückt. Programm stoppen?") = 6 Then Exit EndFunc ;==>ExitScript #EndRegion Init While 1 ConsoleWrite(_Timer_GetIdleTime() & @CRLF) If _Timer_GetIdleTime() > 12000 Then ; 5 minutes 300000 ConsoleWrite("_Timer_GetIdleTime > 12000 " & @CRLF) GetWindow() If UBound($ArrayError) < 2 Then ; If no window found MouseClick("left", 1168, 727) ConsoleWrite("MouseClick left 1168, 727" & @CRLF) Sleep(500) MouseClick("left", 267, 574, 2) ConsoleWrite("MouseClick left 267, 574" & @CRLF) ConsoleWrite("_Timer_GetIdleTime after MouseClicks = " & _Timer_GetIdleTime() & @CRLF) ; If the machine is still idle after 6000 ticks -> send a notification : $bSendNotification = False While Not $bSendNotification If _Timer_GetIdleTime() > 6000 Then $bSendNotification = True Notification() EndIf WEnd EndIf EndIf Sleep(100) WEnd Func GetWindow() ;~ $Array = WinList("GUI") $ArrayError = WinList("ASAL-ALK Hauptmenu nicht gefunden") EndFunc ;==>GetWindow Func Notification() ;~ WinSetState("megumin","",@SW_SHOW) ;~ Sleep(2000) ;~ WinActivate("megumin") ;~ Sleep(2000) ;~ Send("{TAB}") ;~ Sleep(1000) ;~ Send($Array[1][0]) ;~ Sleep(1000) ;~ Send("{Enter}") ;~ Sleep(1000) ;~ Send("{!}") ;~ Send("highlight 0") ;~ Sleep(1000) ;~ Send("{Enter}") ;~ Sleep(1000) ;~ WinSetState("megumin","",@SW_HIDE) MsgBox(0, "Idle", "Bot could've stopped") ;~ WinSetState("megumin", "", @SW_SHOW) ;~ Sleep(1000) ;~ WinActivate("megumin") ;~ Send("{TAB}") ;~ Sleep(1000) ;~ Send($Array[1][0] & " checked") ;~ Sleep(1000) ;~ Send("{Enter}") ;~ Sleep(1000) ;~ WinSetState("megumin","",@SW_HIDE) EndFunc ;==>Notification1 point -
Like in cards.py, boundingRect has to be called on each countour. The documentation of boundingRect only has one parameter and returns a cv::Rect. Usually the UDF has no return value and the last parameter will receive the returned value. Changes have been made in SearchContureDraw-v2.au3 Following cards.py, to crop an image based on a cv::Rect do: $boundingRect.x -= 15 $boundingRect.y -= 15 $boundingRect.width += 15 $boundingRect.height += 15 $cropped = _cveMatCreateFromRect($img_scene, $boundingRect) SearchContureDraw-v2.au31 point
-
You can use ResourcesEx UDF instead of FileInstall(). There is _ResourceSaveToFile() and #AutoIt3Wrapper_Res_File_Add=test_1.bin, rt_rcdata, TEST_BIN_1 EDIT: You can even add precompiled resources (instead of #AutoIt3Wrapper_Res_File_Add) So you can precompile your big files by rc.exe (resource compiler) from file.rc to file.res and this compiled res file add to compiled AutoIt's exe by this (I used it for precompiled set of icons): #AutoIt3Wrapper_useupx=n #AutoIt3Wrapper_run_after=ResHacker.exe -add %out%, %out%, ikony.res ,,, #AutoIt3Wrapper_run_after=upx.exe --best --compress-icons=0 "%out%" Compilation of (big) resources to from RC to RES will be done only once, not at each compilation of AU3 source! For your case look at these UPX options to exlude your big resource from UPX's compresion: --compress-resources=0 do not compress any resources at all --keep-resource=list do not compress resources specified by list Here is example with source of my precompiled icons ikony.rc: 201 ICON "sort_asc.ico" 202 ICON "sort_desc.ico" 203 ICON "connect.ico" 204 ICON "login.ico" 205 ICON "download.ico" 206 ICON "upload.ico" 207 ICON "mkdir.ico" 208 ICON "rmdir.ico" 209 ICON "rename.ico" 210 ICON "delete.ico" 211 ICON "chmod.ico" 212 ICON "none.ico" 213 ICON "warning.ico" 214 ICON "tl-smazat.ico" EDIT2: Here is link to my old topic where I posted attachment Resource compiler (RC52.zip)1 point
-
Might be helpful as far as I understood you:1 point
-
Good solutions from @Melba23 and @kylomas. Melba's is good for real-time and programmatic creation of the controls; Kylomas' is good for enumerating controls. I have one to offer as well which works best (for me) for "static" controls. I tend to use this method for most "complex" GUIs I make. Basically I create an array and ENUM constants at the beginning of the script that house all my GUI controls, then assign the array indexes to the controls when I create them. For example (snippet from my SubNet Calc script in signature): I start by creating an array with 1 element, set to "hwnd|id" Then I create constants using ENUM for the GUI ID/handle itself, each GUI control and a LAST const I Resize/ReDim the array increase the size to the hwnd/ID count (LAST const simplifies this) Global $aGUI[1] = ["hwnd|id"] Global Enum $hGUI = 1, $idDummyEnter, $idIPHost, $idIPSubnetMask, $idIPStart, $idIPEnd, $idIPNet, $idIPBroadcast, $idSubnetBits, $idHostCount, $iGUILast ReDim $aGUI[$iGUILast] Then I assign each control to the appropriate Array Index (using the Constants I created for easy reference. $aGUI[$hGUI] = GUICreate("IP Subnet Calc", 258, 330) $aGUI[$idDummyEnter] = GUICtrlCreateDummy() $aGUI[$idIPHost] = _GUICtrlIpAddress_Create($aGUI[$hGUI], 70, 33, 130, 18) $aGUI[$idSubnetBits] = GUICtrlCreateInput("0", 212, 33, 24, 18, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER)) $aGUI[$idIPSubnetMask] = _GUICtrlIpAddress_Create($aGUI[$hGUI], 70, 65, 130, 18) $aGUI[$idIPStart] = _GUICtrlIpAddress_Create($aGUI[$hGUI], 90, 133, 130, 18, $WS_DISABLED) $aGUI[$idIPEnd] = _GUICtrlIpAddress_Create($aGUI[$hGUI], 90, 165, 130, 18, $WS_DISABLED) ;etc... Hopefully this makes sense. I like doing this as it makes it very easy for me to access my controls from a variable (human readable). It may not suit your needs, but I figured I'd share yet another method. Here are a couple more scripts of mine (in my signature) that use this "convention" in case you want more examples: AU History Plasma_kIt VMWare ESX Builder1 point
-
This should work. Set variable $sGroup to the group you want to check membership: #include <file.au3> #include <AD.au3> #include <GuiConstants.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> _AD_ErrorNotify(2) Global $hUserName, $hPassword, $sUserName, $sPassword, $sGroup = "Test" $gui = GUICreate("Authenticate", 120, 170) GUICtrlCreateLabel("Username:", 10, 10, 50, 20) $hUserName = GUICtrlCreateInput("", 10, 35, 100, 20) GUICtrlCreateLabel("Password:", 10, 70, 50, 20) $hPassword = GUICtrlCreateInput("", 10, 95, 100, 20, $ES_PASSWORD) $go = GUICtrlCreateButton("OK", 10, 130, 50, 25, $BS_DEFPUSHBUTTON) $cancel = GUICtrlCreateButton("Cancel", 60, 130, 50, 25) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $go $sUserName = GUICtrlRead($hUserName) $sPassword = GUICtrlRead($hPassword) _AD_Open($sUserName, $sPassword) If @error Then MsgBox(64, "Error", "Authentication Failed! Try again!" & @CRLF & "@error: " & @error & ", @extended: " & @extended) Exit ElseIf _AD_IsMemberOf($sGroup) <> 1 Then MsgBox(64, "Error", "User is not member of group '" & $sGroup & "'!" & @CRLF & "@error: " & @error & ", @extended: " & @extended) _AD_Close() Exit EndIf _AD_Close() ; Output Username to a log file with date and time ; _FileWriteLog(@ScriptDir & "Username.log", GUICtrlRead($hUserName)) ; ShellExecute("C:\Program Files\Internet Explorer\iexplore.exe") Case $cancel, $GUI_EVENT_CLOSE Exit EndSwitch WEnd GUIDelete($gui)1 point