6 posts in this topic
[SOLVED] Help with Array's (creating 1 Array from 2 Arrays)
I just can't get my head around what I'm trying to do.
Ok so I read all the links in a webpage into a 1D array, I then make the array unique as there are some duplicates.
I then find all the entries I want from the array and put the number of the row for those entries into another 1D array.
So I now have two arrays; one has unique links, the other has the numbers of the rows for the links I actually want.
Using the second array I would like to amend the first array, or create a third, with just the links I actually want.
Confused? Welcome to my world.
I'll put the relevant section of code below to show where I am up to.
I've left the _ArrayDisplay in the above code which I am using to check the code does what I wanted. So the above code works fine, I'm just stumped on how to extract the links from $aLinks that I want.
$oLinks = _IELinkGetCollection($oIE) Local $aLinks = ["Link"] For $oLink in $oLinks _ArrayAdd($aLinks, $oLink.href) Next ;_ArrayDisplay($aLinks) $aLinks = _ArrayUnique($aLinks) ;_ArrayDisplay($aLinks) $aLinksToClick = _ArrayFindAll($aLinks, "azref", 0, 0, 0, 3) ;_ArrayDisplay($aLinksToClick) Local $aSortedLinks = ["Sorted Links"] For $i = 0 To UBound($aLinksToClick) - 1 $Blah = _ArrayExtract($aLinks, $aLinksToClick[$i], $aLinksToClick[$i]) _ArrayAdd($aSortedLinks, $Blah) Next
[solved] send multiple files by email from a file list
Hi! I want to send by mail some files with a certain extension (.xml in my case). These files are located in the script folder. First, I thought to use _FileListToArrayRec function to have a list of these files. But than I don't know how to send them all at once. I know that I can attach multiple files in this way: path1;path2;path3; etc. and so I have tried to make a string of this type with the path of the files (with a for loop) but It doesn't attach any file (only instructions.txt). How could I do? ( what I did is just an idea, if there's something better that would be great) Thanks!
$aArrayXml = _FileListToArrayRec(@ScriptDir, "*.xml", $FLTAR_FILES) _ArrayDisplay($aArrayXml, "LIST XML") $LenghtArrayXml = UBound($aArrayXml) If ($LenghtArrayXml > 2) Then For $i = 2 To $LenghtArrayXml - 1 $temp = "&@ScriptDir&""\"&$aArrayXml[$i]&";"&"""" $XmlListFile = $XmlListFile & $temp Next EndIf $XmlListFile = StringTrimLeft($XmlListFile, 1) if($LenghtArrayXml = 2)Then $rc =_INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @ScriptDir&"\"&$aArrayXml&";"&@ScriptDir&"\instructions.txt", $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl) Else $rc = _INetSmtpMailCom($s_SmtpServer, $s_FromName, $s_FromAddress, $s_ToAddress, $s_Subject, $as_Body, @ScriptDir&"\"&$aArrayXml&$XmlListFile&@ScriptDir&"\instructions.txt", $s_CcAddress, $s_BccAddress, $s_Username, $s_Password, $IPPort, $ssl) EndIf
Open webpages by checking boxes
Hello everyone, don't even know how to ask. My code is:
#include <String.au3> #include <IE.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 700, 500, 192, 124) $Button1 = GUICtrlCreateButton("View", 576, 24, 89, 41) Global $oIE = _IECreate("https://www.youtube.com/playlist?list=PL4Jcq5zn02jKpjX0nqI1_fS7mEEb5tw6z", 1, 1, 0) Sleep(1000) Global $sHTML = _IEDocReadHTML($oIE) $FirstChunks = _StringBetween($sHTML, 'pl-video-title-link yt-uix-tile-link yt-uix-sessionlink', '<div class="pl-video-owner') $x = 16 For $a In $FirstChunks $actualdata = _StringBetween($a, '">', '</a>') ;$actualdata2 = _StringBetween($a, 'href="', '&') $Checkbox1 = GUICtrlCreateCheckbox($actualdata, 24, $x, 500, 17) $x = $x + 20 Next GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Somehow I need to open webpages where checkbox is checked by presing button view, I think I need somehow asign $actualdata with $actualdata2. Any ideas would be very appreciated
Array Comparison with Logical expressions
I'm having list of words and put them into an array ($WordsList) and try to compare results with logical function if in such a condition that if letter extracted through _StringBetween doesn't exist in Array ($WordsList) then it'll show message box like "Pattern Not found" and if patter found in array then it'll skip if comparison and show last message "All Done".
But in my condition, the if comparison is not able to process commands upto my expectations and just show last message only.
Please help me and guide me further how can i make this possible.
$file = fileopen(@ScriptDir & "\source.txt", 10) $IE = _IECreate( "http://example.com", 0, 0) $source = _IEDocReadHTML($IE) FileWrite($file, $source) Global $File = @scriptdir & "\source.txt" $sText = FileRead($File) $target_source = _StringBetween($sText, "Dateuploaded</strong><span>", "</span></li><li><strong>Seeders") _ArrayDisplay ($target_source) $WordsList = ("2daysago", "1dayago") If $target_source <> $WordsList Then ; Here is the problem for logical comparison MsgBox ( '', '', 'Pattern Not found') EndIf MsgBox ('', '', 'All Done')
Can anyone explain what's going on here:
; Initializing an array Local $a = [ 0 ] ; Lately in code I want to assign new array to $a variable $a = [ 1 ] and got this error at compile time
==> Error in expression.: $a = [ 1 ] $a = ^ ERROR What is it and why?
And I've mentioned that I can't pass "manual" array to function as parameter:
a( [ 0 ] ) Func a( $a ) _ArrayDisplay( $a ) EndFunc still the same error
==> Error in expression.: a( [ 0 ] ) a( ^ ERROR