New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

Applescript - Firefox


Thread Closed

 
Thread Tools
Floris

 
Member Since: May 04, 2009
Posts: 5
Floris is on a distinguished road

Floris is offline
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.
Floris

 
Member Since: May 04, 2009
Posts: 5
Floris is on a distinguished road

Floris is offline
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.
Floris

 
Member Since: May 04, 2009
Posts: 5
Floris is on a distinguished road

Floris is offline
Okay so basically this forum is really crappy or am I mistaken?
cwa107

 
cwa107's Avatar
 
Member Since: Dec 20, 2006
Location: Middletown, Pennsylvania
Posts: 26,500
cwa107 has a reputation beyond reputecwa107 has a reputation beyond reputecwa107 has a reputation beyond reputecwa107 has a reputation beyond reputecwa107 has a reputation beyond reputecwa107 has a reputation beyond reputecwa107 has a reputation beyond reputecwa107 has a reputation beyond reputecwa107 has a reputation beyond reputecwa107 has a reputation beyond reputecwa107 has a reputation beyond repute
Mac Specs: 15" MBP, Core i7/2GHz, 8GB RAM, 480GB Crucial M500 SSD

cwa107 is offline
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!
Floris

 
Member Since: May 04, 2009
Posts: 5
Floris is on a distinguished road

Floris is offline
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...
dtravis7

 
dtravis7's Avatar
 
Member Since: Jan 04, 2005
Location: Modesto, Ca.
Posts: 27,482
dtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond reputedtravis7 has a reputation beyond repute
Mac Specs: iMac 2.4 C2D 10.9.4, iMac 2.16 C2d 10.6.8, Macbook2007 10.8.4, Mac Mini 10.8.4, iPhone 3GS Note 8!!

dtravis7 is offline
What Spam would that be? No spam lasts more than a few minutes here.
Floris

 
Member Since: May 04, 2009
Posts: 5
Floris is on a distinguished road

Floris is offline
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).
Quote:
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 Closed


« How to navigate code in XCODE | Finding a file in Terminal »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Speed up Firefox trick.. RiDE OS X - Apps and Games 2 11-08-2007 12:50 PM
Firefox, Passwords & an AppleScript Brown Study OS X - Apps and Games 0 03-03-2007 12:22 AM
Firefox & 10.4.7 Murker OS X - Apps and Games 5 08-18-2006 01:16 PM
Boy, Do I Feel Dumb! How Do I Install Firefox? mac57 Switcher Hangout 9 05-18-2006 04:16 AM
Firefox Help heysidays OS X - Apps and Games 2 12-10-2005 11:43 AM

All times are GMT -4. The time now is 04:48 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?