Sign in to follow this  
Followers 0
dinodod

Just wondering if there is a better way to code this.

3 posts in this topic

#1 ·  Posted (edited)

I'm thinking there has to be a better way to code this snippet yet I'm not quite sure. I was thinking that the nested IF / Then statements could have been combined into one line but yet my testing hasn't shown a way.

I was playing around a bit with RegExp for my _StringBetween but I can't seem to figure out how to have a regexp where the unknown data is x characters long (i.e. cat[...]fence doesn't work for variable length unknowns or I'm doing something wrong)

Thoughts?

Thanks in advance!

#include <IE.au3>
#Include <String.au3>
#include <array.au3>


Dim $a__URLs[1]
 

;Indeed Job Board
$oIE  = _IECreate("http://www.indeed.com/jobs?q=desktop+Support&l=34698&sort=date")


$oElements = _IETagNameAllGetCollection ($oIE)
For $oElement In $oElements
            If $oElement.tagname  = "H2" then 
                If $oElement.className  = "jobtitle" then
                    $SLink =  $oElement.innerhtml 
                    
        ;Sample Result
        ;<A title="Desktop Network Technician (Tampa)" onmousedown="return rclk(this,'-8Bka-gr6zilVMhVURaXLw');" href="/rc/clk?cd=HKiy4aenv9A9agPCel6Ac7JcRSmO4wsEtPLVn8tuMaCZxekOaGyFEyKN2NwHMrvggXM2hX_9xH3HVLn2QI8uvaWyvu7xG8fOw


FvUnOwcPFhaMJiieVTDbSD8huZZ8qYDeTsuFdVT_Ln6TZFiwFfKvdQmRM2sm6rRv1l5fgdTwtESET2RXtAl6wPl8j0EPtZsyoPwf


P42qiEy-njMAQYk8ubKl5xYdQ-KHp-_IDGYLgE"><B>Desktop</B> Network Technician (Tampa)</A> - <SPAN class=new>new</SPAN>+>14:50:42 AutoIT3.exe ended.rc:0
                    
                
                    $aStart = "title="""
                    $aEnd =  """"
                    $aArray1 = _StringBetween($SLink, $aStart, $aEnd)
                    
                    _ArrayAdd($a__URLs, $aArray1[0])
                    
                EndIf
            EndIf
Next

_ArrayDisplay($a__URLs, 'Default Search')
Edited by dinodod

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites



Thanks!

If $oElement.tagname = "H2" AND $oElement.className = "jobtitle" then


Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0