
Quantumation
Active Members-
Posts
37 -
Joined
-
Last visited
Everything posted by Quantumation
-
loop in a loop Error
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
That got me past that error. But I'm so curious...........How? Why would that make such a difference? -
loop in a loop Error
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
#include <AD.au3> #include <Array.au3> ;~ GUI INCLUDES #include <GuiEdit.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1_1 = GUICreate("Get Managers", 592, 516, -1, -1) Global $Edit1 = GUICtrlCreateEdit("", 16, 112, 177, 361) GUICtrlSetData(-1, "") Global $Edit2 = GUICtrlCreateEdit("", 200, 112, 385, 177) GUICtrlSetData(-1, "") Global $Label1 = GUICtrlCreateLabel("GROUP NAMES", 16, 88, 135, 24) GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif") Global $Label2 = GUICtrlCreateLabel("Group Name - Manager Names", 200, 88, 251, 24) GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Get Managed By", 32, 52, 163, 31) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") Global $Button2 = GUICtrlCreateButton("Copy Automated", 456, 296, 99, 25) Global $Button3 = GUICtrlCreateButton("CLEAR ALL", 440, 24, 83, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $Label3 = GUICtrlCreateLabel("Created by - Clint Smith", 185, 480, 212, 24) GUICtrlSetFont(-1, 12, 800, 0, "Century") Global $Label4 = GUICtrlCreateLabel("Enter group names with no leading spaces", 16, 8, 244, 17) GUICtrlSetFont(-1, 8, 800, 4, "MS Sans Serif") Global $Label5 = GUICtrlCreateLabel("Each Group name should be on its own line", 16, 32, 250, 17) GUICtrlSetFont(-1, 8, 800, 4, "MS Sans Serif") Global $Edit4 = GUICtrlCreateEdit("", 200, 328, 385, 145) GUICtrlSetData(-1, "") Global $Label8 = GUICtrlCreateLabel("Automated Groups", 200, 304, 156, 24) GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif") Global $Button4 = GUICtrlCreateButton("Copy All Output", 464, 80, 99, 25) Global $Label9 = GUICtrlCreateLabel("This will Clear all boxes", 328, 32, 112, 17) Global $Label6 = GUICtrlCreateLabel("Input", 160, 88, 28, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GetManBy() Case $Button3 EndSwitch WEnd Func GetManBy() _AD_Open() Local $dispname[0] Local $groupnames = StringSplit(GUICtrlRead($Edit1), @CR) ;~ _ArrayDisplay($groupnames) If @error Then Exit MsgBox(16, "Active Directory", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) For $i = 1 To $groupnames[0] $GRPname = _AD_GetObjectProperties($groupnames[$i], "displayname") If $GRPname = @error Then Return MsgBox(16, "Group Not Found", $groupnames[$i] & " was not found") $info = _AD_GetObjectProperties($groupnames[$i], "info") Global $Managedby = _AD_GetObjectProperties($groupnames[$i], "managedBy,msExchCoManagedByLink") If $Managedby = @error Then MsgBox(1, "No Manager for group", $groupnames[$i] & " - Has no managers") ;~ EndIf Else ;~ _ArrayDisplay($Managedby) ConsoleWrite('$Managedby[0][0]=' & $Managedby[0][0] & @CRLF) For $f = 1 To $Managedby[0][0] ConsoleWrite($f & ': ' & $Managedby[$f][1] & @CRLF) _ArrayDisplay($Managedby) ;~ Here is the problem below. $add = _AD_FQDNToDisplayname($Managedby[$f][1]) ConsoleWrite($add & @TAB & @error & '||' & @extended) _ArrayAdd($dispname, $add) Next EndIf $Managers = _ArrayToString($dispname, ",") $str = StringInStr($info[1][1], "automated") If $str = 0 Then GUICtrlSetData($Edit2, $GRPname & " - " & $Managers & @CRLF) ElseIf $str > 0 Then GUICtrlSetData($Edit4, $GRPname & " - Automated Group" & @CRLF) EndIf Next _AD_Close() EndFunc ;==>GetManBy Just for reference here is the code i used with the last error I posted. -
loop in a loop Error
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
Thank you for your quick replies @AutoBert Unfortunately that code still produces the same error. --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop $Managedby[0][0]=4 1: CN=Clint Smith,OU=Service Desk Clint Smith 0 02: CN=Tony Alzola,OU=Service Desk Tony Alzola 0 03: CN=Ryan McIntosh,OU=Service Desk, Ryan McIntosh 0 04: CN=Kody Courter,OU=Service Desk Kody Courter 0 0"C:\Users\casmith\Documents\Autoit Scripts\GetManAndCoMan.au3" (73) : ==> Subscript used on non-accessible variable.: ConsoleWrite('$Managedby[0][0]=' & $Managedby[0][0] & @CRLF) ConsoleWrite('$Managedby[0][0]=' & $Managedby^ ERROR ->04:45:06 AutoIt3.exe ended.rc:1 +>04:45:06 AutoIt3Wrapper Finished. >Exit code: 1 Time: 4.911 It's as though the 2nd loop just wants to keep going even after it's met its threshold. It hits 4 but then it does one more and I can't figure out why. i've tested the second loop in a different script all by itself and it works just fine. #include <AD.au3> #include <Array.au3> _AD_Open() Global $Managedby = _AD_GetObjectProperties("TESTGROUP1", "managedBy,msExchCoManagedByLink") Global $dispname[0] For $f = 1 To $Managedby[0][0] $add = _AD_FQDNToDisplayname($Managedby[$f][1]) _ArrayAdd($dispname, $add, 0) $strarray = _ArrayToString($dispname, ",") Next $strarray = _ArrayToString($dispname, ",") _AD_Close() ;~This works like a charm This one is really baffling. -
loop in a loop Error
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
@AutoBert Thank you, here is what i received but as i look through it i'm not quite sure why it's stopping there. --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop $Managedby[0][0]=4 1: CN=Clint Smith,OU=Service Desk Clint Smith 0 02: CN=Tony Alzola,OU=Service Desk Tony Alzola 0 03: CN=Ryan McIntosh,OU=Service Desk Ryan McIntosh 0 04: CN=Kody Courter,OU=Service Desk Kody Courter 0 0"C:\Users\casmith\Documents\Autoit Scripts\GetManAndCoMan.au3" (72) : ==> Subscript used on non-accessible variable.: ConsoleWrite('$Managedby[0][0]=' & $Managedby[0][0] & @CRLF) ConsoleWrite('$Managedby[0][0]=' & $Managedby^ ERROR ->04:10:46 AutoIt3.exe ended.rc:1 +>04:10:46 AutoIt3Wrapper Finished. >Exit code: 1 Time: 27.05 It seems to me that when the Second loop happens for the $i loop it doesn't have anything in the $Managedby[0][0] variable. Is there something missing that's needed for nesting For loops? -
#include <AD.au3> #include <Array.au3> ;~ GUI INCLUDES #include <GuiEdit.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1_1 = GUICreate("Get Managers", 592, 516, -1, -1) Global $Edit1 = GUICtrlCreateEdit("", 16, 112, 177, 361) GUICtrlSetData(-1, "") Global $Edit2 = GUICtrlCreateEdit("", 200, 112, 385, 177) GUICtrlSetData(-1, "") Global $Label1 = GUICtrlCreateLabel("GROUP NAMES", 16, 88, 135, 24) GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif") Global $Label2 = GUICtrlCreateLabel("Group Name - Manager Names", 200, 88, 251, 24) GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Get Managed By", 32, 52, 163, 31) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") Global $Button2 = GUICtrlCreateButton("Copy Automated", 456, 296, 99, 25) Global $Button3 = GUICtrlCreateButton("CLEAR ALL", 440, 24, 83, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $Label3 = GUICtrlCreateLabel("Created by - Clint Smith", 185, 480, 212, 24) GUICtrlSetFont(-1, 12, 800, 0, "Century") Global $Label4 = GUICtrlCreateLabel("Enter group names with no leading spaces", 16, 8, 244, 17) GUICtrlSetFont(-1, 8, 800, 4, "MS Sans Serif") Global $Label5 = GUICtrlCreateLabel("Each Group name should be on its own line", 16, 32, 250, 17) GUICtrlSetFont(-1, 8, 800, 4, "MS Sans Serif") Global $Edit4 = GUICtrlCreateEdit("", 200, 328, 385, 145) GUICtrlSetData(-1, "") Global $Label8 = GUICtrlCreateLabel("Automated Groups", 200, 304, 156, 24) GUICtrlSetFont(-1, 12, 800, 4, "MS Sans Serif") Global $Button4 = GUICtrlCreateButton("Copy All Output", 464, 80, 99, 25) Global $Label9 = GUICtrlCreateLabel("This will Clear all boxes", 328, 32, 112, 17) Global $Label6 = GUICtrlCreateLabel("Input", 160, 88, 28, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 GetManBy() Case $Button3 EndSwitch WEnd Func GetManBy() Local $dispname[0] Local $groupnames = StringSplit(GUICtrlRead($Edit1), @CR) _ArrayDisplay($groupnames) _AD_Open() If @error Then Exit MsgBox(16, "Active Directory", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) For $i = 1 To $groupnames[0] $GRPname = _AD_GetObjectProperties($groupnames[$i], "displayname") If $GRPname = @error Then Return MsgBox(16, "Group Not Found", $groupnames[$i] & " was not found") $info = _AD_GetObjectProperties($groupnames[$i], "info") Global $Managedby = _AD_GetObjectProperties($groupnames[$i], "managedBy,msExchCoManagedByLink") If $Managedby = @error Then MsgBox(1, "No Manager for group", $groupnames[$i] & " - Has no managers") EndIf _ArrayDisplay($Managedby) For $f = 1 To $Managedby[0][0] _ArrayDisplay($Managedby) ;~ Here is the problem below. $add = _AD_FQDNToDisplayname($Managedby[$f][1]) _ArrayAdd($dispname, $add, 0) Next $Managers = _ArrayToString($dispname, ",") $str = StringInStr($info[1][1], "automated") If $str = 0 Then GUICtrlSetData($Edit2, $GRPname & " - " & $Managers & @CRLF) ElseIf $str > 0 Then GUICtrlSetData($Edit4, $GRPname & " - Automated Group" & @CRLF) EndIf Next _AD_Close() EndFunc ;==>GetManBy I have two groups that i created with all the correct properties to make sure this script has data in all fields. Basically i'm trying to run a for look inside a for loop and the loops aren't playing well together for some reason. Can anyone help? Below is the error I get when i try to run this script. "C:\Users\casmith\Documents\Autoit Scripts\GetManAndCoMan.au3" (72) : ==> Subscript used on non-accessible variable.: For $f = 1 To $Managedby[0][0] For $f = 1 To $Managedby^ ERROR ->04:00:21 AutoIt3.exe ended.rc:1 +>04:00:21 AutoIt3Wrapper Finished. >Exit code: 1 Time: 10.42
-
[RESOLVED] Unable to create to shared Drive
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
I figured it out. I needed the root folder for the shared drive. Not the mapped path. The Mapped path only works for Mapping drives because it auto-resolves the preface name. Instead of using a DFS folder name I found the Root folder: I was using the "\\Idaho-share\Night Team\TEST" which was the mapped instance but I needed to use: "\\Company.local\files\Site\Night Team\TEST" That was my error. After i ran it with the local name it created the folder. Thank you for your help @JohnOne- 9 replies
-
- share
- folder create
-
(and 2 more)
Tagged with:
-
[RESOLVED] Unable to create to shared Drive
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
@JohnOne I tried it with the same error. Thank you for the suggestion. i'm going to test the _NeT_Share_ShareAdd and see if that will create folders. I'm trying to better understand what the syntax requirements mean.- 9 replies
-
- share
- folder create
-
(and 2 more)
Tagged with:
-
[RESOLVED] Unable to create to shared Drive
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
@JohnOne I don't believe it's supported with DirCreate. I've tried it with #RequireAdmin and it still doesn't work. I've tried $filename with an extension and one without, it doesn't create either. I Checked _filecreate to see if it builds the path if you set a file to create but it doesn't. The path has to exist first but that only applies to the local computer. I found _Net_Share_ShareAdd that i think can do what i'm trying to do. I'm testing it right now to see if I can create a folder remotely. Goal is to create folder on a network share and add a security group with READ only permissions. The part i'm stuck on is creating the Shared folder.- 9 replies
-
- share
- folder create
-
(and 2 more)
Tagged with:
-
[RESOLVED] Unable to create to shared Drive
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
Yeah, I pressed enter a little too quickly after the wrong Tab. I tested it out further and it creates a path in my Documents. So now i'm doubting that DirCreate can write to Shared folders. Need to do a little more research. Any input is appreciated.- 9 replies
-
- share
- folder create
-
(and 2 more)
Tagged with:
-
I can't create a file on a shared drive. I know that directory path is valid. and I've verified i have access to the drive but it keeps returning a Error code: 0 Has anyone else seen this? I assume Dircreate has the ability to modify Shared drive files. $shared = "\\Idaho-Share" $Filename = GUICtrlRead($input3) DirCreate($shared & "\Night Team\" & $Filename)
- 9 replies
-
- share
- folder create
-
(and 2 more)
Tagged with:
-
Thank you JOS. That should work like a charm.
- 2 replies
-
- startup script
- logon script
-
(and 2 more)
Tagged with:
-
Is there a way to make it so that we can create a .au3 file to run when a specific user logs into a windows 8.1 computer? I would like to build my own hotkey collection for repetitive tasks but i'd like to it to run when I logon only as I share my computer. (working on a helpdesk isn't luxurious) I'd like to be able to make this only using Autoit. I know i could run task that runs every time i log in but could autoit do this with no third party assistance?
- 2 replies
-
- startup script
- logon script
-
(and 2 more)
Tagged with:
-
This intrigues me. I'm building a little project in Unity5 and this might make things a little quicker. I'll try it out. Thank you for making this UDF, someday i'll be cool enough to post my own.
-
[RESOLVED]Can Autoit filter like Powershell?
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
#include <AD.au3 Func EmailConvertSam() _AD_Open() If @error Then Exit MsgBox(16, "Active Directory", "Function _AD_Open encountered a problem. @error = " & @error & ", @extended = " & @extended) Local $Email = GUICtrlRead($emailaddress) $aObjects = _AD_GetObjectsInOU("", "(mail=" & $Email & ")", 2, "sAMAccountName", "sAMAccountName") _ArrayDisplay($aObjects) _AD_Close() EndFunc ;==>EmailConvertSam@water I figured it out, no need for an example. I'll mark this topic as resolved. Thank you for the accurate direction, very appreciated.- 4 replies
-
- powershell
- ad.udf
-
(and 3 more)
Tagged with:
-
How do you make UDF's?
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
Dang @water's not messing around. Guys quick, comment suggestions for training and I mean some top notch ideas.......like at least a 5/7. -
How do you make UDF's?
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
@orbs Bookmarked and queued for reading @TheDcoder I'll play by the rules until I figure out how to break them. -
How do you make UDF's?
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
@orbs No worries, I wouldn't make something that I wouldn't share with everyone. -
How do you make UDF's?
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
@water Useful for the community. I'd definitely make it for myself but of course i'd share the hell out of it. Autoit has become my new addiction so i'm looking to get real deep into her business. @TheDcoder Thank you, looks like i've got plenty of reading material.............Perfect. -
[RESOLVED]Can Autoit filter like Powershell?
Quantumation replied to Quantumation's topic in AutoIt General Help and Support
I found the help site, I think I see what you're saying. That is awesome. An example would be amazing.- 4 replies
-
- powershell
- ad.udf
-
(and 3 more)
Tagged with:
-
I'm new to scripting and Autoit, but i've already found some things that I would like to create. Where do you start when creating a UDF? For instance, if I wanted to make a UDF for Excel(I know one exists) Where would I start? What would I need to start researching? Any input would be appreciated
-
@Malkey I'm trying to run powershell in my script but it keeps failing. I copied your _Powershell but there is not help file on that. Is that part of a UDF?
-
Is there a way to be able to filter like power can filter? Like the way this powershell script filters for instance: Import-Module ActiveDirectory Get-ADUser -Filter {EmailAddress -eq "$Usersemailaddress"}| Select-Object -ExpandProperty SamAccountName | Out-File C:\Users\"$env:username"\Desktop\email2samconversion.txt Goal is trying to get the SamAccountName by filtering with the email address of a user in AD. I have the AD.UDF but it only works with the Sam and the FQDN. i've tried running powershell in Autoit, but it takes at least 7 seconds to start Powershell>import the module>create the text file>read the text file>Delete the textfile from desktop>Display in Edit box in GUI. I'm wondering if there is a way to filter the search function of AD through autoit kind of like how Powershell does. i've not yet been able to powershell to run properly in Autoit either: I tried: Run(powershell -Command Import-Module ActiveDirectory | Get-ADUser -Filter {mail -eq "$UserEmail"} | Select-Object -ExpandProperty SamAccountName | Out-File C:\users\$env:username\desktop\SamaccountNametextfile.txt") But it keeps failing. I tried using ShellExecute as well and neither of them worked.
- 4 replies
-
- powershell
- ad.udf
-
(and 3 more)
Tagged with:
-
@water I saw those. They are awesome help. Thank you. Still working on it.
-
I was thinking about that. I was just going to ask if if that was compatible but thank you for your reply. I'll fiddle with it and get it working. I'm pretty decent with powershell so that shouldn't be a problem. Thank you @water Hey do you use KODA as your primary GUI designer? Are there other options? Luckily I only have to make this once. Phew.