Adding a script to certain pages I am trying to add a script code on all but few pages. I tried the following code on the template.php bfile, but it doesn't work.

 function THEME_preprocess_page(&amp;$variables) {
   if (isset($variables['node']-&gt;type)) {
     $variables['theme_hook_suggestions'][] = 'page__' . 
     $variables['node']-&gt;type;
   }

   if ($variables['nid'] == '77') {
     drupal_add_js(drupal_get_path('theme', 'THEME') .'/scripts/path.js');
   }
 }
You should try below solution as well. I have added JS &amp; CSS for the specific node.

function YOURTHEME_preprocess_page(&amp;$variables){
  if (array_key_exists('node', $variables)) {
    $node = $variables['node'];
    if ($node-&gt;nid == 8) {
      drupal_add_css(path_to_theme() . '/css/cdata.css', array('group' =&gt; CSS_THEME, 'media' =&gt; 'screen', 'every_page' =&gt; TRUE, 'browsers' =&gt; array('IE' =&gt; 'gte IE 9', '!IE' =&gt; FALSE), 'preprocess' =&gt; FALSE));    
      drupal_add_js(path_to_theme() .'/js/custom_records.js', 'file');
    }
  }  
}