Alrighty guys, I’ve got all my kinks for this script worked out, and figured out how I’m going to do what I want to do. There are just 2 more things I want to do which I cannot figure out. One is major, and I don’t want to release this without doing it, and the second is only minor, more cosmetic then anything.
first of all, my code
tell application "Finder"
display dialog "This script will first rename your homebrew for 1.5 so that the 'corrupted data' icons do not show up, and then will move your game files to the correct folder, if you choose to do so." buttons {"OK", "Cancel"}
if button returned of the result is "Cancel" then
quit
else
if button returned of the result is "OK" then
display dialog "First you will enter the name of your homebrew. This will not affect how it shows up on your PSP, it just allows you to find it on your Memory Stick.
Second, you will choose the folder with the game.
Third, you will choose the exploit folder, which is the folder with the % sign in its name"
set brewname to text returned of (display dialog "What is this homebrew called?" default answer "")
set partone to (choose folder with prompt "Choose the main folder" without invisibles) --get the name of the main folder
set parttwo to (choose folder with prompt "Choose the second folder, with the % in front" without invisibles) --get the name of the secondary folder
if partone is parttwo then
display dialog "You cannot chose the same folder, please make sure to choose two different folders" buttons {"OK"}
quit
end if
--**lets quickly set up the path to the games folder
set gamefold to ((path to me as string) & ":Contents:Resources:Games:")
set name of folder partone to ("__SCE__" & brewname)
set name of folder parttwo to ("%__SCE__" & brewname)
duplicate folder partone to gamefold
duplicate folder parttwo to gamefold
end if
end if
--a list in here somewhere to show what games have been moved to the games folder already, hopefully with a way that does not allow the user to select anything, just shows what is in the folder
display dialog "Do you want to add more homebrew?" buttons {"Yes", "No"}
--somehow, I need to have the script loop back to defining 'brewname', and continue this cycle until the user says they do not have any more homebrew to add
display dialog "We are now going to get the disk with your memory stick. Please be sure your PSP is on, plugged into the computer, and is in USB mode before clicking OK" buttons {"OK"}
if button returned of the result is "OK" then
set disklist to list disks
set pspstick to (choose from list disklist with title "Select your Memory Card")
set gameloc to ((pspstick as string) & ":PSP:GAME:")
end if
--I'll add in the move commands once we have this repeat section working
end tell
Ok, my major point, which I’m hoping to find a way to solve, is this. When the script first runs, it goes through the steps, until it gets to the “Do you want to add more Homebrew” dialog. If the user selects yes, I want the script to loop back to defining the brewname variable. If no, it continues on to the end of the script. I, unfortunatly, don’t have much experence with loops and repeats, so I’m not too sure how to go with this.
A few cosmetic things I wanted to do, which I have tried several methods and not worked.
- Make the user only define one folder, since all games that are released have 2 folders, with the same name, in the same directory. (I.E- mygame, and %mygame). So instead of having to select folders twice, have the user select mygame, and then the script automatically finds %mygame in the same directory, and renames it correctly. (I.E- Mygame can be renamed through the varaible, but the script sees that there is another folder with ‘mygame’ in its name in the same directory, so it also gets that one, sees it has a % in its name, so it renames it differently). I don’t know if it can be done, but I figured I’d throw it out there.
The second, is how would I define a list not to allow user selections, so it just shows the contents of the list. (Or in this case, folder contents coorced into a list) When the user clicks OK, it just continues on, and doesn’t do anything with the list. (I’m also hoping to find a way to have the result of brewname be put into a list as well as being used in renaming the folder, so its easier to understand instead of folder names, but I don’t know if you can do two different things with one variable)
Once again, thanks for all your help Hopefully, this thing will be done before long