ebook img

Practical Laboratory Automation. Made easy with AutoIt PDF

223 Pages·2017·9.493 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Practical Laboratory Automation. Made easy with AutoIt

Practical Laboratory Automation MadeEasywithAutoIt MatheusC.Carvalho Dr.MatheusC.Carvalho SouthernCrossUniversity CentreforCoastalBiogeochemistryRes. POBox157,Lismore,NSW,2480 2480Lismore Australia ©2017Wiley-VCHVerlagGmbH&Co.KGaA, Boschstr.12,69469Weinheim,Germany PrintISBN:978-3-527-34158-0 ePDFISBN:978-3-527-80198-5 ePubISBN:978-3-527-80196-1 MobiISBN:978-3-527-80197-8 oBookISBN:978-3-527-80195-4 Contents Foreword xiii Preface xv 1 Introduction 1 1.1 ABriefStoryofLaboratoryAutomation 1 1.2 ApproachesforInstrumentIntegration 2 1.2.1 TheUsualApproachforInstrumentIntegration 2 1.2.2 InstrumentIntegrationwithScripting 3 1.3 ScriptingversusStandardizationinLaboratoryAutomation 3 1.4 TopicsCoveredinthisBook 5 1.5 LearningbyDoing:FACACOandFAKAS 7 1.6 Summary 10 SuggestedReading 10 2 TheVeryBasicsofAutoIt 13 2.1 WhatIsAutoIt? 13 2.2 AlternativestoAutoIt 14 2.3 GettingAutoIt 15 2.4 WritingYourFirstScript(MouseClickAutomation) 15 2.5 KnowingMoreaboutSciTE 16 2.5.1 WritingAids 17 2.5.2 TheConsole 18 2.6 AutoItonLinux 18 2.7 Summary 18 SuggestedReading 19 3 TimedScripts 21 3.1 ControllingtheTimingofActions 21 3.2 MovingandActivatingWindows 22 3.3 SendingKeyboardInputs 23 3.4 “For”LoopsandVariables 23 3.4.1 AutomatingFAKAS 25 3.4.2 FirstviewofAutoItv3WindowsInfo(AWI) 26 3.4.3 AU3Recorder 28 3.4.4 AutomatingFACACO 29 3.5 OrganizingYourCode:FunctionsandLibraries 29 3.5.1 CallingFunctionsfromDifferentFiles 31 3.6 ReplacingMouseClickswithKeyboardShortcuts 32 3.7 Summary 34 4 InteractiveScripting 35 4.1 WindowMonitoring 35 4.2 PixelMonitoring 37 4.3 “While…WEnd”LoopsforPixelMonitoring 39 4.4 SynchronizingFACACOandKAKASUsingPixelMonitoring 40 4.5 EnhancedPixelMonitoringUsingPixelCheckSum 43 4.6 BlockingAccesstoKeyboardandMouse 46 4.7 Summary 46 5 ScriptingwithControls 49 5.1 UsingAWItoGetControlInformation 49 5.2 FunctionsThatProvideControlInformation 51 5.3 SendingCommandstoControls 52 5.4 SynchronizingFACACOandFAKASUsingControls 52 5.5 DealingwithErrors:If…Then 55 5.6 InfiniteLoopsandControls 57 5.7 Summary 59 6 E-mailandPhoneAlarms 61 6.1 E-mailAlarms 61 6.1.1 SendingE-mailUsingThird-PartySoftware 61 6.1.2 SendingE-mailUsingSMTP 63 6.2 SMSandPhoneCallAlarms 65 6.2.1 SendingSMS 65 6.2.2 MakingPhoneCalls 66 6.3 Summary 69 7 UsingLow-CostEquipmentforLaboratoryAutomation 71 7.1 G-CodeDevices 71 7.1.1 CNCRouters 71 7.1.2 G-CodeforCNC 73 7.1.3 SynchronizingaCNCRoutertoaLaboratoryInstrument 74 7.1.4 3DPrinters 75 7.2 RoboticArms 76 7.3 Do-It-YourselfDevices 77 7.4 Summary 77 SuggestedReading 78 8 ArraysandStrings 79 8.1 OrganizedData:Arrays 79 8.2 RawData:Strings 80 8.3 Summary 82 9 DataProcessingwithSpreadsheets 83 9.1 ExportingResultstoSpreadsheetSoftware 83 9.1.1 SelectingSpreadsheetSoftware 83 9.1.2 TransferringDatatoSpreadsheets 84 9.1.3 TransferringDatainRealTime 87 9.2 DealingwithSavedResults(Files) 87 9.3 ProcessingSpreadsheetFiles 91 9.4 Summary 94 10 WorkingwithDatabases 95 10.1 StartingSQliteinAutoIt 95 10.2 CreatingSQliteDatabases 96 10.3 ModifyinganExistingSQliteDatabase 99 10.4 DatabaseswithMoreThanOneTable 101 10.5 RetrievingDatafromDatabases 102 10.6 Summary 104 11 SimpleRemoteSynchronization 107 11.1 TimeMacros 107 11.2 SynchronizingFACACOandFAKASUsing TimeMacros 108 11.3 Summary 109 12 RemoteSynchronizationUsingRemoteControlSoftware 111 12.1 TeamViewer 111 12.2 SynchronizingFACACOandFAKASUsing TeamViewer 112 12.3 Summary 115 13 Text-BasedRemoteSynchronization 117 13.1 ChoosingInstantMessagingSoftware 117 13.2 WritingandReadingfromTrillianUsingAutoIt 119 13.3 SynchronizingFACACOandFAKASUsingTrillian 121 13.4 Summary 123 14 RemoteSynchronizationUsingIRC 125 14.1 AutoItandIRC 125 14.2 MonitoringtheConnection 126 14.3 SynchronizingFACACOandFAKAS 130 14.4 FinalConsiderations 132 14.5 Summary 133 15 RemoteSynchronizationUsingWindowsLANTools 135 15.1 ConnectingtoaLAN 135 15.2 CreatingaSharedFolder 137 15.3 SynchronizingFACACOandFAKAS 139 15.4 Summary 140 16 RemoteSynchronizationUsingThird-PartyLANSoftware 143 16.1 ConnectingtoaLANUsingBingo’sChat 143 16.2 AutomatedCommunicationUsingBingo’sChat 144 16.3 SynchronizingFACACOandFAKAS 147 16.4 Summary 148 17 InteractingwithDevicesviaCOMPorts 149 17.1 SerialCommunicationProtocols 149 17.2 AutoItandCOMPorts 150 17.3 MonitoringinRealTime 153 17.4 ImplicationsforOtherDevices 157 17.5 OtherTechnologiesforInstrumentControl 157 17.6 Summary 157 SuggestedReading 158 18 IntroductiontoGraphicalUserInterface(GUI) 159 18.1 MakingaVerySimpleGUI 159 18.2 AddingSimpleElementstoaGUI 161 18.3 SettingKeyboardShortcuts 163 18.4 Summary 165 19 UsingGUItoControlInstruments 167 19.1 GUIstoControltheEHMAValveActuator 167 19.2 ControllingTwoorMoreCOMPortsintheSameScript 169 19.3 AGUItoControlaDigitalBalance 171 19.4 Summary 174 20 MultitaskingGUIs 177 20.1 The“GUIOnEventMode”Option 177 20.2 MultitaskingUsingGUIOnEventMode 179 20.3 Summary 182 21 AddingGraphicalElementstoaGUI 183 21.1 GettingStartedwithGDIplus 183 21.2 CreatingAnimationsUsingGDIplus 185 21.3 Summary 189 22 CreatingGUIsUsingKoda 191 22.1 GettingStartedwithKoda 191 22.2 CreatingaScript 194 22.3 Summary 196 23 SomeSuggestions 197 23.1 ForManufacturers:AllInstrumentswithaGUI 197 23.2 ForManufacturers:AllGUIswithAccesstoControls 197 23.3 ForManufacturers:StopDevelopingStandardsforLaboratory Automation 197 23.4 ForUsers:HardwareTrumpsSoftware 198 23.5 ForUsers:IfYouCan,ChooseControls 198 23.6 ForUsers:AutoItMayNotbetheBestProgrammingOption inSomeCases 198 23.7 ForUsers:BeAwareofTechnologicalAdvances 199 23.8 ForUsersandManufacturers:AutoItScriptsMayServeas BasisforNewProducts 199 SuggestedReading 199 A OtherSciTEFeatures 201 A.1 CodeWizard 201 A.2 OrganizingYourScriptswithTidy 202 A.3 ToolsthatFacilitateNavigation 203 B OpticalCharacterRecognition 207 B.1 OCRinAutoIt 207 B.2 CopyingfromtheScreenandApplyingOCR 209 C ScriptingwithNonstandardControls(UIA) 211 C.1 DownloadingtheUIASoftwarePackage 211 C.2 SendingInstructions 212 C.2.1 MouseClicks 213 C.2.2 KeyboardInputs 216 C.3 GettingInformationaboutControls 217 C.3.1 GettingInformationfromFAKASControls 218 C.3.2 GettingInformationfromControlsofOtherPrograms 220 C.4 AutomatingaLabViewProgram 221 C.5 Summary 222 Index 223 Foreword Wouldyouliketohavealabassistantwillingtodothemosttediousrepetitivetasksin yourlaboratoryperfectlyeverytime?Wouldyoulikethatlabassistanttoworkforafew centsanhourfor24haday,7daysaweek,365daysayear?Betteryet,wouldyoulikethe salaryofthatlabassistantcoveredundertheoperationaloverheadofyourinstitution? Thisisallmorethanpossiblewiththelaboratoryautomationwizardryexplainedin detailbyMatheusCarvalhointhisbook.PracticalLaboratoryAutomation–MadeEasy withAutoItisatourdeforceinlaboratoryautomation.Itallowsscientiststoharness automationtoradicallyincreaseproductivityasiscommoninindustry.Specifically,Car- valhoguideseventhemostinexperienceduserintoadeepdiveofAutoItinthecontextof laboratoryautomation.AutoItisazero-costsoftwaretoolthatautomatesmouseclicks and keyboard entries in Windows. These properties enable seamless integration into theoperationofotherprograms–liketheshockinglyexpensiveproprietaryprograms thatcomebundledwithmostconventionalmodernscientificequipment.AutoItsource codewasopenlyreleasedundertheGNUGPL(uptov.3.22006),andthenwentontwo paths.TheAutoHotkeyprojectremainsopensourceandAutoItbecameclosedsource, butremainsfreewarewithasupportiveonlinecommunity. MyownintroductiontoAutoItcameseveralyearsagowhenweneededtomakethe same measurement in my laboratory every few minutes for hundreds of hours con- tinuously. This was a waste of time for even the least-skilled and poorly paid student researcher. The obvious solution was to add a single loop to the equipment vendor’s proprietarysoftwarerunningthetooltomakethemeasurements.Thevendortriedto extortthousandsofdollarsfromustoincludethisnewfunctionality.Unfortunatelyfor the vendor, a student found AutoIt. Our problem was solved in seconds. Now a few penniesofelectricitywouldenabletheworstmeasurementinmylaboratorytobecom- pletedwithoutanywastedstudenthour.BesidesteachingmethevalueofAutoIt,this experiencesetmeonthepathoffirstmakingourownscientifictoolsandeventuallyinto theopen-sourcescientifichardwarecommunity.Thishassavedmylaboratoryhundreds ofthousandsofdollarsandPracticalLaboratoryAutomationmaydothesameforyou. Now our initial use of AutoIt is trivial compared to the super user abilities that Carvalho demonstrates throughout this book. This is a book you should read with a computer on your lap so that you can ensure you learn the skills by trying them out as Carvalho explains new techniques. You will walk away after reading it with the technicalskillstoautomateeventhemostcomplexscientificequipment.Ishouldpoint out that although the techniques Carvalho explains in this book are complex (e.g., pixel monitoring, scripting, and remote synchronization) this book is written for the nonspecialist Windows user. It really has been “made easy.” Anyone who works in a laboratory–evenifhe/shedoesnotknowanythingaboutcoding,robotics,embedded systems, or microcontrollers will have no problem using the techniques discussed to automate his/her own equipment. As Practical Laboratory Automation correctly pointsout,thiswillenableyoufreedomfromlock-inwiththeequipmentvendorsusing Windows as the platform of their machine, which alone should save you money and helpyourlabfunctionmoreefficiently.Italsooffersthepotentialto“resurrect”formally quasi-functional tools collecting dust in the corner of your laboratory now (such as thosewherethesoftwareisnolongersupported).However,evenmoreexcitingisthe opportunitiesthisbookgivesyoutouseautomationtotacklenewtypesofexperiments that would simply have been too time-consuming or cost-prohibitive for all but the mostwealthylaboratories. Youhavemadeagooddecisiontopurchasethisbook.Itwillmakeyourlaboratory more efficient and save you money. My hope is that it functions as a good “gateway” drugthatitpullsyouintoopen-sourcescientifichardwarecommunity.Thiscommunity isbuildingfromscratchprogressivelymoresophisticatedautomatedresearchtoolsfor atinyfractionofthecostofproprietaryequipment.Boththesourcecodeforthehard- ware andthe software are being shared openly enablingrapiddiffusion andtechnical evolution.Asyoubecomefamiliarwithautomationandcomfortablewiththeabilityto improvethefunctionalityofyourequipment,thetechnicaljumptohackingopenhard- ware becomes far less intimidating. So, fire up your computer, turn the page, and get started. JoshuaPearce MichiganTechOpenSustainabilityTechnologyLab Open-SourceLab:HowtoBuildYourOwnHardwareandReduceResearchCosts Houghton,MI Preface Someyearsago,Ifoundbychanceaverycheaproboticarm(∼US$100)forsale.This roboticarmcouldbecontrolledusingacomputer,similarlytoautosamplersofanalyt- icalequipment.Adevicewiththatcapabilityandcostingsolittlewasasurprisetome, becauseIwasusedtoautosamplerscostingasmuchasabrandnewcar.Atthatpoint, I was familiar with AutoIt, the scripting language presented in this book, and I real- ized that using it I could try to use the robotic arm as a substitute for the expensive autosamplers.Ididit,anditworkedperfectly. The test with the robotic arm made clear for me that AutoIt could be used to inte- grate any type of devices in the laboratory, enabling not only money saving, but also totalfreedomregardingthechoice ofequipment.AsIcametorealize,mycolleagues werenotawareofsuchpossibilities.Therefore,Idecidedtosharethisideawithother professionals,andpublishedtwoarticlesinscientificjournalsaboutAutoItusedinthe contextoflaboratoryautomation.However,scientificarticlesareshort,notallowingfor anin-depthcoverageofAutoIt,andthusIdecidedthatabookwouldbeabetterwayto disseminatetheideaamonglaboratorytechniciansandscientists. ThisbookcoversseveralaspectsofAutoItinthecontextoflaboratoryautomation.I expectittoempowerreadersintwoways: 1) Byprovidingindependencefrominstrumentmanufacturers.InthesamewayIcould use a cheap robotic arm as an autosampler for analytical equipment, readers will becomeabletocombineanytypeofequipmentveryeasily.Doingso,itwillbepossi- bleforthemtochoosethedevicethatisthebestorthemostcosteffectiveforagiven task, regardless of what manufacturers could have originally suggested. If you are familiarwiththefieldoflaboratoryautomation,thismaycomeasasurprise.Nowa- days,theprevalentviewisthatintegrationoflaboratoryequipmentisverycomplex and accessible only for specialized professionals. This book will demonstrate that withAutoItsuchintegrationisverysimpleandaccessibletovirtuallyanylaboratory technicianorscientist. 2) BypresentingAutoIt.AutoItisnotjustanotherscriptinglanguage.Becauseitauto- matesmouseclicksandkeyboardentries,AutoItisaverypowerfultoolthatallows completeautomationofaprogram,andalsototalintegrationamongdifferentpro- grams.Beingfreetogetandeasytolearn,AutoItisafantastictoolthatcanbeused notonlyinthecontextoflaboratoryautomation,butalsoasageneralwaytoeasily increaseproductivitywhenusingthecomputer.

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.