[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Import Script



PureBytes Links

Trading Reference Links


Hey Tomasz....
 
I had and error concering the "enter outside the function 
" hehehe you won't believe this but I actually manage to figure it 
out...here is the changed and tested and working version....
 
var FileSystemObject = new 
ActiveXObject("Scripting.FileSystemObject");var AmiBroker = new 
ActiveXObject("Broker.Application");var ForReading = 1;var DataFolder = 
"c:\\ID\\";  function 
RunAmiUpdate(filename){  AmiBroker.Import(0, filename + ".EDD", 
"edd.format");  AmiBroker.RefreshAll();} function 
ImportEDD(filename){    if( ! 
FileSystemObject.FolderExists( DataFolder ) )  
{ WScript.echo("A data folder:\n" + DataFolder + "\ndoes not exist.\nIf 
your data are in another location please enter the path to this location\nto the 
'Arguments' edit field in the Tools->Customize 
dialog."); return;  
}      RunAmiUpdate( DataFolder + filename 
);     try {      
FileSystemObject.DeleteFile( DataFolder + filename + 
".EDD");    } catch (e) { /* Ignore errors 
*/  return;  }   } 

 
 function UpdateToday(){ var 
CurDate = new Date();
 
   y = 
CurDate.getFullYear();   m = CurDate.getMonth() + 
1;   d = CurDate.getDate();     
filename = y + ( m < 10 ? "0" : "" ) + m + ( d < 10 ? "0" : "" ) + 
d;       ImportEDD( filename 
); }  UpdateToday();
 
 
It is working great now thank-you 
very much....I will now let you rest lol...
 
Kind regards
 
Louw 
Coetzer