Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
You will need to edit the wbtpath, otherwise it'll run by itself...
I was just experimenting with embedding an ACTIVE X object into MSIE, I've seen it in various ASP/VBScript examples and figured it was possible via Winbatch. Turns out it's a snap to access the embedded spreadsheet and it functions *almost* like Excel thru OLE.
The spreadsheet is re-sizeable and interactive...you can hit the toolbar buttons and export it into Excel if you need to save it, as FILE/SAVE/COMPLETE PAGE only saves the HTML
;startMSIE Browser = ObjectOpen("InternetExplorer.Application") browser.visible = @TRUE ; don't worry about a non-existent URL... ; once we start sending HTML to the .document it'll pop-up fresh... url = "c:\AnyOldURL.html" ;<<<<<<< MODIFY TO FIT YOUR NEEDS browser.navigate(url) ; leave this next section commented out it'll go right to a blank document... ;while browser.readystate <> 4 ; timedelay(0.5) ;endwhile ; setup the document object... browserDoc = Browser.Document ; send a message to the user... browserdoc.write('<body bgcolor=black text=white><center><br><br><br><h1>') browserdoc.write('Test Embedding of <font color=blue><i> MS Office Web Components </i></font>with Winbatch...') browserdoc.write('</h1></center></body>') Message("Winbatch", "Press to Continue") ; remove the previous page's text and send next message... browserdoc.close browserdoc.write('<body bgcolor=blue text=white><center><br><h3>') browserdoc.write('I was just experimenting with embedding an ACTIVE X object into MSIE, ') browserdoc.write("I've seen it in various ASP/VBScript examples and figured it was possible ") browserdoc.write("via Winbatch. Turns out it's a snap to access the embedded spreadsheet and ") browserdoc.write('it functions <font color=red><i>almost</i></font> like Excel thru OLE.') browserdoc.write('<br>') browserdoc.write('The spreadsheet is re-sizeable and interactive...you can hit the toolbar buttons and ') browserdoc.write('export it into Excel if you need to save it, as FILE/SAVE/COMPLETE PAGE only saves the HTML. ') browserdoc.write('</h2></center></body>') Message("Winbatch", "Press to Continue") ; close the previous text and display the spreadsheet... browserdoc.close ; drum roll... TimeDelay(1.5) ; now embed the Spreadsheet Control into the document... browserdoc.write('<center>') browserdoc.write('<OBJECT ID="Spreadsheet1" WIDTH=720 HEIGHT=440') browserdoc.write(' CLASSID="CLSID:0002E510-0000-0000-C000-000000000046"') browserdoc.write(' STANDBY="Loading Spreadsheet..."') browserdoc.write(' TYPE="application/x-oleobject">') browserdoc.write('</OBJECT>') browserdoc.write('</center>') ; get a list of files... wbtpath = "C:\z\" wbtfiles = FileItemize(StrCat(wbtpath, "*.wbt")) ; setup the column... y = 1 ; setup the Spreadsheet object for reference... ss = browserdoc.Spreadsheet1 ; insert the header info... thiscell = ss.cells(1,1) thiscell.value = "File Name" thisfont = thiscell.font thisfont.bold = @TRUE thiscell = ss.cells(1,2) thiscell.value = "File Size" thisfont = thiscell.font thisfont.bold = @TRUE ; insert values into the Spreadsheet... For x = 1 To 10 ; insert the filename... thisfile = ItemExtract(x, wbtfiles, @TAB) thiscell = ss.cells(x+1,y) thiscell.value = thisfile ; insert the file size... thiscell = ss.cells(x+1,y+1) thiscell.value = FileSize(StrCat(wbtpath, thisfile)) Next ; jump down an extra row... x = x + 2 ; reference the new cell and put the summary formula into it... thiscell = ss.cells(x,y+1) thiscell.formula = "=sum(B2:B12)" ; re-size the first column... thiscolumn = ss.columns(1) ; strangely the size is very different... ; I guess it uses MSIE units not Excel... thiscolumn.ColumnWidth = 225 browserdoc.write('<body bgcolor=tan text=red><center><br><br><h3>') browserdoc.write('Fairly painless and it seemed like it was <br>') browserdoc.write("<font color=black><u>easier</u></font> than automating Excel normally via OLE. ") browserdoc.write('</h2></center></body>') Exit #DefineSubRoutine GetExample(Handle,DialogMessage,DialogControlID,param4,param5) Switch (DialogMessage) Case 0 DialogProcOptions(Handle, 10, 1); Pass spinner selection changes. ; message("Debug", "Clicked") Break; Case 10 changed = @TRUE sSelection = DialogControlGet(Handle,2,8); Get selection ; if sSelection <> MyVariable1 then message("Debug", sSelection) newvalue = sSelection Break; EndSwitch Return -1 #EndSubRoutine x = 1 newvalue = x MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption=`WIL Dialog 1` MyDialogX=002 MyDialogY=061 MyDialogWidth=094 MyDialogHeight=123 MyDialogNumControls=004 MyDialogProcedure=`GetExample` MyDialogFont=`DEFAULT` MyDialogTextColor=`DEFAULT` MyDialogBackground=`DEFAULT,DEFAULT` MyDialog001=`021,099,036,012,PUSHBUTTON,DEFAULT,"Cancel",0,2,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog002=`047,013,024,018,SPINNER,MyVariable1,"1",DEFAULT,3,DEFAULT,DEFAULT,DEFAULT,DEFAULT` MyDialog003=`017,015,016,008,STATICTEXT,DEFAULT,"Level",DEFAULT,4,DEFAULT,DEFAULT,DEFAULT,"255|255|255"` MyDialog004=`021,077,036,012,PUSHBUTTON,DEFAULT,"Push 1",1,1,DEFAULT,DEFAULT,DEFAULT,DEFAULT` ButtonPushed=Dialog("MyDialog") If buttonpushed == 1 If changed Message("Debug", "Spinner Changed") If x <> newvalue Then Message("Debug", "Values not Equal") If x == newvalue Then Message("Debug", "Values reset") changed = @FALSE EndIf EndIf Exit
Article ID: W15649
File Created: 2003:05:28:10:22:20
Last Updated: 2003:05:28:10:22:20