Jump to content

Using Autoit to teach. Next step?


grakker
 Share

Recommended Posts

Well, here's the deal: I work at a continuation school teaching math. I've started a programming block, just to see who I could get interested.  I'm working with students with low math skills and usually low motivation. I've had a couple of students start to really latch onto programming so it's cool. My background is bash, python, and some C. And, of course, Autoitscript.

So I've had a couple students work through scratch (mit) and learn some basics of programming, tests, loops, etc..  I was going to drop the students into python, but I thought autoit might be a better intro.  I'm just wondering what a couple tasks would be for next step and I'm looking for suggestions.

Basic tasks before gui programming. Any suggestions welcome. Thanks.

Link to comment
Share on other sites

copy lil wayne lyrics to the clipboard then have your program replace naughty words with "dang" or such before writing it to file.

this'll cover clipget, file open, file close, file write, string in string, string reg exp replace, hotkeyset

 

a good kids exercise for arrays is to give them a text file with a thousand or so lines of text.  get them to prepend line numbers to each line

Show them FiletoArray, and arrays, for loops, filewrite

write a little program so when the mouse touches a certain app, like calc that it'll push it away from the mouse wrap across the the other side of the screen  when it hits the edge.

fun stuff for kids because learning programming is really dry at first

Link to comment
Share on other sites

I am not a professional teacher. but a student of autoit....
Teach them a GUI like this in which they can easily make change.
Create a GUI with background colors Title colors etc...
and then ask him to change the colors of GUI from this they learn many things easily from this automatically competition will grow.  whose GUI is looking better?
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <process.au3>
#include <File.au3>
$COMPANY_NAME = "HM-LINK" ; name of the pppoe icon, friendly description
$COMPANY_NAMEnu = "HM-LINK 03216592390"
$SERVICE_NAME = "HM" ; name of the pppoe service configured in NAS/Mikrotik
$NUM = "03216592390"
Local $font
$timeout = 00 ;Restart TimeOut
$DELAY = 300
$Soft = "HM Log_In"
$Name = "Adnan Kashif AbdulRauf Haris"
Local $PathSc = _PathFull(@ScriptFullPath)
$frmInformation = GUICreate($COMPANY_NAME, 287, 230, 193, 115)
GUICtrlSetDefColor(0x006400)
GUICtrlSetDefBkColor(0xeee8aa)
$lblUserName = GUICtrlCreateLabel("User Name:", 16, 42, 60, 17)
$lblPassword = GUICtrlCreateLabel("Password:", 16, 83, 53, 17)
$txtUserName = GUICtrlCreateInput("", 112, 40, 153, 21)
Dim $ES_PA, $ES_AU
$txtPassword = GUICtrlCreateInput("", 112, 80, 153, 21, BitOR($ES_PA, $ES_AU))
$lblPassword2 = GUICtrlCreateLabel("Confirm Password:", 16, 122, 91, 17)
$txtPassword2 = GUICtrlCreateInput("", 112, 120, 153, 21, BitOR($ES_PA, $ES_AU))
$btnOK = GUICtrlCreateButton("&GO!", 208, 200, 68, 25, 0)
GUICtrlSetCursor($btnOK, 0)
$btnbrw = GUICtrlCreateButton("&Browse", 208, 163, 68, 25, 0)
GUICtrlSetCursor($btnbrw, 0)
$txtbrw = GUICtrlCreateInput($PathSc, 112, 164, 85, 21)
$lblbrw = GUICtrlCreateLabel("Select " & $Soft & ":", 16, 166, 90, 17)
$lblInfo = GUICtrlCreateLabel("Enter your " & $Soft & " Information!", 16, 8, 250, 20)
GUICtrlSetFont($lblInfo, 10, 800)
GUICtrlSetColor($lblInfo, 0xff0000) ; Red
$lblInfo3 = GUICtrlCreateLabel($Name, 16, 204, 186, 80)
GUICtrlSetFont($lblInfo3, 9, 800)
GUICtrlSetColor($lblInfo3, 0x9370db)
GUISetState(@SW_SHOW)
While 1
    $uMsg = GUIGetMsg()
    Switch $uMsg
        Case $btnbrw
            Local $message = "You can Choose Hm Soft Log_In only." ;See if company name change.......................................................

            Local $var = FileOpenDialog($message, @ScriptDir & "\", "Icon (*.Ico;*.exe)", 1 + 4)

            If @error Then
                MsgBox(0, $COMPANY_NAMEnu, "No Icon chosen")
            Else
                $var = StringReplace($var, "|", @CRLF)
            EndIf
            ControlSetText($COMPANY_NAME, "", "[CLASS:Edit; ID:11]", $var)
        Case $btnOK
            If GUICtrlRead($txtPassword) <> GUICtrlRead($txtPassword2) Then
                MsgBox(16, "Error " & $NUM, "Passwords do not match! Try again.")
            Else
                $Username = GUICtrlRead($txtUserName)
                If StringLen($Username) = 0 Then
                    MsgBox(64, $COMPANY_NAMEnu, "Plese Enter Your Username.")
                Else
                    $Password = GUICtrlRead($txtPassword)
                    If StringLen($Password) = 0 Then
                        MsgBox(64, $COMPANY_NAMEnu, "Plese Enter Your Passwords.")
                    Else
                        $txtbrwr = GUICtrlRead($txtbrw)
                        If StringLen($txtbrwr) = 0 Then
                            MsgBox(64, $COMPANY_NAMEnu, "Please Choose " & $Soft & ".EXE")
                        Else
                            $txtbrwr = GUICtrlRead($txtbrw)
                            If String($txtbrwr) <> ($PathSc) Then
                                MsgBox(64, $COMPANY_NAMEnu, "You Can Choose " & $Soft & ".EXE Only.")
                            Else
                                $Username = GUICtrlRead($txtUserName)
                                $Password = GUICtrlRead($txtPassword)
                                $txtbrwr = GUICtrlRead($txtbrw)
                                ExitLoop
                            EndIf
                        EndIf
                    EndIf
                EndIf
            EndIf
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
GUISetState(@SW_HIDE)

Like this.......

Edited by adnanbaloch

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Link to comment
Share on other sites

yeah from the students will not only grow competition also get fun and enjoyment..........

Edited by adnanbaloch

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Link to comment
Share on other sites

Thanks guys! I think I'll start with some basics like gruntydatson said. I know from the couple students that are getting into it that as soon as they start seeing possibilities, they will probably run off on their own. I think that's the best way to learn anyway. I just couldn't figure out how to get them over that initial hump. I'm pretty fired up for tomorrow. Thanks again.

Link to comment
Share on other sites

Perhaps look at proper variable declaration, it's something that even people on here overlook.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Let them create a notepad. It will learn them how to use GUI, variable declaration, file writing and reading and a bit of algorithmic coding. :P

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

  • 3 weeks later...

On the weekends I listen to Car Talk on public radio.  Often times they have math puzzlers and often times I just write simple scripts to solve them for my own enjoyment (how sick is that : ).

Here is something I did many years ago.

#cs ----------------------------------------------------------------------------
This may have been a problem from Car Talk many years ago
    Dogs cost $5 each
    Cats cost $2 each
    Mice are 10 for $1
    How many of each will you need to get 100 animals for $100
#ce ----------------------------------------------------------------------------
$Dogs = 0
$Cats = 0
$Mice = 0
For $Dogs = 1 To 20 ;any more than 20 dogs and you would go over $100
    If (($Dogs * 5) + ($Cats * 2) + ($Mice * .1)) > 100 Or ($Dogs + $Cats + $Mice) > 100 Then
        ContinueLoop
    EndIf
    For $Cats = 1 To 50 ;any more than 50 cats and you would go over $100
        If (($Dogs * 5) + ($Cats * 2) + ($Mice * .1)) > 100 Or ($Dogs + $Cats + $Mice) > 100 Then
            $Cats = 0
            ExitLoop
        EndIf
        For $Mice = 10 To 100 Step 10 ;must buy in lots of 10 and you can't have more than 100 animals
            If (($Dogs * 5) + ($Cats * 2) + ($Mice * .1)) > 100 Or ($Dogs + $Cats + $Mice) > 100 Then
                $Mice = 0
                ExitLoop
            ElseIf (($Dogs * 5) + ($Cats * 2) + ($Mice * .1)) = 100 And ($Dogs + $Cats + $Mice = 100) Then
                MsgBox(0, "Total", $Dogs & @TAB & "Dogs" & @TAB & "$" & $Dogs * 5 & @CRLF & $Cats & @TAB & "Cats" & @TAB & "$" & $Cats * 2 & @CRLF & $Mice & @TAB & "Mice" & @TAB & "$" & $Mice * .1 & @CRLF & "-----" & @TAB & "-----" & @TAB & "-----" & @CRLF & ($Dogs + $Cats + $Mice) & @TAB & "Total" & @TAB & "$" & (($Dogs * 5) + ($Cats * 2) + ($Mice * .1)))
            EndIf
        Next
    Next
Next
Link to comment
Share on other sites

  • Moderators

singbass,

 

how sick is that

On the contrary, I think solving that sort of puzzle is very useful as it requires you to think logically to develop a suitable algorithm. This sort of logical thought is needed in any form of coding and, based on some of the questions asked here, it all too often seems to be missing or poorly developed. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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

  • Recently Browsing   0 members

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