Auto DJ Script - Updated 2-26-2022

DataMine
by DataMine · 31 posts
8 years ago in Autoit
Posted 8 years ago · Author
Introduction


This is a dj script requested by
@blackdragonknight


The purpose of this script is to make being a dj easier by automating the trigger process.

Note: This script was designed to work only on songs that meet the following criteria:
-The song must be split into at least 2 triggers.
-The trigger word used for each part of the song must not change.
-The trigger word must contain numbers at the end.

Example Triggers:
Code
trigger1
trigger2
trigger3


Here is an example song this script works with: https://www.imvu.com/shop/product.php?p ... d=31065364


Instructions


Step 1 Make sure IMVU is open and you are in a room where you want to play the song.

Step 2 Make sure the IMVU chat window in open.

Step 3 Download AutoIT from their website here: http://www.autoitscript.com/site/autoit/. Autoit is the scripting language this script is written.

Step 4 After installing AutoIT, open the script editor (SciTE) that comes with it and copy/paste the code below into it.

Step 5 In SciTE, go up to Tools and click Go (or press F5 on your keyboard). The script will start and be waiting for you to press one of the keys in the next step.

Step 6 Press F6 on your keyboard. This tell the script you want to play a song. It will bring IMVU to the foreground and begin asking you for information.

Step 7 The first box that opens asks you for the trigger word. This is the word you would type into the chat to play part of the song. Make sure you don't type in the numbers.

Example: If the trigger is MySong1, type in MySong.

Step 8 The next box that opens asks for you the first trigger's number.

Example: If the first trigger is MySong1, then type in 1.

Step 9 The next box that opens asks you for the last trigger's number.

Example: If the last trigger is MySong15, then type in 15.

Step 10 The last box that opens asks you for the last trigger's duration in seconds.

Example: If each trigger lasts 20 seconds long you would type in 20.

Once you have entered in the information in all the boxes, if all went well, the script will proceed to start typing the triggers into the chat.

Code
;~ This is the key you press to start playing the song
HotKeySet("{F6}", "Start")

;~ This is the key you press to stop playing the song.
HotKeySet("{F7}", "StopSong")

;~ This is the key that closes the script
HotKeySet("{ESC}", "Terminate")

;Set global variables
Global $sSleep = 0
Global $bStop = False

;The trigger phrase all triggers are named after
Global $sTriggerWord

;The number the trigger begins on Ex: mir13
Global $iTriggerBegin

;The number the trigger ends on Ex: mir25
Global $iTriggerEnd

;The length of the truggers Ex: 20(sec)
Global $iTriggerLength

;~ This keeps the script from closing
While 1
   Sleep(100)
Wend

Func Start()
   ;Reset the stop variable if the user starts a new song after stopping the old one
   If($bStop = True) Then
     $bStop = False
   EndIf

   ;Check to make sure IMVU is running
   If (IMVUisRunning() = False) Then
     ;Exist the script if IMVU is not running
     Terminate()
   EndIf

   ;Bring IMVU to the front
   BringIMVUToFront()

   ;Setup the song variables
   SetupSong()

   ;Pauses the script for 1 second to add a small delay before the script starts typing the triggers
   Sleep(1000)

   ;Play the song
   PlaySong();
EndFunc

;~ This function sets up the input variables the script needs to play the song
Func SetupSong()
   $sTriggerWord = InputBox("Enter Trigger Word", "Please type in the trigger word without any numbers")

   ConsoleWrite($sTriggerWord & @LF)

   While Not StringIsDigit($iTriggerBegin)
     $iTriggerBegin = GetTriggerStart()
   WEnd

   ConsoleWrite($iTriggerBegin & @LF)

   While Not StringIsDigit($iTriggerEnd)
     $iTriggerEnd = GetTriggerEnd()
   WEnd

   ConsoleWrite($iTriggerEnd & @LF)

   While Not StringIsDigit($iTriggerLength)
     $iTriggerLength = GetTriggerLength()
   WEnd

   ConsoleWrite($iTriggerLength & @LF)
EndFunc

;~ This function plays the song by typing the triggers into the chat
Func PlaySong()
   $iBegin = $iTriggerBegin
   Do
     If($bStop = True) Then
       return
     EndIf
     Send($sTriggerWord & $iBegin)
     Send("{ENTER}")
     Sleep($iTriggerLength * 1000)
     $iBegin = $iBegin + 1
   Until $iBegin = $iTriggerEnd + 1
EndFunc

;~ This function stops the song
Func StopSong()
   $bStop = True
EndFunc


;~ -----------------------------------------------------------
;~ WARNING: DO NOT EDIT CODE BELOW THIS LINE
;~ -----------------------------------------------------------

Func GetTriggerStart()
   return DisplayInputBox("Enter Trigger Begin", "Please type in the number the belongs to the first trigger")
EndFunc

Func GetTriggerEnd()
   return DisplayInputBox("Enter Trigger End", "Please type in the number the belongs to the last trigger")
EndFunc

Func GetTriggerLength()
   return DisplayInputBox("Enter Trigger Length", "Please type in the length of the trigger in seconds")
EndFunc

Func DisplayInputBox($sTitle, $sBody)
   return InputBox($sTitle, $sBody)
EndFunc

;~ This function closes the script
Func Terminate()
   Exit 0
EndFunc

;~ This function Detects if the IMVUClient is running
Func IMVUIsRunning()
   If ProcessExists("IMVUClient.exe") OR ProcessExists("IMVUQualityAgent.exe") Then
     Return True
   Else
     Return False
   EndIf
EndFunc

;~ This function gets the IMVUClient window
Func GetIMVUWindow()
   Opt("WinTitleMatchMode", 4)
   $hICWindow = WinGetHandle("[CLASS:ImvuNativeWindow]")
   return $hICWindow
EndFunc

;~ The function brings the IMVU client to the foreground so we don't accidently type into something else
Func BringIMVUToFront()
   $hICWindow = GetIMVUWindow()
   WinActivate($hICWindow)
   WinWait($hICWindow)
EndFunc
Last edited by DataMine on Sun Feb 27, 2022 1:02 am, edited 2 times in total.
Reason: fixed example song link, updated coded, updated instructions
Posted 8 years ago
Haha thats a pretty neat script. plus i have never tried autoit.
Posted 8 years ago
That's genius, very well done. I know a few people that DJ or used to and I can see where they'd benefit from this
Posted 5 years ago
I tried it and its very useful.

Thank you M.D
Posted 5 years ago
Thank you bro
Posted 4 years ago
I saw this at a Dj show and it was amazing. Bravo !
Posted 4 years ago
This is pretty dope, I was wondering if something like this existed
Posted 4 years ago
Sounds intersting
Posted 3 years ago
Greetings..

If i get this code just like this, i'm getting the error below when i try to compile it.

>Running AU3Check (3.3.14.5) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\Cermencik\Desktop\td.au3
"C:\Users\Cermencik\Desktop\td.au3"(35,11) : error: stop(): undefined function.

If i change that "stop" with "start" then no problem. Compiles it.

All goes well until script starts. First 2 triggers goes well but when it suppose to typ 3rd trigger after 20, it doesnt. There being more delay then 20 secs like 25 - 26 sec. And so on, more and more delay on further triggers like 30 - 31 sec, 35 - 36...

Any idea about how to fix this problem ?


Fixed it. Thanks.
Posted 2 years ago
Is there an easier way to learn this ?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Sign in

Already have an account? Sign in here

SIGN IN NOW

Create an account

Sign up for a new account in our community. It's easy!

REGISTER A NEW ACCOUNT
Select a forum Protection     Help & Support     Introductions     Mafia News     IMVU News General Discussion     IMVU Lounge        IMVU Series / Roleplaying        Social Games     Mafia Market     Mafia Tools        Premium IMVU Tools        Off Topic Tools     Off Topic     Contests Creator Corner     Graphics Design        Photoshop        GIMP     Basic Creator Help     Catalog And Product Showcase     3D Meshing        3Ds Max        Sketchup        Blender Gangsters with Connections     White Hat Activities        Google Hacking        Trackers Programming Corner     Coding        Python        .Net (C#, VB, etc)        Flash        JAVA        Autoit        Batch        HTML & CSS        Javascript        PHP        Other        IMVU Homepage Codes           General           About me Panel           Messages Panel           Special Someone Panel           Visitors Panel           New Products Panel           Rankings Panel           Wishlist Panel           My Badges Panel           Outfits Panel           Url Panel           Groups Panel           Slideshow Panel           My Room Panel           Sandbox panel           Layouts     Help & Requests Free Credits     Approved Methods     Submit Methods Free Money     Approved Methods     Submit Methods Adult Corner     Get Mafia AP Here     AP Lounge        AP Social Games        Casual Dating Tips     IMVU Slave Market & Escorts