In order to save some time when doing analysis on a Facebook profile, this script would auto-scroll on the profile until everything was fully loaded.

read more
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

on scrolldem(id, type)
	
	if type is equal to "indirect" then
		tell application "Safari"
			set doc to front document
			set done_loading to false
			do JavaScript "
		window.location.assign('https://www.facebook.com/" & id & "');
		" in doc
			delay 1
		end tell
	end if
	
	if type is equal to "direct" then
		tell application "Safari"
			set doc to front document
			set done_loading to false
			do JavaScript "
		window.location.assign('https://www.facebook.com/profile.php?id=" & id & "');
		" in doc
			delay 1
		end tell
	end if
	
	tell application "Safari"
		repeat while done_loading is not equal to true
			set doc to front document
			set done_loading to do JavaScript "
			var done = false;
			 if (document.readyState=='complete'){
			 	done=true;
			}
			
			done;
				" in doc
			delay 1
		end repeat
	end tell
	
	tell application "Safari"
		set doc to front document
		set this_url to URL of doc
		set done_scrolling to false
		set filtered_URLs to {}
		set completed_once to false
		set erred_once to false
		
		
		repeat while done_scrolling is not equal to true
			set done_scrolling to do JavaScript "
		
		var completed_once = " & completed_once & ";
		if(completed_once!=true){
		var done;
		var number_of_trys =0;
		}
    function scrollToBottom(){
      bottom = document.body.scrollHeight;
      current = window.innerHeight+ document.body.scrollTop;
	done = false;
      if((bottom-current) >0){
        window.scrollTo(0, bottom);
        setTimeout (scrollToBottom, 2500 ); //If the loading exceeds this timeout, a try will be used.
      }
	  else {
			done = true;	
			
	  }
    };
	if(completed_once!=true){
   	 scrollToBottom();
	}
	
	if(done==true&&number_of_trys<50){//This number changes the number of allowed timeouts
		done=false;
		number_of_trys++;
		setTimeout(scrollToBottom, 1000);
		//This number sets the allotted timeout length.
		//If the loading exceeds both the timeout above and this timeout, another try will be used immediately.
	}
	
	done;
	
    " in doc
			
			set completed_once to true
			delay 0.2
			
			tell application "System Events"
				tell process "Safari"
					click at {1206, 449} -- {from left, from top} 
				end tell
			end tell
			
		end repeat
	end tell
	
end scrolldem
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
set processCancelled to false
set requestingStartingID to display dialog "What is the starting ID?" default answer "Monstermac77" with title "Scroller" buttons {"Indirect", "Direct", "Cancel"} default button 1
set button_pressed to the button returned of the result
if the button_pressed is "Direct" then
	set startingIDType to "Direct"
	
else if the button_pressed is "Indirect" then
	set startingIDType to "Indirect"
	
else
	set processCancelled to true
end if
set startingID to text returned of requestingStartingID
if processCancelled is equal to false then
	scrolldem(startingID, startingIDType)
end if