Wordpress Custom Fields & JS help

Hi, I am trying to set a code in my functions.php that auto adds a custom field on a new post. Now, I have that working. However, the value I want it to insert is from a javascript file. The js file’s value will change each day. All I can manage to get the custom field to do is add the code for the js file, therefore, what is displayed in posts will change every day. I want it to get the current value on the day of posting and to insert that value to the custom field.

Eg. if today the value of the file was “3” I want the number 3 to be inserted as a custom field. However, if the js code is just inserted, the next day, the post will display 4. I want it to insert the constant value the file has that day and it to stay like that.

Here is the code I have at the moment :

add_action(‘publish_page’, ‘add_custom_field_automatically’);
add_action(‘publish_post’, ‘add_custom_field_automatically’);
function add_custom_field_automatically($post_ID) {
global $wpdb;
if(!wp_is_post_revision($post_ID)) {
add_post_meta($post_ID, ‘day’, ‘<script type=“text/javascript”>eval(http://bbuk4network.com/wp-content/themes/cbbcosmos/day.js)</script>">
</script>’, $meta_value, true);
}
}

Any wordpress wizards have any ideas ? I would really appreciate if anyone could try help

Can anyone please help ? I would really appreciate it

I have tried some things but I still cannot get the script to execute before adding to the custom fields… eh, anyone else thought of any ideas ?

Someone suggested something on another site,but, I still cannot get this working and it is quite important that I find a fix. I would REALLY appreciate any help

It really is vital I find a solution for this… please, can somebody help or even reply ???