Results 1 to 7 of 7
  1. #1


    Member Since
    May 04, 2009
    Posts
    5
    Applescript - Firefox
    Hello,

    Can anybody tell me how to use applescript to put the current URL of firefox into a variable (something like set a to URL, but that doesn't seem to work)

    Basically, what I wanted to try, was making a program that would track how long I'd spent on each site I'd visit, but if I applescript doesn't know what URL I am on it doesn't know when to start and stop tracking the time.

    So could anybody help me ?

    -Floris

    Edit: I just figured I can get the name of the front window, which is allmost just as good, best would be getting the url though.

  2. #2


    Member Since
    May 04, 2009
    Posts
    5
    Okay, I still need to find out how to extract the Url, I figured some other things out myself.

    Some other thing I was puzzling with was replacing words in a text, but I figured out what Iwas doing wrong.
    The whole thing I did wrongly was using the TELL command. Kind of confusing how you need to tell some things to the document, while some things need to be told to the text of the document.

  3. #3


    Member Since
    May 04, 2009
    Posts
    5
    Okay so basically this forum is really crappy or am I mistaken?

  4. #4

    cwa107's Avatar
    Member Since
    Dec 20, 2006
    Location
    Lake Mary, Florida
    Posts
    26,911
    Specs:
    15" MBP, Core i7/2GHz, 8GB RAM, 480GB Crucial M500 SSD
    Quote Originally Posted by Floris View Post
    Okay so basically this forum is really crappy or am I mistaken?
    Patience. You need a very specific answer on Applescript, which not everyone is an expert with. Give it time.
    Liquid and computers don't mix. It might seem simple, but we see an incredible amount of people post here about spills. Keep drinks and other liquids away from your expensive electronics!

    https://youtu.be/KHZ8ek-6ccc

  5. #5


    Member Since
    May 04, 2009
    Posts
    5
    Nah, the point is all the spam

    Only the Url is still needed. Some intense googling helped me with alot of things. I think there should be some better Applescript tutorials though, most of them I tried went way too slow. If you mastered BASIC, you still need to learn some essential thing about applescript, which I figured out by googling and lots of trial and error....

    And there are looooaaaads of people asking questions on the internet, getting answers which to me where really vague, while later on I found ways to do it all way more easy...

  6. #6

    dtravis7's Avatar
    Member Since
    Jan 04, 2005
    Location
    Modesto, Ca.
    Posts
    28,931
    Specs:
    iMac 2010 27" QuadI7 OSX10.11, iMac 2008 OSX10.11, MBP Late2011OSX10.11 , iPad Air, iPhone 3GS
    What Spam would that be? No spam lasts more than a few minutes here.

  7. #7


    Member Since
    May 04, 2009
    Posts
    5
    Yeah thats right maybe I am judging to fast, sorry. Anyways, I'll just post the thing I made in case anybody cares, it took me hours googling and stuff to figure all the things out needed to make this, I still don't know how to get an url but I like my program so far (altough I don't think I will ever use it, but it's cool that it works nontheless).
    set b to 1
    set a to 0
    tell application "TextEdit"
    activate
    end tell
    tell application "Firefox"
    set c to name of front window
    set c to (every word of c) as string
    set d to c
    end tell
    repeat while b = 1
    delay 1
    set a to a + 1
    tell application "Firefox"
    set yu to name of the front window
    if yu is not "" then
    set d to (every word of yu) as string
    end if
    end tell
    if c is not d then
    tell application "TextEdit"
    if the text of the front document contains c then
    tell the text of the front document
    set ui to the first paragraph where it contains c
    delete (the first paragraph where it contains c)
    set a to (a + (word 2 of ui as integer))
    end tell
    end if
    set h to the text of the front document
    set the text of the front document to h & c & " " & a & "
    "
    set a to 0
    end tell
    end if
    tell application "Firefox"
    set yu to name of the front window
    if yu is not "" then
    set c to (every word of yu) as string
    end if
    end tell
    end repeat

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Launching an applescript FROM firefox (URL bar?)
    By Snipeye in forum OS X - Apps and Games
    Replies: 2
    Last Post: 05-30-2011, 10:09 PM
  2. Applescript
    By SgtDave in forum OS X - Development and Darwin
    Replies: 6
    Last Post: 01-19-2011, 03:50 PM
  3. Replies: 5
    Last Post: 05-18-2008, 06:28 PM
  4. Applescript Help
    By jorgito630 in forum OS X - Development and Darwin
    Replies: 0
    Last Post: 02-26-2008, 01:02 PM
  5. Firefox, Passwords & an AppleScript
    By Brown Study in forum OS X - Apps and Games
    Replies: 0
    Last Post: 03-03-2007, 12:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •