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

Import Automization



PureBytes Links

Trading Reference Links

Here I go again, you will not believe how ignorant people can become towards understanding there software, gees... Well remember when you helped me with that script to automatically import investordata files through using the "tools menu ". Well I need a small add-on. Here follows the current working copy of the script....what I need added is the following. The daily update file get's send to the people via e-mail and in the form of a zip file. I have gotten them so far as to save the update attachment to the c:\ID folder as a zip file. I now need to add to the current script file the ability to "UNZIP" the file and then continue with the update, when finished, remove ALL files in the c:\ID folder. Also take into account that I have created the following folder: c:\programm files\ami broker\pkunzip in here lives the pkunzip.exe file and his friend pkunzip.pif which I created to automatically close the unzip screen.....

Also when the update is done, AmiBroker must run the "File + Save" command in order to save the changes ( believe it or not they forget to do this .... ;)

Please work your magic one more time ;)

Kind regards 

Louw Coetzer
(South Africa)

____________________________________________________________________________________

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 yourdata 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();

------=_NextPart_001_0015_01C15C94.9C6BA4E0
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"><BASE 
href="file://C:\Program Files\Common Files\Microsoft Shared\Stationery\">
<STYLE>BODY {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
UL {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
OL {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
DIR {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
MENU {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
DIV {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
DT {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
DD {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
ADDRESS {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
BLOCKQUOTE {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
PRE {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
BR {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
P {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
LI {
BACKGROUND-POSITION: left top; FONT-WEIGHT: normal; FONT-SIZE: 20pt; COLOR: black; BACKGROUND-REPEAT: repeat-x; FONT-FAMILY: "Perpetua MT", "Times New Roman"; BACKGROUND-COLOR: #ffffef
}
H1 {
FONT-WEIGHT: normal; FONT-SIZE: 65pt; COLOR: #660000; FONT-FAMILY: "Old English Text MT", "Times New Roman"
}
P.msoNormal {
MARGIN-TOP: 0em; FONT-WEIGHT: normal; FONT-SIZE: 20pt; MARGIN-BOTTOM: 0em;COLOR: black; FONT-FAMILY: "Perpetua MT", "Times New Roman"
}
LI.msoNormal {
MARGIN-TOP: 0em; FONT-WEIGHT: normal; FONT-SIZE: 20pt; MARGIN-BOTTOM: 0em;COLOR: black; FONT-FAMILY: "Perpetua MT", "Times New Roman"
}
</STYLE>

<META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
<BODY bgColor=beige background=cid:001301c15c83$d8db33c0$0100007f@xxxxx 
topMargin=150>
<DIV><STRONG><FONT size=4>Dear Tomasz</FONT></STRONG></DIV>
<DIV><FONT size=3></FONT>&nbsp;</DIV>
<DIV><FONT size=3>Here I go again, you will not believe how ignorant people can 
become towards understanding there software, gees...&nbsp; Well remember when 
you helped me with that script to automatically import investordata files 
through using the "tools menu ".&nbsp; Well I need a small add-on.&nbsp; Here 
follows the current working copy of the script....what I need added is the 
following.&nbsp; The daily update file get's send to the people via e-mail and 
in the form of a zip file.&nbsp; I have gotten them so far as to save the update 
attachment to the&nbsp; c:\ID&nbsp; folder as a zip file.&nbsp; I now need to 
add to the current script file the ability to "UNZIP" the file and then continue 
with the update, when finished, remove <STRONG><U>ALL</U></STRONG> files inthe 
c:\ID folder.&nbsp; Also take into account that I have created the following 
folder:&nbsp;&nbsp;&nbsp; c:\programm files\ami 
broker\pkunzip&nbsp;&nbsp;&nbsp;&nbsp; in here lives the pkunzip.exe file and 
his friend pkunzip.pif which I created to automatically close the unzip 
screen.....</FONT></DIV>
<DIV><FONT size=3></FONT>&nbsp;</DIV>
<DIV><FONT size=3>Also when the update is done, AmiBroker must run the "File + 
Save" command in order to save the changes ( believe it or not they forget to do 
this ....&nbsp; ;)</FONT></DIV>
<DIV><FONT size=3></FONT>&nbsp;</DIV>
<DIV><FONT size=3>Please work your magic one more time ;)</FONT></DIV>
<DIV><FONT size=3></FONT>&nbsp;</DIV>
<DIV><FONT size=3>Kind regards </FONT></DIV>
<DIV><FONT size=3></FONT>&nbsp;</DIV>
<DIV><FONT size=3>Louw Coetzer</FONT></DIV>
<DIV><FONT size=3>(South Africa)</FONT></DIV>
<DIV><FONT size=3></FONT>&nbsp;</DIV>
<DIV><FONT 
size=1><STRONG>____________________________________________________________________________________</STRONG></FONT></DIV>
<DIV><FONT size=3></FONT>&nbsp;</DIV>
<DIV><FONT size=3><STRONG>var FileSystemObject = new 
ActiveXObject("Scripting.FileSystemObject");<BR>var AmiBroker = new 
ActiveXObject("Broker.Application");<BR>var ForReading = 1;<BR>var DataFolder = 
"c:\\ID\\";<BR>&nbsp;<BR>&nbsp;<BR>function 
RunAmiUpdate(filename)<BR>{<BR>&nbsp; AmiBroker.Import(0, filename + ".EDD", 
"edd.format");<BR>&nbsp; AmiBroker.RefreshAll();<BR>}<BR>&nbsp;<BR>function 
ImportEDD(filename)<BR>{<BR>&nbsp;<BR>&nbsp;<BR>&nbsp; if( ! 
FileSystemObject.FolderExists( DataFolder ) )<BR>&nbsp; 
{<BR>&nbsp;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-&gt;Customize 
dialog.");<BR>&nbsp;return;<BR>&nbsp; 
}<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp; RunAmiUpdate( DataFolder + filename 
);<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;try {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
FileSystemObject.DeleteFile( DataFolder + filename + 
".edd");<BR>&nbsp;&nbsp;&nbsp; } catch (e) {<BR>&nbsp;/* Ignore errors 
*/<BR>&nbsp; return;&nbsp; }<BR>&nbsp;&nbsp; } </STRONG></FONT></DIV>
<DIV><FONT size=3><STRONG></STRONG></FONT>&nbsp;</DIV>
<DIV><FONT size=3><STRONG><BR>function UpdateToday()<BR>{<BR>&nbsp;var CurDate = 
new Date();</STRONG></FONT></DIV>
<DIV><FONT size=3><STRONG></STRONG></FONT>&nbsp;</DIV>
<DIV><FONT size=3><STRONG>&nbsp;&nbsp; y = 
CurDate.getFullYear();<BR>&nbsp;&nbsp; m = CurDate.getMonth() + 
1;<BR>&nbsp;&nbsp; d = CurDate.getDate();<BR>&nbsp;<BR>&nbsp;<BR>&nbsp;&nbsp; 
filename = y + ( m &lt; 10 ? "0" : "" ) + m + ( d &lt; 10 ? "0" : "" ) + 
d;<BR>&nbsp;&nbsp;&nbsp;<BR>&nbsp;&nbsp; ImportEDD( filename 
);<BR>&nbsp;<BR>}<BR>&nbsp;UpdateToday();</STRONG></FONT></DIV></BODY></HTML>

------=_NextPart_001_0015_01C15C94.9C6BA4E0--

Attachment: Description: ""