arcker Posted October 30, 2005 Share Posted October 30, 2005 hello evry1; i'm in trouble with objects ! i've read the help file but it's not enough for my problem. So, i want to use autoit to create an UO under active directory. I've the code for the vbscript, but i want to translate it, so, here is the code in vbs : txtOUracine = "LDAP://OU=" & txtConteneur & ",DC=Vaio,DC=dom" Set objOU = GetObject(txtOUracine) if err.Number<>0 Then WScript.Echo "Error : UO base non found" else txtMonOU="OU=" & txtNomOU Set objMonOU = objOU.Create("organizationalUnit", txtMonOU) and here my translate $txtOUracine = "LDAP://OU=" & $txtConteneur & ",DC=Vaio,DC=dom" $objOU = Objget($txtOUracine) if @error<>0 Then msgbox(0, "Erreur : UO base non found" ) else $txtMonOU="OU=" & $txtNomOU $objMonOU = objcreate("$objOU.organizationalUnit", $txtMonOU <=the problem ! so, i'm good ? thx again have a good day -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list] Link to comment Share on other sites More sharing options...
DaleHohm Posted October 30, 2005 Share Posted October 30, 2005 $txtOUracine = "LDAP://OU=" & $txtConteneur & ",DC=Vaio,DC=dom" $objOU = Objget($txtOUracine) if @error<>0 Then msgbox(0, "Erreur : UO base non found" ) else $txtMonOU="OU=" & $txtNomOU $objMonOU = objcreate("$objOU.organizationalUnit", $txtMonOU <=the problem ! You'll probably need to check isObj($objOU) instead of @error -- this behaviour is different than vbs: $txtOUracine = "LDAP://OU=" & $txtConteneur & ",DC=Vaio,DC=dom" $objOU = Objget($txtOUracine) if not isObj($objOU) Then msgbox(0, "Erreur : UO base non found" ) else $txtMonOU="OU=" & $txtNomOU $objMonOU = objcreate("$objOU.organizationalUnit", $txtMonOU <=the problem ! 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 More sharing options...
arcker Posted October 30, 2005 Author Share Posted October 30, 2005 thx for the error solution ! but for the last line of the code, is it correct ? because to confirm the add, in vbs there is : objMonOU.SetInfo how translate it in autoit ? -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list] Link to comment Share on other sites More sharing options...
jefhal Posted October 30, 2005 Share Posted October 30, 2005 (edited) objMonOU.SetInfohow translate it in autoit ?I'm not aware if AutoIT does this natively, but I'm using Admod/Adfind from www.joeware.com to modify existing objects. Unfortunately it cannot add new objects. Edited October 30, 2005 by jefhal ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format Link to comment Share on other sites More sharing options...
DaleHohm Posted October 31, 2005 Share Posted October 31, 2005 Ohhh... OK. I must say that you camouflaged your question in the code block of the base post quite expertly Assuming that the code works in vbs, the last line should not be translated into ObjCreate in AutoIt. Instead, it appears that the objOU has a method of "Create", so it would be translated to$objMonOU = $objOU.Create("organizationalUnit", $txtMonOU) I'm not sure I understand the question about objMonOU.SetInfo -- it should simply translate as $objMonOU.SetInfo or you could do$result = $objMonOU.SetInfo Did I understand your questions? 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 More sharing options...
arcker Posted October 31, 2005 Author Share Posted October 31, 2005 yes you have understand and thanx for the answer browsing the forum i've found a post that say there is test of com objects in the zip of beta version, but i can't find them it would be useful thx for the solution, because i didn't now that autoit is able to do "*.setinfo" and other i can't test my script for now, but it seems there is no error, so when i'll test it, i'll inform you thx again dale, you're amazing ! -- Arck System _ Soon -- Ideas make everything "La critique est facile, l'art est difficile" Projects :[list] [*]Au3Service : Run your exe as service V3 / Updated 29/07/2013 Get it Here [/list] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now