Leaderboard
Popular Content
Showing content with the highest reputation on 01/11/2014 in all areas
-
Hello Community, here's the latest update on... SMF - Search my Files Current Version: v17 (2024-Oct-20) SMF - Search my Files features A good looking GUI, Search files by location, Search files and / or folders, Poll [-]File names and Locations in Long and Short (8.3) format, [-]File Extensions, [-]File Times (modified, created, accessed), [-]File size, [-]File Attributes, [-]File Extended Attributes, Filter by [-]Extension, [-]Attribute, [-]File size, [-]File time, Free Name filtering by usage of RegEx, GUI designed to fit to 800x600 desktops with Tab-Design Nice looking Icon Minimize to Tray (also while searching) Export Result to CSV-file Export Result to XML-file Save & Load search runs Build Tree for local Computer on StartUp, add NetworkDrives optional A separate Report-GUI [-]Pre-Select output columns [-]SQLite driven [-]Dynamically generated statements, fully user adjustable [-]Dynamically sub filtering of results on the fly [-]Results can be executed directly, starting with the default associated program (ShellExcecute) [-]Select Results by drag, copy selected URIs to clipboard [-]Copy, move, delete or Erase results or subset of results md5 driven Duplicate file finder [-]High-Performance [-]added trimmed md5 short calculation (false md5, but sufficient for dup-search and a great speed improvement!) [-]Search 30.000 pics for dups in 1min 30secs Added many other ideas (some not activated / implemented yet) Limitations / Bugs / ToDos Lots and lots of unnecessary Global Variables Ugly code PLUS violations of any coding principal known to man... But hey, thats why I release the source, so that YOU help me to further improve SMF... SMF works fine at least on the 32bit XP SP3 and 64bit Win7/Win8/Win10 machines and I've tested it on. If you find bugs please let me know. Thanks to my sweet girlfriend for reviewing, giving new ideas and having so much patience with me :-*. Thanks to Jon, Larry, Jos, Valik, Jpm, Melba23 and Trancexx and for creating AutoIt and maintaining the forum. And finally thanks to all these great guys from the forum, providing excellent UDFs, snippets of code I use in SMF or help and feedback: Achilles, Ascend4nt, Ed_Maximized, Elgabionline, Erik Pilsits (Wraithdu), Eukalyptus, Gafrost, Holger Kotsch, Jarvis J. Stubblefield (JSThePatriot), Jos, Lahire Biette, Lazycat, Lod3n, Prog@ndy, Ptrex, Rasim, RazorM, RobSaunders, Sean Hart, Siao, Simucal, Smashly, SmOke_N, Teh_hahn, Valik, Ward, WideBoyDixon, Yann Perrin, Yashied & Zedna. Please let me know if you found some piece of code in the source for which I forgot to mention a credit. The executable and the source can be downloaded from my site: https://funk.eu Enjoy, let me know what you think of SMF and with Best Regards1 point
-
Context It's been a while since I have discovered AutoIt and I believe it is absolutely awesome. After developing some little scripts I have come across the need for developing a bigger application. I quickly understood I would have to apply the Model View Controller design pattern. I have quite some experience with Object Oriented programming languages however I lack knowledge of functional scripting languages. As the forums didn't give me the answers I searched for I developed a little application which tries to apply the MVC design pattern. My request Could following example of the application of the MVC in AutoIt be valdated? Every remark, comment, input would be greatly appreciated: - the application of the MVC pattern in AutoIt - the structure of the code - the coding conventions I used - general usage of AutoIt - ... Functionality of the program The application stores a configuration of a database in it's state: - database server - database name - database username - database password When the program is launched, an INI file is read with contains the configuration. The data of the INI file is stored in the state of the program. The user can then consult and adapt the configuration. Once the application is stored the program writes back it's state to the INI file. Graphical User Interface The main window The use can consult the stored configuration of modify the configuration. The consultation window All the user can do is close the window. The modification window Here the user can modify the configuration Once modified, the user can confirm the modification or cancel it. Most important au3 files /Application.au3_________________________The application is launched with this file /model/Configuration.au3_________________Manipulation of the state of the application /model/ConfigurationFile.au3_____________Writing the state to an INI file /view/Main.au3___________________________The main window /view/ConsultConfiguration.au3___________The window to consult the configuration /view/ModifyConfiguration.au3____________The window to modify the configuration /controller/Main.au3_____________________The controller of the main window /controller/ConsultConfiguration.au3_____The controller of the window to consult the configuration /controller/ModifyConfiguration.au3______The controller of the window to modify the configuration Comments on the structure of the code /model/Configuration.au3 The state of the application is stored in following variables Global $stateDatabaseServer Global $stateDatabaseName Global $stateDatabaseUsername Global $stateDatabasePassword The state should only be accessed via following operations _GetDatabaseServer() _SetDatabaseServer($parDatabaseServer) _GetDatabaseName() _SetDatabaseName($parDatabaseName) _GetDatabaseUsername() _SetDatabaseUsername($parDatabaseUsername) _GetDatabasePassword() _SetDatabasePassword($parDatabasePassword) As the model contains all data, it is the only one who can perform validations on it _IsConfigurationValid($parDatabaseServer, $parDatabaseName, $parDatabaseUsername, $parDatabasePassword) Views only contain presentation logic. The initialization of a view can be parametrized as it can contain dynamic data. Func _View_ConsultConfiguration_Create($parDatabaseServer, $parDatabaseName, $parDatabaseUsername, $parDatabasePassword) Although the views catch the events of the GUI, it's the associated controller who handles the functionality behind the event. Catching the events of the main window Func _View_WindowWelcome_HandleEvents() While $guiMainLoop Local $varMessage = GUIGetMsg() Select Case $varMessage = $GUI_EVENT_CLOSE _Controller_Main_WindowClosed() Case $varMessage = $guiMainButtonConsult _Controller_Main_ButtonConsultPressed() Case $varMessage = $guiMainButtonModify _Controller_Main_ButtonModifyPressed() EndSelect WEnd EndFunc Handling the events by the controller. The controller can access the public functions of the model layer. Func _Controller_Main_WindowClosed() _View_Main_Destroy() _WriteConfiguration() EndFunc Func _Controller_Main_ButtonConsultPressed() _View_Main_Destroy() _Controller_ConsultConfiguration_Initialize() EndFunc Func _Controller_Main_ButtonModifyPressed() _View_Main_Destroy() _Controller_ModifyConfiguration_Initialize() EndFunc The sourcecode The sources of this program are included as an attachment of this post. I will give my best try to answer all your questions and take into account your remarks. Thanks to all of you who will help me out with this. I really appreciate your help. example.zip1 point
-
Batch script from memory protected?
Unc3nZureD reacted to GeekIT for a topic
SOLVED with just a single answer on another forum: - Make the source in Autoit: Run(@ComSpec & ' /C "' & @ScriptDir & '\start.bat"')- Open Enigma VB - Tick in the Options/Share Virtual files - Add the bat file to the default folder --> Enigma doesn't allow you to start bat directly, this way I'm starting the cmd.exe with the paramater to your bat file which you shared with the cmd.exe before - I suggest to tick in at the files menu/options the compression - Build it ______________________ P.s.: Of course Enigma VB isn't perfect. There's a way to devirtualize files from it, but noobies won't be able to do it. It should require some other programming language, DLL making experience, some Reverse Engineering knowledge, etc. thanks Unc3nZureD1 point -
Yes, there needs to be an AutoIt3Wrappe.exe as well as that is started by the different shortcuts. Just do a reinstall of the SciTE4utoIt3 installer. Jos1 point
-
Using For...In with an Array is only useful if you're reading the contents of the Array. From past experience people tend not to read the help file thoroughly, so by getting into the habit of using For...To, will stop posts on the lines of "AutoIt is broken, can't write to Array entry" as they're using For...In. Tell me, did you know that Arrays couldn't be written to in a For...In loop until I told?1 point
-
Ternary operator clarification ($1 = 0) ? ($b = 0) : ($b = 1)
jaberwacky reacted to trancexx for a topic
I explicitly disallowed that back then in hope someone would ask for it in future. (It should have been nice game that I never got to play.) Yes, it's possible. Make feature request and see what Jon says. This isn't just syntactic sugar, being able to omit second argument makes valuable difference. For example here: $c = $a ? $a : $b ... $a is evaluated twice, whereas here: $c = $a ?: $b ...only once. At first you may not realize the quality of the difference, until you gear-up and imagine what would happen if $a isn't simple variable but, for example function call. In former case, that function would possibly be called twice based on it's return. All in all, it would make nice addition to the feature1 point -
Good coding practices in AutoIt
guinness reacted to jaberwacky for a topic
Model - View - Controller Let's talk about something which I have only recently just begun to grasp. I grasp it well enough to describe it's basics. I hope. I will endeavor to provide a basic explanation and describe some methods to implement MVC into AutoIt scripts. At least one of you might say that this does not pertain to AutoIt. But it does I think. The MVC pattern is many and varied. There does not seem to be one agreed upon method. There are other modern flavors too such as Model View Presenter and Model View ViewModel none of which I have begun to look into. So let's begin with the model. Model The model knows how to perform your program's calculations. It has your algorithms. The model also has a database if your program has one. The model maintains your program's state. It's the brains of the operation. View This module manages your GUI essentially. This module doesn't perform its own program calculations. The view just takes the data that is feed to it and presents it on the screen. Controller This module coordinates the user's actions with the model and the view. If the user clicks on a button or enters information into an input field it then takes that information and does one or many things with it. The controller may take the information and give it to the model to store in a database. If a user clicks a button the controller may then ask the model for the result of a calculation. Then the controller may take this information from the model and give it to the view. For example it may take a list of customer names from the model and then give it to the view which may then update a listview control with that list. The common method of MVC seems to be the following picture: (http://www.songho.ca/opengl/files/gl_mvc01.png) The way that I use MVC in AutoIt is to leave out the arrow connecting the View and the Model. The controller can call functions in the View and can call functions in the Model. The model can not call functions in the Controller or the View. Conversely, the View may not call methods in the Model or the Controller. Here is an oversimplified example: Model.au3 #include-once Func _model_get_username() Return @UserName EndFunc View.au3 #include-once GUICreate("My Program", 100, 100) Global Const $h_label = GUICtrlCreateLabel('', 10, 10, 80, 80) Func _view_display_username(Const $username) GUICtrlSetData($h_label, $username) EndFunc Controller.au3 $include "View.au3" $include "Model.au3" Global Const $account_username = _model_get_username() _view_display_username($account_username) Do Switch GUIGetMsg() Case $gui_close_event Exit EndSwitch Until False I'm sure I will amend this document throughout the next day or two so check back. Fell free to offer enhancements etc.1 point -
Try the $LVS_SHOWSELALWAYS style to enable the behavior all the time, or _GUICtrlListView_EnsureVisible to scroll to the selected specified item when called. Edit: It goes to the item with the specified index.1 point
-
Model View Controller -- advice
mvk25 reacted to jaberwacky for a topic
Hi, I've been reading up on MVC lately, so I decided to implement my own MVC according to my best understanding. Will you tell me how far short of the mark this code falls? Any other thoughts, ideas, etc will be appreciated too. And yea, this is a simple toy example. #AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 3 -w 4 -w 6 -d #include "AutoItObject.au3" #include <GUIConstantsEX.au3> HotKeySet("{ESC}", "_term") Opt("GUIOnEventMode", 1) _AutoItObject_Startup() Global $Controller = Controller() Global $Form = GUICreate("MVC Example", 200, 200) Global $Label = GUICtrlCreateLabel("", 10, 10, 280, 25) Global $Button = GUICtrlCreateButton("Click ME!", 100, 100) GUISetOnEvent($GUI_EVENT_CLOSE, "Close") GUICtrlSetOnEvent($Button, "ClickButton") GUISetState() While 1 Sleep(1000) WEnd Func Close() _term() EndFunc ;==>Close Func ClickButton() Return $Controller.Buttonclick($Label) EndFunc ;==>ClickButton _term() Func _term() $Controller = 0 _AutoItObject_Shutdown() Exit EndFunc ;==>_term #region Controller Func Controller() Local $this = _AutoItObject_Create() _AutoItObject_AddProperty($this, "View", $ELSCOPE_PRIVATE, View()) _AutoItObject_AddMethod($this, "Buttonclick", "_Controller_Buttonclick") Return $this EndFunc ;==>Controller Func _Controller_Buttonclick($this, $ctrl) Return $this.View.Buttonclick($ctrl) EndFunc ;==>_Controller_Buttonclick #endregion Controller #region View Func View() Local $this = _AutoItObject_Create() _AutoItObject_AddProperty($this, "Model", $ELSCOPE_PRIVATE, Model()) _AutoItObject_AddMethod($this, "Buttonclick", "_View_Buttonclick") Return $this EndFunc ;==>View Func _View_Buttonclick($this, $ctrl) Local $data = $this.Model.SendData() Return GUICtrlSetData($ctrl, $data) EndFunc ;==>_View_Buttonclick #endregion View #region Model Func Model() Local $this = _AutoItObject_Create() _AutoItObject_AddProperty($this, "Data", $ELSCOPE_PRIVATE, "I'm a banana!") _AutoItObject_AddMethod($this, "SendData", "_SendData") Return $this EndFunc ;==>Model Func _SendData($this) Return $this.Data EndFunc ;==>_SendData #endregion Model1 point