Jump to content

autoit and .vbs


Zithen
 Share

Recommended Posts

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).

Link to comment
Share on other sites

Link to comment
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

Link to comment
Share on other sites

  • 1 month later...

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

Link to comment
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...

Link to comment
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?

Link to comment
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
Edited by MSLx Fanboy

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
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

Link to comment
Share on other sites

  • 4 weeks later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...