Sims 2: Creating Files with AutoIT
Jun. 27th, 2020 07:28 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Creating Sims 2 Body Shop files with AutoIT – V1.0: 06/26/2020
***WARNING: HIGHLY EXPERIMENTAL. USE AT YOUR OWN RISK!***
***For use with Windows OS only!***
A few months ago, I discovered AutoIT, which lets you automate mouse clicks. This was an absolute lifesaver for me. I was just about to create a metric butt-ton of Sims eyes for my eye set, and I had plans to do all of my texture importing in SimPE, which meant I just wanted a bunch of plain exported eye files. I really didn’t want to sit at my computer for a couple hours, importing Body Shop files and slowly giving myself carpal tunnel.
For some programs, AutoIT can interact with the buttons, write text in text spaces, and otherwise use the program the way a user would. This wasn’t an option for Body Shop sadly; AutoIT doesn’t recognize anything in the window as interactable. I got around this by telling AutoIT to just make a series of mouse clicks in very specific locations. I modified a script by the creator of AutoIT, Jonathan Bennett.
Let’s get started! First, you’ll need to download the AutoIT program, as well as the script. You can use the exe installer or the zip files for AutoIT, it doesn’t matter. Once that’s done, find the program in the AutoIT folder called Au3Info, and open it.
Use the small arrow keys on the right side to find the “Mouse” tab. This is what you’ll use to determine the locations of the buttons in Body Shop.
Now open up Body Shop. MAKE SURE YOU DON’T MOVE AROUND THE BODY SHOP WINDOW DURING THIS TIME!! You’re finding the location of the buttons on your screen as a whole, not within the window, so moving Body Shop around will throw everything off!
Open up the AutoIT_CreateSimsFiles script. It should open in Notepad or another text editor. $num is the number of files you want to create. You’ll likely change this often. $X1 through $X6 and $Y1 through $Y6 are the locations in x and y coordinates of the buttons you want to press on your screen.
Head to the “Create Parts” screen on Body Shop. Click the “Finder” tool in your Au3Info window. Drag it to your Body Shop program, and release the mouse button when it’s over the “Load Saved Project” button. You should get a set of coordinates in the position field in Au3Info. Mine are 706 and 395. Your coordinates will be different! The first number is the x coordinate ($X1) and the second number is the y coordinate ($Y1). Type this into your script file.
Now head to the Load Project screen. Use the “Finder” tool again to determine the location of your top project (Go ahead and create one if you don’t have previous projects already!). The coordinates for this button are $X2 and $Y2.
While you’re still on this screen, find the location of the “Load Selected Project” button for $X3 and $Y3. Try to drag the finder to the middle of the button for this one.
Load the project, and press the “Import to Game” button. This button is in the same location as the load button, so you don’t need to worry about it. Once it imports, use the finder to find the location of the “Accept” button that comes up. This is $X4 and $Y4.
Click accept. Now find the location of the “Cancel” button on the next screen. This is $X5 and $Y5.
Click cancel, and find the location of the “Cancel” button on this screen for $X6 and $Y6.
After you click cancel again, you’ll be back on the “Create Parts” screen. You should have values for all of your coordinates now. Go ahead and type a 1 in for the $num variable. Save your text file! You can also close out of Au3Info now too.
Open up the AutoIT3 program. It will prompt you to choose a script to run. Navigate to here you’ve saved the AutoIT_CreateSimsFiles script, and click open. You should get a dialogue box with a “Yes” button and a “No” button. Before you click yes, make sure the next window open underneath the dialogue box is Body Shop.
Once you’ve clicked yes, TAKE YA HAND OFF THE MOUSE! Your cursor will automatically move itself. Note that there is a pretty large delay between mouse clicks, so wait a bit before touching anything. If everything goes according to plan, you should have just created one Sims file. Yay!
If for some reason it doesn’t work, check your coordinates. If you moved the Body Shop window at any point, your coordinates and clicks will be off.
You’re done with the hard stuff! You can now use your script to create any files you want. Just change the $num variable to the amount of files you want to create, and make sure the projects you want to import are in the top of the list in the “Load Project” screen. Once again, don’t move the Body Shop window at all, and don’t move your mouse while the program is running. You won’t be able to use your computer while this is going on, which is not fantastic, but you can go do other things. Read a book, take a shower, dismantle capitalism, knit a sweater! I once set up the script to create the files for my skin sets while I ran to class. Efficiency!
Let me know if you have any questions or run into any problems!
Advanced Info
AutoIT uses a “Basic-like” coding language, but is fairly similar in syntax to other languages. Semi-colons (;) are your comment out characters, and dollar signs ($) are placed in front of variables to write them to memory or call them in.
I intentionally set the delay between mouse clicks to be large because my computer is a dinosaur. If you want to change this because your computer is either from the Precambrian or you stole it from NASA, scroll through the script until you find the code chunk starting with “; Execute the loop $num times”. You’ll see three lines that start with “AutoITSetOption”. Check out the number after "MouseClickDelay" in those lines. That’s the number of milliseconds (1/1000s of a second) you want to delay the following clicks by. I’ve set it to 1000 milliseconds (1 second) for the first click, 6000 milliseconds for the second through fourth clicks, and back to 1000 milliseconds for the final three clicks. Change these to whatever numbers you want.