caramen Posted May 8, 2019 Share Posted May 8, 2019 Hello peoples, First time I need to return multiples Values I readed the H. file but I can't understand how to do that. I'm making a function I'll use later 15 times. That one : expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <Array.au3> #include <Excel.au3> #include <MsgBoxConstants.au3> $vE = 0 $vCus = 0 $vCusp = 0 $vEp = 0 $vL = 0 $vLp = 0 $vN = 0 $vNp = 0 $vEd = 0 $vLd = 0 $vNd = 0 $vA = 0 $v10 = 0 $vH = 0 Func _GetHeures ($iRow) Local $oExcel = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\1.xlsx") If @error Then MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeRead Example", "Error opening workbook '" & @ScriptDir & "\Extras\_Excel1.xls'." & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) Exit EndIf If $iRow = 1 Then $cRandge = "A1:AG1" ElseIf $iRow = 2 Then $cRandge = "A2:AG2" ElseIf $iRow = 3 Then $cRandge = "A3:AG3" ElseIf $iRow = 4 Then $cRandge = "A4:AG4" ElseIf $iRow = 5 Then $cRandge = "A5:AG5" ElseIf $iRow = 6 Then $cRandge = "A6:AG6" ElseIf $iRow = 7 Then $cRandge = "A7:AG7" ElseIf $iRow = 8 Then $cRandge = "A8:AG8" ElseIf $iRow = 9 Then $cRandge = "A9:AG9" ElseIf $iRow = 10 Then $cRandge = "A10:AG10" ElseIf $iRow = 11 Then $cRandge = "A11:AG11" ElseIf $iRow = 12 Then $cRandge = "A12:AG12" ElseIf $iRow = 13 Then $cRandge = "A13:AG13" ElseIf $iRow = 14 Then $cRandge = "A14:AG14" ElseIf $iRow = 15 Then $cRandge = "A15:AG15" EndIf $aResult = _Excel_RangeRead($oWorkbook, 2, $cRandge, 1) _ArrayDisplay($aResult) $cTech = $aResult[0][0] $iCols = UBound($aResult, $UBOUND_COLUMNS) For $i = 0 To $iCols-1 $cValue = $aResult2[0][$i] ;~ If $cValue = "" Then ;Debug ;~ Else ;~ MsgBox(0,0,$cValue) ;~ EndIf If $cValue = "E" Then $vE += 1 ElseIf $cValue = "E+" Then $vEp += 1 ElseIf $cValue = "L" Then $vL += 1 ElseIf $cValue = "L+" Then $vLp += 1 ElseIf $cValue = "N" Then $vN += 1 ElseIf $cValue = "Ed" Then $vEd += 1 ElseIf $cValue = "Ld" Then $vLd += 1 ElseIf $cValue = "Nd" Then $vNd += 1 ElseIf $cValue = "A" Then $vA += 1 ElseIf $cValue = "H" Then $vH += 1 ElseIf $cValue = "8" Or $cValue = "9" Or $cValue = "10" Or $cValue = "11" Or $cValue = "12" Or $cValue = "13" Or $cValue = "14" Or $cValue = "15" Or $cValue = "16" Or $cValue = "17" Or $cValue = "18" Or $cValue = "19" Or $cValue = "20" Or $cValue = "21" Or $cValue = "22" Then $vCus += 1 EndIf Next $r2E = $vE $r2Ep = $vEp $r2L = $vL $r2Lp = $vLp $r2N = $vN $r2Ed = $vEd $r2Ld = $vLd $r2Nd = $vNd $r2A = $vA $r210 = $v10 $r2H = $vH $r2Cus = $vCus $r2Cusp = $vCusp $vE = 0 $vEp = 0 $vL = 0 $vLp = 0 $vN = 0 $vEd = 0 $vLd = 0 $vNd = 0 $vA = 0 $v10 = 0 $vH = 0 $vCus = 0 $r2Cusp = 0 EndFunc I would like to use the return of all these variable $r2E = $vE $r2Ep = $vEp $r2L = $vL $r2Lp = $vLp $r2N = $vN $r2Ed = $vEd $r2Ld = $vLd $r2Nd = $vNd $r2A = $vA $r210 = $v10 $r2H = $vH $r2Cus = $vCus $r2Cusp = $vCusp Could you learn me how to do ? I have to make an array and use it ? I have to admit I'm stuck on this. My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted May 8, 2019 Share Posted May 8, 2019 @caramenHere is a way to do it Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Nine Posted May 8, 2019 Share Posted May 8, 2019 You could also use DllStructCreate and store all those vars into a single structure... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
caramen Posted May 8, 2019 Author Share Posted May 8, 2019 @FrancescoDiMuro Hi ! @Nine Hi ! Well thanks for suggestions. I got a logc way to solve this without complicate way. I do the function i play with variable after. And I dont forgot to reset vars. expandcollapse popup_GetHeures (6) $r2E = $vE $r2Ep = $vEp $r2L = $vL $r2Lp = $vLp $r2N = $vN $r2Ed = $vEd $r2Ld = $vLd $r2Nd = $vNd $r2A = $vA $r210 = $v10 $r2H = $vH $r2Cus = $vCus $r2Cusp = $vCusp $vE = 0 $vEp = 0 $vL = 0 $vLp = 0 $vN = 0 $vEd = 0 $vLd = 0 $vNd = 0 $vA = 0 $v10 = 0 $vH = 0 $vCus = 0 $r2Cusp = 0 _GetHeures (7) $r3E = $vE $r3Ep = $vEp $r3L = $vL $r3Lp = $vLp $r3N = $vN $r3Ed = $vEd $r3Ld = $vLd $r3Nd = $vNd $r3A = $vA $r310 = $v10 $r3H = $vH $r3Cus = $vCus $r3Cusp = $vCusp $vE = 0 $vEp = 0 $vL = 0 $vLp = 0 $vN = 0 $vEd = 0 $vLd = 0 $vNd = 0 $vA = 0 $v10 = 0 $vH = 0 $vCus = 0 $r2Cusp = 0 Thanks My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki 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