2.9 dp4 microsoft scripting (using word or excel)

2008-02-25 Thread [EMAIL PROTECTED]
Hello 

just tested the new 

do tvbscript as vbscript

syntax in 2.9 beta dp4 for writing from runrev into word. It workes fine.
local tVBScript
put Dim Word  return after tVBScript
put Set Word = CreateObject(  quote  Word.Application  quote  )  
return after tVBScript
put Word.Visible=1  return after tVBScript
put Word.Documents.Add()  return after tVBScript
put 'Word.Selection.Font.Bold=  quote  1  quote  return after tVBScript
put Word.Selection.Font.Name=  quote  Arial  quote  return after 
tVBScript
put Word.Selection.TypeText(  quote  Hello Word  quote  )  return 
after tVBScript
put Word.Selection.InsertParagraph()  return after tVBScript
put Word.Selection.MoveDown()  return after tVBScript
put Word.Selection.InsertParagraph()  return after tVBScript
put Word.ActiveDocument.SaveAs(  quote  C:/newtest.doc  quote  )  
return after tVBScript
put tVBScript
do tVBScript as vbscript
-
Does anyone know a trick to use the Word-Object after the vbscript has ended 
and runrev got the result of vbscript? Could runrev get the Word-ID as result 
of the createobject syntax and use it later again? I assume this wouldn't be 
possible, but it would be fine if this could have be done.

The same can be used with excel if you transfer the attached perl program with 
the - style into point notation as I did above with word 
Regards, Franz 
Mit freundlichen Grüßen
Franz Böhmisch

[EMAIL PROTECTED]
http://www.animabit.de
GF Animabit Multimedia Software GmbH
Am Sonnenhang 22
D-94136 Thyrnau
Tel +49 (0)8501-8538
Fax +49 (0)8501-8537


Perl:
use Win32::OLE;
# grab the numbers
@numbers = qw(1 2 3 4 5);
# create the automation object
Win32::OLE::CreateObject(Excel.Application, $xl) || die CreateObject: $!;
# show it and add a new workbook
$xl-{Visible} = 1;
$xl-Workbooks-Add();
# start at the top left
$col = A; $row = 1;
foreach $num (@numbers) {
chomp($num);
$cell = sprintf(%s%d, $col, $row++);
# add it to Excel
$xl-Range($cell)-{Value}  = $num;
}


# OLE-Programmierung mit Perl
use Win32::OLE;
$app = Win32::OLE-new('Word.Application', 'Quit') || 
  die Problem mit WinWord: $!;
$app-{'Visible'}=1;
$worksheet = $app-Documents-Add();
$app-Selection-Style-{wdStyleHeading3} = 1;
$app-Selection-Font-{Bold} = 1;
$app-Selection-Font-{Name} = Arial;
$app-Selection-Font-{Size} = 24;
$stil = $app-Selection-Font-{Name};
$app-Selection-TypeText(Hallo Jakob. Word schreibt von selbst ...);
$app-Selection-InsertParagraph();
$app-Selection-MoveDown();
$app-Selection-TypeText(Schriftstil ist $stil);
$app-Selection-InsertParagraph();
$app-Selection-MoveDown();
$app-Selection-InlineShapes-AddPicture(d:\\test.jpg);
$app-Selection-InsertParagraph();
$app-Selection-MoveDown();
$app-Selection-Style-{wdStyleNormal} = 1;
$app-Selection-Font-{Size} = 12;
$app-Selection-TypeText(Viel Freude bei Winword...);
$app-ActiveDocument-SaveAs(C:/animabit/newtest.doc);
___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: 2.9 dp4 microsoft scripting (using word or excel)

2008-02-25 Thread Trevor DeVore

On Feb 25, 2008, at 12:07 PM, [EMAIL PROTECTED] wrote:

Does anyone know a trick to use the Word-Object after the vbscript  
has ended and runrev got the result of vbscript? Could runrev get  
the Word-ID as result of the createobject syntax and use it later  
again? I assume this wouldn't be possible, but it would be fine if  
this could have be done.


Perhaps this will be of help. From the engine change log:

=
The result of execution is reflected in 'the result'. This will  
contain alternate language not found if the specified language was  
unknown and execution error if a problem occured while running the  
script. If a problem did not occur, Revolution will evaluate the value  
of a global variable 'result' (if declared) within the scripting  
engine, if not declared empty will be assumed.


For example:
  do result = 1 + 1 as vbscript
Will return 2 in 'the result'.

Note: At present only values that can be coerced to a string are  
supported when returning a value.

=

Regards,

--
Trevor DeVore
Blue Mango Learning Systems
www.bluemangolearning.com-www.screensteps.com

___
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution