Jump to content

My little scripts


themax90
 Share

Recommended Posts

Here are just some of my scripts that people might like....

Rename mp3.au3

This is actually used for ALL MEDIA FILES. You know when you use media player 10 and you rip a cd and you get that gay ass dash between artist and song name. <Artist>-<SongName>.* Well if you have <Arist> then <songname> or anything with only 2 things, so it can be seperated, it will rename with a space. Korn-Right Now.mp3 to Korn - Right Now.mp3. Saves me alot of time, so have fun. MUST HAVE ONLY ONE DASH!!! It will appear <sectionone> - <sectiontwo>(origin. <sectionone>-<sectiontwo>).

#include <GuiConstants.au3>
GUICreate("Rename Utility", 210, 340, (@DesktopWidth - 200) / 2, (@DesktopHeight - 365) / 2, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$filelist = GUICtrlCreateList("", 10, 10, 190, 149)
$add = GUICtrlCreateButton("Add", 10, 140, 90, 20)
$start = GUICtrlCreateButton("Work", 110, 140, 90, 20)
$history = GUICtrlCreateLabel("History.....", 10, 170, 190, 160, $SS_SUNKEN)
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    ElseIf $msg = $add Then
        $filelist2 = FileOpenDialog( "Choose files....", @DesktopDir, "Media Files(*.mp3; *.wav)", 5)
        $filelist2 = StringSplit($filelist2, "|")
        $filelistamount = $filelist2[0] + 1
        $n = 2
        $t = 0
        Dim $filelist3[$filelistamount - 2]
        While $n <> $filelistamount
            $filelist3[$t] = $filelist2[$n]
            $t = $t + 1
            $n = $n + 1
        WEnd
        $n = 2
        $t = 0
        While $n <> $filelistamount
            GUICtrlSetData($filelist, GUICtrlRead($filelist) & @LF & $filelist3[$t])
            $t = $t + 1
            $n = $n + 1
        WEnd
        $dir = $filelist2[1]
    ElseIf $msg = $start Then
        $n = 2
        $t = 0
        While $n <> $filelistamount
            $var = StringSplit($filelist3[$t], "-")
            $var[0] = $var[1] & " - " & $var[2]
            FileCopy($dir & "\" & $filelist3[$t], $dir & "\" & $var[0])
            FileDelete($dir & "\" & $filelist3[$t])
            GUICtrlSetData($history, GUICtrlRead($history) & @LF & "Renaming " & $filelist3[$t])
            $n = $n + 1
            $t = $t + 1
        WEnd
        GUICtrlSetData($history, GUICtrlRead($history) & @LF & "Finished!" & @lf & "Exiting....")
        Sleep(2000)
        ExitLoop
    EndIf
WEnd
Exit

IpScout

#include <Inet.au3>
#include <GuiConstants.au3>
GuiCreate("IpScout", 174, 75,(@DesktopWidth-174)/2, (@DesktopHeight-75)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$iplabel = GuiCtrlCreateLabel("Waiting for update!", 10, 10, 160, 30, $SS_SUNKEN)
$update = GuiCtrlCreateButton("Update", 90, 50, 70, 20)
$updatecheck = GuiCtrlCreateCheckbox("AutoIP", 10, 50, 60, 20)
GuiSetState()
While 1
    $msg = GuiGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        ExitLoop
    ElseIf $msg = $update Then
        $PublicIP = _GetIP()
        $NetworkIp = @IpAddress1
        GUICtrlSetData( $iplabel, "Public IpAddress: " & $PublicIp & @lf & "Network IpAddress: " & $NetworkIp)
    ElseIf GUICtrlRead($updatecheck) = $GUI_CHECKED Then
        $PublicIP = _GetIP()
        $NetworkIp = @IpAddress1
        GUICtrlSetData( $iplabel, "Public IpAddress: " & $PublicIp & @lf & "Network IpAddress: " & $NetworkIp)
    EndIf
WEnd
Exit

Quadratic calculator(verified)

Func QuadCalc($a, $b, $c)
    Dim $calc[2], $final[2]
;Creates Array Varibles For Process
    $calc[0] = (-1) * ($b)
    $calc[1] = ($b * $b) - (4 * $a * $c)
;First Two Base Commands
    If $calc[1] < 0 Then
   ;Before SqRt is calculated check varible. If negitive send impossible
        MsgBox(0, "Quad Answers", "This problem is impossible because the Square Root became a negitive integer.")
    ElseIf $calc[1] >= 0 Then
   ;If non-negitive, calculate further equation and send
        $calc[1] = Sqrt($calc[1])
        $final[0] = ($calc[0] + $calc[1]) / (2 * $a)
        $final[1] = ($calc[0] - $calc[1]) / (2 * $a)
        MsgBox(0, "Quad Answers", "The answers are: " & $final[0] & ", " & $final[1])
    EndIf
EndFunc

Clock(using system clock)

HotKeySet( "{ESC}", "Close")
Global $sec = @SEC, $minute, $hour, $light, $time, $clocklabel
opt("WinWaitDelay", 100)
opt("WinTitleMatchMode", 4)
opt("WinDetectHiddenText", 1)
opt("MouseCoordMode", 0)
GUICreate("Max's Clock", 200, 50, (@DesktopWidth - 188) / 2, (@DesktopHeight - 59) / 2)
$clocklabel = GUICtrlCreateLabel("Loading...", 5, 5, 190, 40, 0x1000)
GUICtrlSetFont($clocklabel, 24)
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then
        ExitLoop
    ElseIf $sec <> @SEC Then
        GUICtrlSetData($clocklabel, TimeSet())
        AlarmCheck(TimeSet())
    EndIf
WEnd
Exit
Func AlarmCheck($time)
;Alarm function(configure how wanted)
EndFunc ;==>AlarmCheck
Func Close()
    Exit
EndFunc ;==>Close
Func TimeSet()
    $light = " AM"
    $hour = @HOUR
    $minute = @MIN
    $sec = @SEC
    If $hour = 0 Then
        $hour = 12
    ElseIf $hour = 12 Then
        $light = " PM"
    ElseIf $hour > 12 Then
        $hour = (@HOUR) - 12
        $light = " PM"
    EndIf
    $time = $hour & ":" & $minute & ":" & $sec & $light
    Return $time
EndFunc ;==>TimeSet

Keyboard operated mouse w/ keyboard based loader

Loader.au3

HotKeySet( "{F11}", "_Open")
While 1
Wend
Func _Open ()
    Run(@ScriptDir & "\mouse.exe")
EndFunc ;==>_Open

Mouse.au3

HotKeySet( "w", "_UpArrow")
HotKeySet( "s", "_DownArrow")
HotKeySet( "a", "_Leftarrow")
HotKeySet( "d", "_RightArrow")
HotKeySet( "q", "_LeftClick")
HotKeySet( "e", "_RightClick")
HotKeySet( "{F10}", "_Close")
$x = 100
$y = 100
$z = -1
MouseMove($x, $y)
While 1
    If $z = 0 Then
        Exit
    EndIf
Wend
Func _UpArrow()
    $y = $y - 10
    MouseMove($x, $y, 0)
EndFunc ;==>_UpArrow
Func _DownArrow()
    $y = $y + 10
    MouseMove($x, $y, 0)
EndFunc ;==>_DownArrow
Func _Leftarrow()
    $x = $x - 10
    MouseMove($x, $y, 0)
EndFunc ;==>_Leftarrow
Func _RightArrow()
    $x = $x + 10
    MouseMove($x, $y, 0)
EndFunc ;==>_RightArrow
Func _LeftClick()
    MouseClick( "left", $x, $y, 1, 0)
EndFunc ;==>_LeftClick
Func _RightClick()
    MouseClick( "right", $x, $y, 1, 0)
EndFunc ;==>_RightClick
Func _Close()
    $z = 0
    Exit
EndFunc ;==>_Close

Agent Encrypt 1.0(used to password, cipher passwords, and imprint files to an excutable which can be used to hide within a labyrinth of various shutdown excutables to stop anyone wanting the files, use installer and it will install to user specific directory w/ source)

Card Deck simulation /w errors and example, all source

Example.au3

; Deck INI Location
$deck = @tempdir & "\Deck.ini"
; Reference Password
$ref = 1
SplashTextOn("", "Creating Deck........", "150", "20", "-1", "-1", 1, "", "", "")
DeckCreate($ref)
SplashOff()
While 1
    $card = CardDraw($ref)
    If $card = 0 Then
        MsgBox(0, "Deck Empty", "Deck Depleted.")
        Exit
    Else
    MsgBox(0, "Card Draw", "Your card is : " & CardInterpret($card))
    EndIf
WEnd
; Include card functions and errors in reference to card functions
#include "Include\cards.au3"
#include "Include\errors.au3"

Cards.au3

Func DeckCreate($ref)
    IniWrite($deck, "Deck" & $ref, "CS", "52")
    $i = 52
    While $i <> 0
        IniWrite($deck, "Deck" & $ref, $i, "0")
        $i = $i - 1
    WEnd
    While IniRead($deck, "Deck" & $ref, "CS", -1) <> 0
        $a = Random(1, 13, 1)
        $b = Random(1, 4, 1)
        $card = $a & ":" & $b
        $cardcheck = CardCheck($card, $ref)
        If $cardcheck = 1 Then
            $spot = IniRead($deck, "Deck" & $ref, "CS", -1)
            If $spot = -1 Then
                Error(0)
            Else
                IniWrite($deck, "Deck" & $ref, "CS", ($spot - 1))
                IniWrite($deck, "Deck" & $ref, $spot, $card)
            EndIf
        ElseIf $cardcheck = 0 Then
            Sleep(1)
        EndIf
    WEnd
    IniWrite($deck, "Deck" & $ref, "CS", "52")
EndFunc;==>DeckCreate
Func DeckDelete()
    FileDelete($deck)
EndFunc;==>DeckDelete
Func CardCheck($card, $ref)
    $i = 52
    While 1
        $check = IniRead($deck, "Deck" & $ref, $i, -1)
        If $check = -1 Then
            Error(0)
        ElseIf $check = $card Then
            Return 0
            ExitLoop
        ElseIf $check = 0 Then
            Return 1
            ExitLoop
        ElseIf $check <> $card And $check <> 0 And $check <> - 1 Then
            $i = $i - 1
        EndIf
    WEnd
EndFunc;==>CardCheck
Func CardDraw($ref)
    $cardspot = IniRead($deck, "Deck" & $ref, "CS", -1)
    If $cardspot = -1 Then
        Error(1)
    ElseIf $cardspot = 0 Then
        Return 0
    Else[attachmentid=3499]
        IniWrite($deck, "Deck" & $ref, "CS", ($cardspot - 1))
        $drawcard = IniRead($deck, "Deck" & $ref, $cardspot, -1)
        IniWrite($deck, "Deck" & $ref, $cardspot, "0")
        If $drawcard = -1 Then
            Error(1)
        Else
            Return $drawcard
            IniWrite("Deck.ini", "Deck" & $ref, $cardspot, "0")
        EndIf
    EndIf
EndFunc;==>CardDraw
Func CardInterpret($card)
    $card = StringSplit($card, ":")
    $card[1] = StringReplace($card[1], "4", "Four")
    $card[1] = StringReplace($card[1], "5", "Five")
    $card[1] = StringReplace($card[1], "6", "Six")
    $card[1] = StringReplace($card[1], "7", "Seven")
    $card[1] = StringReplace($card[1], "8", "Eight")
    $card[1] = StringReplace($card[1], "9", "Nine")
    $card[1] = StringReplace($card[1], "10", "Ten")
    $card[1] = StringReplace($card[1], "11", "Jack")
    $card[1] = StringReplace($card[1], "12", "Queen")
    $card[1] = StringReplace($card[1], "13", "King")
    $card[1] = StringReplace($card[1], "3", "Three")
    $card[1] = StringReplace($card[1], "2", "Duce")
    $card[1] = StringReplace($card[1], "1", "Ace")
    $card[2] = StringReplace($card[2], "1", " of Hearts")
    $card[2] = StringReplace($card[2], "2", " of Diamonds")
    $card[2] = StringReplace($card[2], "3", " of Spades")
    $card[2] = StringReplace($card[2], "4", " of Clubs")
    $card = $card[1] & $card[2]
    Return $card
EndFunc;==>CardInterpret
Func CardNum($card)
    $card = StringSplit($card, ":")
    If $card[1] = "13" Or $card[1] = "12" Or $card[1] = "11" Or $card[1] = "10" Then
        $newcard = 10
    ElseIf $card[1] = "1" Then
        $newcard = 1
    ElseIf $card[1] = "2" Then
        $newcard = 2
    ElseIf $card[1] = "3" Then
        $newcard = 3
    ElseIf $card[1] = "4" Then
        $newcard = 4
    ElseIf $card[1] = "5" Then
        $newcard = 5
    ElseIf $card[1] = "6" Then
        $newcard = 6
    ElseIf $card[1] = "7" Then
        $newcard = 7
    ElseIf $card[1] = "8" Then
        $newcard = 8
    ElseIf $card[1] = "9" Then
        $newcard = 9
    EndIf
    Return $newcard
EndFunc;==>CardNum

Errors.au3

Func Error($num)
;misplaced, sorry!
EndFunc

and finally ProcessList Generator

#include <Array.au3>
$file = "Processes.txt"
$sort = 0
;$file =  file to save generated list to
;$sort = -1 then no sorting
;$sort = 0 then sort acsending
;$sort = 1 then sort desending

$array = ProcessList()
$t = $array[0][0]
FileWriteLine($file, "Number of processes : " & ($t - 1))
$n = 1
Dim $arrayfinal[$t]
While $n <> $t
$arrayfinal[$n] = "Process : " & $array[$n][0] & "  PID : " & $array[$n][1]
WEnd
$n = 1
If $sort = 0 Then
_ArraySort($arrayfinal)
ElseIf $sort = 1 Then
_ArraySort($arrayfinal, $sort)
EndIf
While $n <> $t
FileWriteLine($file, $arrayfinal[$n])
WEnd

These are the scripts I've made in the past month for all to study and use, if you would like a WAYYYYY previous script that I have made please search the forums or email me at king.of.all@comcast.net or PM me with the request.

"You cannot cross oceans if you do not have the courage to loose sight of the shore."

May peace be with you,

AutoIt Smith(Max Gardner)

Edited by AutoIt Smith
Link to comment
Share on other sites

Cool stuff here. Your 'Rename mp3' reminds me of a program I wrote up a while ago that I used for the same thing, but left it a little more generic. After reading about yours I decided to bug fix mine (I wrote it a while ago, older version of AutoIt) a little bit and post it on my apps page. Thanks for reminding me!

Link to comment
Share on other sites

No Problem dude! I find as I get older at scripting my programs get way more complex, I guess my next step is a multiplayer or online blackjack game, and then a rummy came using the au34xtra and msging system. I am welcome to all feedback, and I want to say thank you all for accepting me finally, after many many complex scripts after another!

I need help with Blackjack 2.0, it's going to be graphic and I do need some help with 3.0 which I am just working on the base which will be the graphic 2.0 only multi threaded for online play.

Talk to you all later....

AutoIt Smith

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...