Sponsored Content
Top Forums Shell Programming and Scripting Applescript to open webpage from list, search for "text" Post 302939495 by ilovedoritos on Thursday 26th of March 2015 02:27:16 AM
Old 03-26-2015
Applescript to open webpage from list, search for "text"

hi guys, its me, doritos guy, I've laid off of the doritos for a while, twas given me stomach problems. you know when you eat 10 family size bags a day it might cause a problem, any-who

i appreciated the help from last time when i was trying to script something, now i just have to try to understand some hebrew lettering and sounds for phase 2 of that project.



i know it would be a combination of these two other discussions

https://discussions.apple.com/thread/6489693 (i got this one to work for me)
https://discussions.apple.com/thread/3122504

basically something like this


Open webpages one at a time from list in txt file
when webpage is loaded, then search for "text"
if "text" is not found
then
close tab, open next URL in list
if "text" is found
then
copy URL to a text file or alert somehow.
once url is copied and saved
then
close tab, open next url in list
repeat

this is what i pieced together from these links


Code:
on run {input, parameters}  
     read (item 1 of input)  
     set ps to paragraphs of the result  
     set tot to count ps  
     tell application "Safari"  
          reopen  
          activate  
     end tell  
     repeat with i from 1 to tot  
          set p to item i of ps  
          if p is not "" then  
               try  
                    tell application "Safari"  
                         tell front window  
                              set r to make new tab with properties {URL:p}  
                              set current tab to r  
                              delay 1  
                              if i = tot then exit repeat  
                              repeat  
                                   delay 1  

if text in webpage contains "search text" then
                              copy URL to text file
                    end if
if text in webpage does not contain "search text" then
close tab





                                   get URL of r  
                              end repeat  
                         end tell  
                    end tell  
             end try  
          end if  
     end repeat  
end run

---------- Post updated at 01:26 AM ---------- Previous update was at 01:12 AM ----------

just realized that i posted this in a shell scripting area, need to move

---------- Post updated at 01:27 AM ---------- Previous update was at 01:26 AM ----------

just realized that i placed this in a shell scripting area, need to move or delete

Last edited by ilovedoritos; 03-26-2015 at 03:16 AM.. Reason: messed up formatting
 

9 More Discussions You Might Find Interesting

1. SuSE

VMDB Failure" followed by "Unable to open snapshot file"

keep getting an error when I try to revert to a snapshot: "VMDB Failure" followed by "Unable to open snapshot file" Im using vmware server 1.0.4, host OS is windows xp and guest OS is SLES. Is there anything I can do to recover the snapshot or am I in trouble!?!?! (0 Replies)
Discussion started by: s_linux
0 Replies

2. IP Networking

Unknown open port: "6881/tcp open bittorrent-tracker" found with nmap

Hi. I ran nmap on my server, and I get the following: Starting Nmap 4.76 ( http://nmap.org ) at 2009-03-19 16:33 EDT Interesting ports on -------- (-----): Not shown: 997 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 6881/tcp open bittorrent-tracker The... (0 Replies)
Discussion started by: Rledley
0 Replies

3. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

4. Shell Programming and Scripting

Using sed to find text between a "string " and character ","

Hello everyone Sorry I have to add another sed question. I am searching a log file and need only the first 2 occurances of text which comes after (note the space) "string " and before a ",". I have tried sed -n 's/.*string \(*\),.*/\1/p' filewith some, but limited success. This gives out all... (10 Replies)
Discussion started by: haggismn
10 Replies

5. Shell Programming and Scripting

Read from "list1" and list matches in "list2"

I want to print any matching IP addresse in List1 with List 2; List 1 List of IP addresses; 161.85.58.210 250.57.15.129 217.23.162.249 74.76.129.101 30.221.177.237 3.147.200.59 170.58.142.64 127.65.109.33 150.167.242.146 223.3.20.186 25.181.180.99 2.55.199.32 (3 Replies)
Discussion started by: lewk
3 Replies

6. Shell Programming and Scripting

grep with "[" and "]" and "dot" within the search string

Hello. Following recommendations for one of my threads, this is working perfectly : #!/bin/bash CNT=$( grep -c -e "some text 1" -e "some text 2" -e "some text 3" "/tmp/log_file.txt" ) Now I need a grep success for some thing like : #!/bin/bash CNT=$( grep -c -e "some text_1... (4 Replies)
Discussion started by: jcdole
4 Replies

7. OS X (Apple)

Applescript to open webpages from list, search for "text"

posted this first in the shell area, realized it was wrong area for this, forgive me hi guys, its me, doritos guy, I've laid off of the doritos for a while, twas given me stomach problems. you know when you eat 10 family size bags a day it might cause a problem, any-who i appreciated the help... (0 Replies)
Discussion started by: ilovedoritos
0 Replies

8. Open Source

Applescript if url of tab contains "text" click link

this works for what i need it to, but need to add function that will click on link if urloftab contains "300" the last url of each page ends in "300", so i figure that if I add a function that for every tab it open it will also search to see if url contains "300". if it contains "300" click link... (0 Replies)
Discussion started by: ilovedoritos
0 Replies

9. Shell Programming and Scripting

Expect: spawn id exp5 not open while executing "expect "$" { send "sudo su -\r" }"

Hi All, i am trying to ssh to a remote machine and execute certain command to remote machine through script. i am able to ssh but after its getting hung at the promt and after pressing ctrl +d i am gettin the out put as expect: spawn id exp5 not open while executing "expect "$" {... (3 Replies)
Discussion started by: Siddharth shivh
3 Replies
WWW::Search::Ebay(3pm)					User Contributed Perl Documentation				    WWW::Search::Ebay(3pm)

NAME
WWW::Search::Ebay - backend for searching www.ebay.com SYNOPSIS
use WWW::Search; my $oSearch = new WWW::Search('Ebay'); my $sQuery = WWW::Search::escape_query("C-10 carded Yakface"); $oSearch->native_query($sQuery); while (my $oResult = $oSearch->next_result()) { print $oResult->url, " "; } DESCRIPTION
This class is a Ebay specialization of WWW::Search. It handles making and interpreting Ebay searches http://www.ebay.com. This class exports no public interface; all interaction should be done through WWW::Search objects. NOTES
The search is done against CURRENT running AUCTIONS only. (NOT completed auctions, NOT eBay Stores items, NOT Buy-It-Now only items.) (If you want to search completed auctions, use the WWW::Search::Ebay::Completed module.) (If you want to search eBay Stores, use the WWW::Search::Ebay::Stores module.) The query is applied to TITLES only. This module can return only the first 200 results matching your query. In the resulting WWW::Search::Result objects, the description() field consists of a human-readable combination (joined with semicolon- space) of the Item Number; number of bids; and high bid amount (or starting bid amount). In the resulting WWW::Search::Result objects, the end_date() field contains a human-readable DTG of when the auction is scheduled to end (in the form "YYYY-MM-DD HH:MM TZ"). If environment variable TZ is set, the time will be converted to that timezone; otherwise the time will be left in ebay.com's default timezone (US/Pacific). In the resulting WWW::Search::Result objects, the bid_count() field contains the number of bids as an integer. In the resulting WWW::Search::Result objects, the bid_amount() field is a string containing the high bid or starting bid as a human- readable monetary value in seller-native units, e.g. "$14.95" or "GBP 6.00". In the resulting WWW::Search::Result objects, the category() field contains the Ebay category number. In the resulting WWW::Search::Result objects, the sold() field will be non-zero if the item has already sold. (Only if you're using WWW::Search::Ebay::Completed) After a successful search, your search object will contain an element named 'categories' which will be a reference to an array of hashes containing names and IDs of categories and nested subcategories, and the count of items matching your query in each category and subcategory. (Special thanks to Nick Lokkju for this code!) For example: $oSearch->{category} = [ { 'ID' => '1', 'Count' => 19, 'Name' => 'Collectibles', 'Subcategory' => [ { 'ID' => '13877', 'Count' => 11, 'Name' => 'Historical Memorabilia' }, { 'ID' => '11450', 'Count' => 1, 'Name' => 'Clothing, Shoes & Accessories' }, ] }, { 'ID' => '281', 'Count' => 1, 'Name' => 'Jewelry & Watches', } ]; If your query string happens to be an eBay item number, (i.e. if ebay.com redirects the query to an auction page), you will get back one WWW::Search::Result without bid or price information. OPTIONS
Search descriptions To search titles and descriptions, add 'srchdesc'=>'y' to the query options: $oSearch->native_query($sQuery, { srchdesc => 'y' } ); Search one category To restrict your search to a particular eBay category, find out eBay's ID number for the category and add 'sacategory'=>123 to the query options: $oSearch->native_query($sQuery, { sacategory => 48995 } ); If you send a single asterisk or a single space as the query string, the results will be ALL the auctions in that category. Limit search by price range Contributed by Brian Wilson: $oSearch->native_query($sQuery, { _mPrRngCbx=>'1', _udlo=>$minPrice, _udhi=>$maxPrice, } ); PUBLIC METHODS OF NOTE
user_agent_delay Introduce a few-seconds delay to avoid overwhelming the server. need_to_delay Controls whether we do the delay or not. preprocess_results_page Grabs the eBay Official Time so that when we parse the DTG from the HTML, we can convert / return exactly what eBay means for each one. result_as_HTML Given a WWW::SearchResult object representing an auction, formats it human-readably with HTML. An optional second argument is the date format, a string as specified for Date::Manip::UnixDate. Default is '%Y-%m-%d %H:%M:%S' my $sHTML = $oSearch->result_as_HTML($oSearchResult, '%H:%M %b %E'); METHODS TO BE OVERRIDDEN IN SUBCLASSING
You only need to read about these if you are subclassing this module (i.e. making a backend for another flavor of eBay search). _get_result_count_elements Given an HTML::TreeBuilder object, return a list of HTML::Element objects therein which could possibly contain the approximate result count verbiage. _get_itemtitle_tds Given an HTML::TreeBuilder object, return a list of HTML::Element objects therein representing <TD> elements which could possibly contain the HTML for result title and hotlink. _parse_category_list Parses the Category list from the left side of the results page. So far, this method can handle every type of eBay search currently implemented. If you find that it doesn't suit your needs, please contact the author because it's probably just a tiny tweak that's needed. _process_date_abbrevs Given a date string, converts common abbreviations to their full words (so that the string can be unambiguously parsed by Date::Manip). For example, in the default English, 'd' becomes 'days'. _next_text The text of the "Next" button, localized for a specific type of eBay backend. whitespace_pattern Return a qr// pattern to match whitespace your webpage's language. _currency_pattern Return a qr// pattern to match mentions of money in your webpage's language. Include the digits in the pattern. _title_pattern Return a qr// pattern to match the webpage title in your webpage's language. Add grouping parenthesis so that $1 becomes the auction title, $2 becomes the eBay item number, and $3 becomes the end date. _result_count_pattern Return a qr// pattern to match the result count in your webpage's language. Include parentheses so that $1 becomes the number (with commas is OK). _columns Specify the order in which data columns appear in the search results table. SEE ALSO
To make new back-ends, see WWW::Search. BUGS
Please tell the author if you find any! AUTHOR
Martin 'Kingpin' Thurn, "mthurn at cpan.org", <http://tinyurl.com/nn67z>. Some fixes along the way contributed by Troy Davis. LEGALESE
THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. LICENSE
Copyright (C) 1998-2009 Martin 'Kingpin' Thurn This software is released under the same license as Perl itself. perl v5.12.4 2011-11-02 WWW::Search::Ebay(3pm)
All times are GMT -4. The time now is 08:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy