michcio Posted November 29, 2008 Share Posted November 29, 2008 hi! I got this code: $avs2 = StringSplit($avs, "\") and now I need the last array index...I can't find anything in the help section about how to get this index easly (like array.length or something) please help! =) michcio Link to comment Share on other sites More sharing options...
michcio Posted November 29, 2008 Author Share Posted November 29, 2008 ah I got it! _ArrayPop sry Link to comment Share on other sites More sharing options...
Mattraks Posted November 29, 2008 Share Posted November 29, 2008 $avs2[0] has the length if thats what you want. As in: $avs = "hi\hello\wassup" $avs2 = StringSplit($avs, "\") $avs2[0] = 3 $avs2[1] = "hi" $avs2[2] = "hello" $avs2[3] = "wassup" Or Ubound($avs2) - 1 would be the equivalent of the value of $avs2[0] but its pointless to use that way because its already there in $avs2[0]. Link to comment Share on other sites More sharing options...
Marlo Posted November 29, 2008 Share Posted November 29, 2008 $avs2[0] will hold the number of items in your array Click here for the best AutoIt help possible.Currently Working on: Autoit RAT Link to comment Share on other sites More sharing options...
Aceguy Posted November 29, 2008 Share Posted November 29, 2008 $avs[0]-1 [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock Link to comment Share on other sites More sharing options...
Malkey Posted November 30, 2008 Share Posted November 30, 2008 hi! I got this code: $avs2 = StringSplit($avs, "\") and now I need the last array index...I can't find anything in the help section about how to get this index easly (like array.length or something) please help! =) michcioIf you use _ArrayPop(), this example might help. #include <Array.au3> Local $avs2[4] $avs2[0] = 3 $avs2[1] = "hi" $avs2[2] = "hello" $avs2[3] = "wassup" MsgBox(0, "Before", "Index number of last element in array is " & UBound($avs2) - 1 & @CRLF & @CRLF & _ "Or, after a SplitString () last element is " & $avs2[0] & @CRLF & @CRLF & _ "(Contents of) the last element of the array is " & $avs2[UBound($avs2) - 1] & @CRLF) _ArrayPop($avs2) MsgBox(0, "After _ArrayPop() ", "Index number of last element in array is " & UBound($avs2) - 1 & @CRLF & @CRLF & _ "Or, after a SplitString () last element is " & $avs2[0] & @CRLF & @CRLF & _ "(Contents of) the last element of the array is " & $avs2[UBound($avs2) - 1] & @CRLF) Link to comment Share on other sites More sharing options...
michcio Posted November 30, 2008 Author Share Posted November 30, 2008 (edited) ah thank you all for answers I think that $array[0] is the easiet way didn't know that 0 was length =) thank you! btw finally done with my little gui =) take a look at the code (sry my first gui in autoIt and just started learning this language ... so if you have any feedback please write ): expandcollapse popup;Programmet skapar en .m2v, .wav, .log, .ac3 och .avs filer från en .avi =) #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> $mainwindow = GUICreate("Fixa film", 150, 100,700,400) $openbutton = GUICtrlCreateButton("Välj din .avi fil", 15, 60, 80, 25) HotKeySet("{ESC}", "abort") GUICtrlCreateGroup("PAL-projekt eller inte?", 10, 10, 130, 80) $pal = GUICtrlCreateCheckbox("PAL",20,30,40,20) GUISetState(@SW_SHOW) while True $a = GuiGetMsg() If $a = $GUI_EVENT_CLOSE Then ExitLoop ElseIf $a = $openbutton Then ;fixar i FitCD: $open = FileOpenDialog("Håll nere SHIFT eller CTRL för att välja flera filer", "D:\","Avi files (*.avi)") $vald = ControlCommand("Fixa film", "PAL",$pal, "IsCHecked", "") $avs = $open & ".avs" ;tar ut den sista arrayen från arrayen som består av shortcuten uppdelad mha "\" $array = StringSplit($avs, "\") Global $avs2 = _ArrayPop($array) if $open = "" Then MsgBox(0,"VARNING","Du valde ingen .avi fil!!") Else ;FitCD Run("D:\DVD-making Program\FitCD.exe","D:\DVD-making Program") WinWaitActive("FitCD") WinSetState("FitCD","",@SW_MAXIMIZE) MouseClick("main",20,260,1) WinWaitActive("Öppna") ControlSend("Öppna","","Edit1",$open) Send("{ENTER}") if $vald = 1 Then ControlCommand("FitCD","PAL", "TCheckBox6", "Check", "") Else ControlCommand("FitCD","PAL", "TCheckBox6", "UnCheck", "") EndIf MouseClick("main",500,550,1) WinWaitActive("Spara som") Send("{ENTER}") WinClose("FitCD") WinWaitClose("FitCD") ;HCEnc Run("D:\DVD-making Program\HC023\HCgui_023.exe","D:\DVD-making Program\HC023") WinWaitActive(" HCgui 0.23") ;selectar min .m2v fil =) selecta(7,"input",$avs,"") ;Selectar m2v's output selecta(8,"output", $open,".m2v") ;Selectar log output selecta(9,"log",$open,".log") ;encodar ControlClick(" HCgui 0.23", "", "Button147") if WinWait("HC message","",2)=1 Then Send("{ENTER}") EndIf WinWait(" HCenc 0.23") ;VirtualDub Run("D:\DVD-making Program\virutaldub\VirtualDubMod.exe","D:\DVD-making Program\virutaldub\",@SW_MAXIMIZE) WinWaitActive("VirtualDubMod 1.5.10.2 (build 2540/release) [Based on VirtualDub 1.5.10 by Avery Lee]") Send("{CTRLDOWN}") Send("{o}") Send("{CTRLUP}") WinWaitActive("Open video file") Send($avs) Send("{ENTER}") WinWaitClose("Open video file") MouseClick("",150,20) MouseClick("",150,100) WinWait("Available streams") MouseClick("right",150,100) MouseClick("",160,280) ControlClick("Available streams", "", "Button7") WinWaitActive("Save WAV File") ControlSend("Save WAV File", "", "Edit1", $open & ".wav") Send("{ENTER}") if WinWait("Bekräfta Spara som","",2)=1 Then Send("{LEFT}") Send("{ENTER}") EndIf WinWaitClose("Save WAV File") ControlClick("Available streams", "", "Button1") WinWaitClose("Available streams") Send("{F4}") WinWaitActive("VirtualDubMod Job Control") ControlClick("VirtualDubMod Job Control","","Button6") WinWaitActive("VirtualDubMod Status - [" & $avs2 & "]") WinWaitClose("VirtualDubMod Status - [" & $avs2 & "]") WinClose("VirtualDubMod Job Control") WinClose("VirtualDubMod 1.5.10.2") WinWaitClose("VirtualDubMod Job Control") WinWaitClose("VirtualDubMod 1.5.10.2") ;ffmpegui Run("D:\DVD-making Program\ffmpeggui03c\ffmpeggui.exe","D:\DVD-making Program\ffmpeggui03c") WinWaitActive("ffmpegGUI Beta Build 3") ControlClick("ffmpegGUI Beta Build 3", "", "TButton2") WinWaitActive("Öppna") ControlSend("Öppna","","Edit1",$open & '.wav') Send("{ENTER}") WinWaitClose("Öppna") ControlClick("ffmpegGUI Beta Build 3", "", "TButton1") WinWaitActive("Spara som") ControlSend("Spara som","","Edit1",$open & ".ac3") Send("{ENTER}") WinWaitClose("Spara som") ControlClick("ffmpegGUI Beta Build 3", "", "TButton3") WinWaitActive("ffmpegGUI Message") ControlClick("ffmpegGUI Message", "", "Button1") WinWaitClose("ffmpegGUI Message") WinClose("ffmpegGUI Beta Build 3") WinWaitClose("ffmpegGUI Beta Build 3") ;väntar till söliga HCEnc blir klar WinWaitClose(" HCenc 0.23") WinWaitActive(" HCgui 0.23") WinClose(" HCgui 0.23") WinWaitClose(" HCgui 0.23") WinClose("Fixa film") EndIf EndIf WEnd Func selecta($buttonNr, $type, $string,$end) ControlClick(" HCgui 0.23", "", "Button" & $buttonNr) WinWaitActive("select " & $type & " file") ControlSend("select " & $type & " file", "", "Edit1", $string & $end) Send("{ENTER}") WinWaitClose("select " & $type & " file") EndFunc Func abort() ;stänger HCEnc!! WinClose(" HCenc 0.23") ControlClick("HC message","","Button1") WinWaitClose(" HCenc 0.23") WinClose(" HCgui 0.23") ;stänger min ruta och andra möjliga program! WinClose("Fixa film") WinClose("VirtualDubMod Status - [" & $avs2 & "]") WinClose("VirtualDubMod Job Control") WinCLose("FitCD") WinClose("VirtualDubMod 1.5.10.2") Send("{ENTER}") Exit(0) EndFunc In this vers. I have used _ArrayPop.. but will change it to $array[0] instead now regards and thanks michcio Edited November 30, 2008 by michcio Link to comment Share on other sites More sharing options...
November Posted November 30, 2008 Share Posted November 30, 2008 Hi, Every one forgot Ubound? Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] Link to comment Share on other sites More sharing options...
michcio Posted November 30, 2008 Author Share Posted November 30, 2008 (edited) no they didn't : Or Ubound($avs2) - 1 would be the equivalent of the value of $avs2[0] but its pointless to use that way because its already there in $avs2[0]. MsgBox(0, "After _ArrayPop() ", "Index number of last element in array is " & UBound($avs2) - 1 & @CRLF & @CRLF & _ "Or, after a SplitString () last element is " & $avs2[0] & @CRLF & @CRLF & _ "(Contents of) the last element of the array is " & $avs2[UBound($avs2) - 1] & @CRLF) regards Edited November 30, 2008 by michcio Link to comment Share on other sites More sharing options...
November Posted November 30, 2008 Share Posted November 30, 2008 no they didn't :regardsI didnt saw that array.au3 were already included... i was trying to save some script kb Size sometimes mathers Cheers Old Scriptology Visual Ping 1.8 - Mass Ping Program with export to txt delimited. Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code. Desktop 2 RGB - Pick a color in the desktop and get the RGB code. ShootIT 1.0 - Screen Capture full and partial screen [font="'Arial Black';"]Remember Remember The Fifth of November.[/font] 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