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

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


  • Date: Sat, 13 Feb 2010 17:55:27 -0000
  • From: "polomorabe" <polomora@xxxxxxxxx>
  • Subject: [amibroker] Re: Is it possible to run visual basic code from AB?

PureBytes Links

Trading Reference Links

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@xxxxxxxxxxxxxxx, "Mike" <sfclimbers@xxx> 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@xxxxxxxxxxxxxxx, "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/

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    amibroker-digest@xxxxxxxxxxxxxxx 
    amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/