twixt Posted April 16, 2016 Share Posted April 16, 2016 I am wanting to automate a task at work, and trying to decide whether to use AutoIt or something like VB or python. I am very new at this and looking to learn a bit, but fear this task would overwhelm me if i went straight to creating the code in VB, python, C++, etc, due to having to interact with many existing programs and such. I have been digging in the help contents of AutoIt and browsing the forums and seem to have hit a snag over my head. Since I wanted each button to handle various tasks and other programs, I figured I would use Opt("GUIOnEventMode", 1). However I ran into this thread https://www.autoitscript.com/wiki/Interrupting_a_running_function and realized if any of my defined functions fail for whatever reason, the whole thing will have a hard time recovering. Also I could not seem to find how to have one button(function) set checkboxes when complete without letting the user accidentally interact with them.... I looking for a single GUI to 1. open and control programs like PuTTY, (or equivalent) Octave, the clipboard, Paint, A custom python.exe to listen to a port. 2. create file directories using input folder names, move files from the temp directory the python.exe created to the created directories, copy plot generated from octave to the clipboard to paste in paint and add a text header. 3. somehow display progress Should I even bother doing this in AutoIT or bite the bullet and go to python? Thanks for your time Link to comment Share on other sites More sharing options...
Danyfirex Posted April 16, 2016 Share Posted April 16, 2016 Hi. Of course to AutoIt. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
InunoTaishou Posted April 16, 2016 Share Posted April 16, 2016 Idk, I think this might be a task to do in assembly. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 16, 2016 Moderators Share Posted April 16, 2016 @InunoTaishou, the OP is just learning AutoIt, and your suggestion is to have him try and make a leap to assembly?! "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Skysnake Posted April 16, 2016 Share Posted April 16, 2016 Hi. I am not a developer or programmer, but use AutoIt in my office to do quite a lot of automation. Perhaps the question here to answer is, are these typically automation of Windows tasks? This is the prime reason AutoIt was developed, and if you are working in (a) the Windows environment (only) and (b) the tasks can all be defined as "automation" tasks, then I think you are in the right place. Stick to AutoIt. If the answers are "No" then perhaps python may indeed be a better option. I have to tell you that before discovering AutoIt I had fancy batch files that did most of my work. Now I have GUIs, progress bars and logfiles Good luck. Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
twixt Posted April 16, 2016 Author Share Posted April 16, 2016 Thanks for the reply skysnake. Yes I believe this is primarily automation of windows tasks, as currently I complete the process manually using different programs and creating directories manually. It was automated once through VB but the PC crashed and the author doesnt work there anymore and left no source files. The parts to complete the test are all there, it is kinda disjointed and tedious when trying to show someone else how to complete the test. I did a rough outline and wanted to create the basic UI first, then fill in the user defined functions for each task next. However I know that sometimes those tasks dont finish well. ( the target SBC can hang or pause during the scan for unknown reasons ) I have used autoit for simple tasks before, but have never created my own GUI for a task involving this many different steps. So far its starting to get complicated enough I was beginning to think that if I was going to go this "deep" would I spend my time better learning more coding instead. I do enjoy this stuff either way, hence me being here on the weekend ha! Link to comment Share on other sites More sharing options...
twixt Posted April 16, 2016 Author Share Posted April 16, 2016 Here is what I have so far. The easy part is done I think. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: name Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- #include <GUIConstants.au3> #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> #include <StaticConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> DyCal() Func DyCal() Opt("GUIOnEventMode", 1) GUICreate("DyCal", 800, 500) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents") GUICtrlCreateButton( "PuTTY", 1, 51, 100, 50) GUICtrlSetOnEvent(-1, "PuTTY") GUICtrlCreateButton("Start Server", 102, 51, 100, 50) GUICtrlSetOnEvent(-1, "Start Server") GUICtrlCreateButton("Initialize", 203, 51, 100, 50) GUICtrlSetOnEvent(-1, "Initialize") GUICtrlCreateButton("Memsave", 304, 51, 100, 50) GUICtrlSetOnEvent(-1, "Memsave") GUICtrlCreateButton("Run Scan", 405, 51, 100, 50) GUICtrlSetOnEvent(-1, "Run Scan") GUICtrlCreateButton("Octave Plot", 506, 51, 100, 50) GUICtrlSetOnEvent(-1, "Octave Plot") GUICtrlCreateInput("SN_", 10, 120, 80, 20, $ES_NUMBER) GUICtrlCreateInput("SN_", 100, 120, 80, 20, $ES_NUMBER) GUICtrlCreateInput("SN_", 200, 120, 80, 20, $ES_NUMBER) GUICtrlCreateInput("SN_", 300, 120, 80, 20, $ES_NUMBER) GUICtrlCreateButton("Save SN", 400, 120, 80, 25) GUICtrlSetOnEvent(-1, "MK_DIR") Local $idTreeview = GUICtrlCreateTreeView(1, 175, 350, 200, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) Local $id485item = GUICtrlCreateTreeViewItem("485 MHz", $idTreeview) GUICtrlSetColor(-1, 0x0000C0) Local $idScanitem = GUICtrlCreateTreeViewItem("Scan", $id485item) Local $idPlotitem = GUICtrlCreateTreeViewItem("Plot", $id485item) GUICtrlCreateTreeViewItem("Set 1",$idScanitem) GUICtrlCreateTreeViewItem("Set 2",$idScanitem) GUICtrlCreateTreeViewItem("Set 3",$idScanitem) GUICtrlCreateTreeViewItem("Set 4",$idScanitem) GUICtrlCreateTreeViewItem("Set 1",$idPlotitem) GUICtrlCreateTreeViewItem("Set 2",$idPlotitem) GUICtrlCreateTreeViewItem("Set 3",$idPlotitem) GUICtrlCreateTreeViewItem("Set 4",$idPlotitem) Local $idTreeview2 = GUICtrlCreateTreeView(351, 175, 350, 200, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE) Local $id985item = GUICtrlCreateTreeViewItem("985 MHz", $idTreeview2) GUICtrlSetColor(-1, 0x0000C0) Local $idScan2item = GUICtrlCreateTreeViewItem("Scan", $id985item) Local $idPlot2item = GUICtrlCreateTreeViewItem("Plot", $id985item) GUICtrlCreateTreeViewItem("Set 1",$idScan2item) GUICtrlCreateTreeViewItem("Set 2",$idScan2item) GUICtrlCreateTreeViewItem("Set 3",$idScan2item) GUICtrlCreateTreeViewItem("Set 4",$idScan2item) GUICtrlCreateTreeViewItem("Set 1",$idPlot2item) GUICtrlCreateTreeViewItem("Set 2",$idPlot2item) GUICtrlCreateTreeViewItem("Set 3",$idPlot2item) GUICtrlCreateTreeViewItem("Set 4",$idPlot2item) GUICtrlSetState($id485item, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) ; Expand the "General"-item and paint in bold GUICtrlSetState($id985item, BitOR($GUI_EXPAND, $GUI_DEFBUTTON)) ; Expand the "General"-item and paint in bold GUISetState(@SW_SHOW) While 1 Sleep(10) WEnd EndFunc Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE Case @GUI_CtrlId = $GUI_EVENT_RESTORE EndSelect EndFunc ;==>SpecialEvents Link to comment Share on other sites More sharing options...
Skysnake Posted April 18, 2016 Share Posted April 18, 2016 I see a busy GUI May I suggest you take one of those functions/buttons and spend some time on getting one to work? Eg Putty. Make a function only for that. See how the Run/RunAs/RunWait functions work, then write output to Console/Logfiles (_FileWriteLog) and see what it does for you. If may also be a good opportunity to learn to write results to INI files. Breaking it down into discrete steps/functions may make it easier. Good luck Skysnake Why is the snake in the sky? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now