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

RE: [amibroker] Re: Is it possible to run visual basic code from AB?


  • Date: Sat, 13 Feb 2010 13:45:37 -0500
  • From: Fred Tonetti <ftonetti@xxxxxxxxxxxxx>
  • Subject: RE: [amibroker] Re: Is it possible to run visual basic code from AB?

PureBytes Links

Trading Reference Links



You’re writing VB instead of _vbscript_ which is what was “enabled” …

 


From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of polomorabe
Sent: Saturday, February 13, 2010 12:55 PM
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Is it possible to run visual basic code from AB?

 

 

Hello Mike,

I tried it, and it doesn't work. I get an error at the first DIM declaration
Dim sPage As Variant
"Expected end of statement Source: Microsoft _vbscript_ compilation error"
with the cursor sitting just before the "As" keyword.

Can you help? Sounds like I am doing something silly...

Thanks,
Paul

Here is my AFL / _vbscript_:

EnableScript("_vbscript_");

ticker = Name();

<%
Dim sPage As Variant
Dim iGBP As Variant, iDec As Variant
Dim iStart As Variant, iEnd As Variant
Dim dRate As Variant
Dim earningsURL As Variant
Dim datedebug As Variant

earningsURL = ""http://www.zacks.com/research/report.php?type=estimates&t=""AFL("ticker")""&x=0&y=0"""
Set OIE1 = New SHDocVw.InternetExplorer
OIE1.Navigate earningsURL
do Until OIE1.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

sPage = OIE1.Document.body.InnerHTML
OIE1.Quit
Set OIE1 = Nothing
On Error GoTo DUMMYDATA
iGBP = InStr(1, sPage, "Next Report Date") '+ 12
On Error GoTo DUMMYDATA
iDec = InStr(iGBP, sPage, "&")
iStart = InStrRev(sPage, "align=right>", iDec) + 12
iEnd = InStr(iDec, sPage, "/") - 34
datedebug = Mid(sPage, iStart, iEnd - iStart)
if IsDate(datedebug)
Then
dRate = datedebug
else:
dRate = "=TODAY()+(100)"
End if
Goto END

DUMMYDATA:
dRate = "=TODAY()+(100)"
dRate = Empty

END:
AFL.Var("earningdate") = dRate
%>

--- In amibroker@xxxxxxxxxps.com, "Mike" <sfclimbers@...> wrote:
>
> You can embed scripting directly into your AFL and exchange variable values between the two as desired:
>
> http://www.amibroker.com/guide/a_aflcom.html
>
> Additional examples using _vbscript_:
>
> http://www.amibroker.com/guide/a_script.html
>
> Mike
>
> --- In amibroker@xxxxxxxxxps.com, "polomorabe" <polomora@> wrote:
> >
> > I don't know if this is a stupid question.
> >
> > I have written a VB macro to scrape the Zachs web page to extract the next earnings date, and paste it into an Excel worksheet cell. Is it possible to do somehow execute VB from within AB, to get the same information?
> >
> > http://www.zacks.com/research/report.php?type=estimates&t=IBM&x=0&y=0
> >
> > Many thanks,
> > Paul
> >
>



__._,_.___


**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.

TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com

TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/





Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___