Duda con la función Execute

Duda con la función Execute

Postby horacio » Tue Feb 14, 2017 1:16 pm

Colegas, he estado mirando la función Execute() de scripts.prg. Cuando quiero ejecutar un script me da el siguiente error

Code: Select all  Expand view

c:\FWH\include\Objects.ch(5) Error F0029  Can't open #include file 'hbclass.ch'


Si creo la carpeta FWH\include funciona. Mi pregunta es si esta carpeta es obligatoria o podría llamarse de otra manera ?. Muchas Gracias

Saludos
horacio
 
Posts: 1358
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Duda con la función Execute

Postby horacio » Mon Feb 20, 2017 7:33 pm

+1
horacio
 
Posts: 1358
Joined: Wed Jun 21, 2006 12:39 am
Location: Capital Federal Argentina

Re: Duda con la función Execute

Postby karinha » Mon Feb 20, 2017 7:56 pm

Image

Code: Select all  Expand view

// Scripting for Harbour and FiveWin only (not supported on xHarbour)

#include "FiveWin.ch"
#include "Splitter.ch"
#include "xbrowse.ch"
#include "hbclass.ch"

extern TRibbonBar, GetWinVer, hb_dirbase, hb_at, MsgDate, MsgCalc

static oWnd, oResult

//----------------------------------------------------------------//

function ScriptsMain() // Don't use Main() here so you can use it in your scripts!

   local oBrw, oBar, oMsgBar, oFont, oMemo, oSplit, oSplit2
   local cCode := '#include "C:\FWH1612\INCLUDE\FiveWin.ch"' + CRLF + CRLF + "function Test()" + CRLF + CRLF + '   MsgInfo( "Hello world!" )' + CRLF + CRLF + "return nil"
   local cResult

   if ! File( "scripts.dbf" )
      DbCreate( "scripts.dbf",;
                { { "NAME", "C", 20, 0 },;
                  { "DESCRIPT", "C", 100, 0 },;
                  { "CODE", "M", 80, 0 } } )
   endif

   USE scripts

   if RecCount() == 0
      APPEND BLANK
      Scripts->Name := "Test"
      Scripts->Descript := "This is a test script"
      Scripts->Code := cCode
   endif

   DEFINE WINDOW oWnd TITLE "Scripts" MENU BuildMenu()

   DEFINE BUTTONBAR oBar OF oWnd SIZE 80, 80 2007

   DEFINE BUTTON OF oBar PROMPT "New" FILE "..\bitmaps\alphabmp\plus.bmp" TOOLTIP "New" ACTION ( DbAppend(), Scripts->Name := "new script", oBrw:Refresh(), oMemo:SetText( cCode ) )

   DEFINE BUTTON OF oBar PROMPT "Run" FILE "..\bitmaps\alphabmp\task.bmp" TOOLTIP "Run" ;
      ACTION ( Scripts->Code := oMemo:GetText(), Execute( Scripts->Code ),;
               oResult:SetText( If( Empty( cResult := MemoRead( "comp.log" ) ), "ok", cResult ) ) )

   DEFINE BUTTON OF oBar PROMPT "Exit"  FILE "..\bitmaps\32x32\quit.bmp" TOOLTIP "Exit" ;
      ACTION If( MsgYesNo( "Do you want to end ?" ), oWnd:End(),)

   @ 5.8, 0 XBROWSE oBrw OF oWnd SIZE 450, 500 ;
      COLUMNS "Name", "Descript" ;
      HEADERS "Name", "Description" CELL LINES FASTEDIT ;
      COLSIZES nil, 30 ;
      ALIAS "Scripts" ;
      ON CHANGE ( oMemo:SetText( Scripts->Code ), oMemo:Refresh() )

   WITH OBJECT oBrw
      // :nMarqueeStyle = 4
      :bClrRowFocus  = { || { CLR_BLACK, RGB(185,220,255) } }
      :nMarqueeStyle = MARQSTYLE_HIGHLROWMS
      :nStretchCol   = 2
      :nDataLines    = 2
      :nEditTypes    = EDIT_GET
      :CreateFromCode()
   END

   DEFINE FONT oFont NAME "Courier New" SIZE 0, -16

   // @ 6.3, 57 GET oMemo VAR Scripts->Code MEMO OF oWnd SIZE 500, 482 FONT oFont

   oMemo = TTxtEdit():New( 63, 455, 500, 501, oWnd )
   oMemo:SetFont( oFont )
   oMemo:SetText( Scripts->Code )

   @ 43.9, 57 GET oResult VAR cResult MEMO OF oWnd SIZE 500, 300 FONT oFont

   @ 0, 450 SPLITTER oSplit ;
      VERTICAL _3DLOOK ;
      PREVIOUS CONTROLS oBrw ;
      HINDS CONTROLS oMemo, oResult ;
      SIZE 4, 200 PIXEL ;
      OF oWnd

   @ 565, 454 SPLITTER oSplit2 ;
            HORIZONTAL _3DLOOK ;
            PREVIOUS CONTROLS oMemo ;
            HINDS CONTROLS oResult ;
            SIZE 500, 4  PIXEL ;
            OF oWnd

   DEFINE MSGBAR oMsgBar OF oWnd 2007 PROMPT "Scripting support for your applications"

   ACTIVATE WINDOW oWnd MAXIMIZED ;
      ON RESIZE ( oSplit:AdjLeft(), oSplit2:AdjRight() )

return nil

//----------------------------------------------------------------//

function BuildMenu()

   local oMenu

   MENU oMenu
      MENUITEM "Scripts management"
      MENU
         MENUITEM "About..." ACTION MsgAbout( "Scripting support for Harbour and FiveWin",;
                                              "(c) FiveTech Software 2011" )
         SEPARATOR
         MENUITEM "Exit" ACTION If( MsgYesNo( "Do you want to end ?" ), oWnd:End(),)
      ENDMENU
   ENDMENU

return oMenu

//----------------------------------------------------------------//
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7214
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 87 guests