tweakster2010 Posted February 2, 2015 Posted February 2, 2015 Ok my entire script is a little too big to squeeze it all in but I think I have it narrowed down to if then statements involving Active Directory. I dont think its an Active Directory issue but the way I may be using my If and then. Meaning without my If then statement it works fine. With my If then statement it works for 1 part of the statement but the other it doesnt. Scenario 1 Direct access for 1 User (picked via Directory List) works fine Scenario 2 Direct access for 2nd User (picked via Different Directory List) works fine Scenario 3 If then applied to both users. (User 1 works user 2 does not ) Scenario 4 If then swapped around User 1 being the 2nd user now and user 2 being the first) The one that worked is still working the one that did not work is still not working. After the Check it moves to a While loop for accessing the links and programs as Cases. Func Program() Local $sFQDN_User = _AD_SamAccountNameToFQDN(GuiCtrlRead($Username1)) ; Get an array of group names (FQDN) that the current user is immediately a member of Local $aUser = _AD_GetUserGroups(GuiCtrlRead($Username1)) Local $sFQDN_Group = $aUser[1] ; Check the group membership of the specified user for the specified group Local $iResult = _AD_IsMemberOf("Identifier 1", $sFQDN_User) Local $iResult1 = _AD_IsMemberOf("Identifier 2", $sFQDN_User) If $iResult = True AND $iResult1 = False Then Now I can swap result 1 and 2 with identifier 1 and 2 and the same one works. Local $emailMenu = TrayCreateMenu("Email") TrayCreateItem("") Local $idExit = TrayCreateItem("Close") Primary example of the Menu its creating and then after all menus/items are created it goes to a While to call the case of each click. When I compile it, it reports an error with variables. My question here is are my variables being declared like above in each "if then" statement crashing it? I would imagine since both identifiers are not looping into each other that it wouldnt double dip either. Just odd but I know im totally missing something and ive been staring at it for awhile now. ><
water Posted February 2, 2015 Posted February 2, 2015 It would help if you could post the error messages when compiling. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
tweakster2010 Posted February 3, 2015 Author Posted February 3, 2015 Thats the thing no error message at all during compiling. The issue he gets is variable driven saying Line 1739: (file path where he saves the .exe) Error: Variable used without being declared. Now to clarify I am in a different group than him and it works for me no line error but for him he gets the line error (he is in the group that does not function when the If then statement is in place but works if there is no if then statement) Case $ticketprogram ShellExecute("File path to ticket program") This is the case I use for launching programs in the list that is populated after it looks for who is listed. Local $ticketprogram = TrayCreateItem("Case being used above", $Menu) The local ticketprogram being used is in both circumstances, I think that may be how I broke it basically. Leading me to believe my only solution would be have everytrhing that is mirrored on both logins go first then check users and populate the differences. that would remove the double variables but I was doing this as a test to check my if then statements to make sure I hit both correctly first. I am still pretty new to some of the principles and was reading the forums yesterday about understanding global vs local in autoit and I was pretty sure I used it in the correct sense but maybe I am mistaken. :/
tweakster2010 Posted February 3, 2015 Author Posted February 3, 2015 (edited) ok I removed the iresults as i dont really need it. I am pretty sure its my If then comparison on the ismember of >< I guess this will show my noviceness in a second. Is it likely the reason its crashing for the other user due to the while loop has Cases that he doesnt have? My if then comparison ends then I have the While loop Local $Service = TrayCreateItem("Service", $Menu) EndIf EndIf While 1 Switch TrayGetMsg() Case $Service ShellExecute("Path for Service") Which i guess I am asking. Should I have a while loop located in each If statement? I thought i was sure it shouldnt be but thats my next test. >.> Edited February 3, 2015 by tweakster2010
Solution tweakster2010 Posted February 3, 2015 Author Solution Posted February 3, 2015 Ok so the solution i used was to include the while loop in each if then statement. My over all issue ended up being I was using defined variables from both sides but only 1 side had access to all of em. So thats where my variables tanked at . Thank you for the effort, was beating my head around this for 2 days lol.
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