Sign in to follow this  
Followers 0
Zithen

autoit and .vbs

11 posts in this topic

can u add vbs into a autoit script or can you only add autoit to a vbs script?

basicly have a vbs script and want to add it to a already existing autoit script so that we dont have to keep calling the .vbs file everytime we want to run this. want to make it 1 file.

i know autoit and i dont know vbs and vis versa for him, and we cant work together on this (work reasons).

Share this post


Link to post
Share on other sites



one way to combine the two.. is to compile your vbs script then

in Autoit

$Program_1 = @TempDir & "\Temp.exe"
FileInstall("C:\vbs.exe", $Program_1)

; scripting

Run($Program_1)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

thx i will give that a shot

one way to combine the two.. is to compile your vbs script then

in Autoit

$Program_1 = @TempDir & "\Temp.exe"
FileInstall("C:\vbs.exe", $Program_1)

; scripting

Run($Program_1)

8)

Share this post


Link to post
Share on other sites

Try using AutoIt as a vbs script wrapper, just put the vbs code in a string in the program:

Global $oVBS
$oVBS = ObjCreate("ScriptControl")
$oVBS.language="vbscript"
$oVBS.addcode($SOME_VB_CODE_HERE)

Func _vb($param)
    Return $oVBS.run("A_FUNCTION_IN_THE_VBS_CODE", $param)
EndFunc

Share this post


Link to post
Share on other sites

erifash, excuse my poor knowledgment about, but please help me.

I have a short VBS that returns an AD object attribute, listed above:

set objUser = getobject ("LDAP://cn=tstusr,ou=TESTS,dc=test,dc=net")
wscript.echo objuser.company

How can I use your sudgestion applying this vbs?

I needs to use the output of this VBS on my AutoIT script.

Thanks

Pierre

Share this post


Link to post
Share on other sites

Hi,

Does this old link help?

Use VBscript with AutoIt : a method, :-) Michel Claveau

Best, randall

PS see i have twice used this type of method, writing the variables within the script, in "ExcelCom.au3", link from my signature...

Share this post


Link to post
Share on other sites

Great!

Its running fine.... except to W98 workstations...B)

I have the vbs...

on error resume next
set objUser = getobject ("LDAP://cn=tstusr,ou=TESTS,dc=test,dc=net")
wscript.echo objuser.company

and write the follow AutoIT...

$VBS='on error resume next'
$VBS=$VBS&@CRLF&'set objUser = getobject ("LDAP://cn=tstusr,ou=TESTS,dc=test,dc=net")'
$VBS=$VBS&@CRLF&'function test()'
$VBS=$VBS&@CRLF&'TESTE=objuser.company'
$VBS=$VBS&@CRLF&'end Function'
$vbscript = ObjCreate("ScriptControl")
$vbscript.language="vbscript"
$vbscript.addcode($VBS)
$VBOUT = $vbscript.run("test")
MsgBox(0,"Test",$VBOUT)
Exit

the W98 returns an error:

$vbscript.language="vbscript"

$vbscript^ERROR

Error:Variable must be of type "Object"

Can you help?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Most likely ObjCreate is throwing an error.

Check the helpfile in case I might be wrong, but:

If $vbscript < 0 Then
    MsgBox(0, 'ObjCreate', 'Error Occured: Type' & $vbscript)
    Exit
EndIf
Edited by MSLx Fanboy

Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

Share this post


Link to post
Share on other sites

Most likely ObjCreate is throwing an error.

Check the helpfile in case I might be wrong, but:

If $vbscript < 0 Then
    MsgBox(0, 'ObjCreate', 'Error Occured: Type' & $vbscript)
    Exit
EndIf
This is most likely. My guess to the cause is that since Win98 have V1.0 of Windows Script Host it does not have what you need. Download WSH V5.6 for Win98 from MSDN

More info on WSH here

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

I update the WSH and install DSClient, and still not running, reporting the same error...

Some one can help me?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0