Sign in to follow this  
Followers 0

GUI Newb Needs A Little Direction

4 posts in this topic

Hey guys, been using AutoIt for a few years now and never really got a chance to mess with the GUI stuff. But now I'm developing this simple reporting tools that I would like to open up with a GUI. The script is a basic Active Directory search and report script using dsquery.exe and dsget.exe. I know there is an adfunctions UDF but I'm trying to keep things as simple as possible without using third-party tools/scripts.

Here is the script:

#Region;**** Directives created by AutoIt3Wrapper_GUI ****
#EndRegion;**** Directives created by AutoIt3Wrapper_GUI ****



$query=Run($dsquery&' user "OU=users,OU=jax,'&$domain&'" -limit 0 -scope subtree',"","", 2)

Until @error



For $item In $array
    $cmd=Run($dsget&" user "&$item&" -samid","","", 2)
        Until @error

$get=StringReplace($get,"dsget succeeded","")
$get=StringReplace($get," ",@CRLF)



And here is the basic GUI code I got from messing around with the Koda form designer:

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=C:\Documents and Settings\Administrator\Desktop\scripts\gui.kxf
#EndRegion ### END Koda GUI section ###

While 1
Switch $nMsg

Case $Browse
Case $Run

I really just have no idea how I structure those two, how I make it so when I click a check box it adds that variable to the script, etc. I'm not looking for anyone to do it for just maybe give me some basic pointers to get me going.

Also, if anyone would like to help streamline the script that would be good, I'm sure I'm going about somethings the wrong way so help a brother out!

*The script won't work unless you have dsquery and dsget in a 'bin' folder parallel to the script. I do this because the workstation I run it from isn't Server 2003 so it doesn't have it by default. If you run this from a server you can edit those variables so it uses the server's copy located in system32. Also don't forget to check the syntax for the dsquery part, since my OU structure is bound to be different than yours.*

Share this post

Link to post
Share on other sites

The magic is here:

While 1
Switch $nMsg

Case $Browse
Case $Run
WEndoÝ÷ Ú²Ì!jÜ(ºWaj^^*.¦·¬±çmæë£nëm¢r'Ê«q«Ê°¢é]¶©Ê«r^vºw-źw&Éû§pIÝéÜjwiºÙ²~éÜ{-y§h|Ë S¡È^rKazËZ¶ë(*.­È^rFèÅë.±á +kvX¤zʺÚ"µÍØÙH  ÌÍÐÝÜÙBRYÕRPÝXY

I think you'll figure it out.

Share this post

Link to post
Share on other sites

I was wondering what all that down there did, I'll review and beta some attempt at this and fill ya in.

Share this post

Link to post
Share on other sites

By the way, the checkboxes also fire an event when clicked. Add this to the loop to test:

Case $Recursive
    If GUICtrlRead($Recursive) = $GUI_CHECKED Then
        MsgBox(0,"Alert","Recursive is checked!")
        MsgBox(0,"Alert","Recursive isn't checked!")

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