Hey guys, well im a bit bored and, i know theres alot of anxious people waiting for more mac scripters to come out and make new stuff. So i decided i would make a small guide on how to link applescripts with Xcode for the new people to start developing their own programs!
so, here we go!
we're gonna be making a VERY simple spam bot for wow. This is gonna be in its simplist form and note, its not gonna be the best spam bot out there, this is for learning uses
so, first we need to start with making a Xcode project. and to do that, you need Xcode which can be downloaded here:
http://connect.apple.com/cgi-bin/Web...wKQ5DG1oLisk5p
after that, boot up Xcode and go up to file, and then New Project then go down to Application and Choose Applescript Application
lets name it Project1 and save it on the desktop.
now, time to make our spambot applescript.
the main script we're gonna use for this project is
now, for some explaining on what it means.Code:repeat 5 times tell application "System Events" tell application "world of warcraft" to activate key code 36 keystroke "spppaaammmm" key code 36 delay 30 end tell end repeat
1.its pretty easy to understand, first things first,you of course have the repeat at the time showing how many times you want your program to repeat you need to put system events in there because thats what we're workin with, and it also opens up so you can compile the whole script better. ( cant think of a better way to explain this part xD)
2nd.says exactly what it does...: activates world of warcraft, and links it to the following part of the scriptCode:Tell application "world of warcraft" to activate.Code:key code 36
this will make wow enter key code 36 which is defined as "enter", which allows the bot to enter the spam you want.
3rd. we saythis defines what you want to say in game,Code:keystroke "sppaaamm"
and then again:to enter the text in game.Code:key code 36
last: you then can enter a delay on how many seconds till the app is spammed again.
and thenat the end to end the script, andCode:end tellto fully end it.Code:end repeat
--- so thats our main script, now to link it into your Xcode program and create your interface!---
in the main screen of your Xcode project, look under goup and files collum, and choose the top tab, in this case Project1
at the bottom of this tab you should see Project1.applescript this is where we are going to input the script we made above, as well as another part to define it to a button to execute into WoW.
so go ahead and open that up and your going to input the script we made with the following changes:
so, you can see the changes.Code:oon clicked theobject repeat 5 times tell application "System Events" tell application "world of warcraft" to activate key code 36 keystroke "spppaaammmm" key code 36 delay 30 end tell end repeat end clicked
1. Onclicked the object. means activated by button.
so we say,right before the rest of the script, doing this defines this script to the button that we will create in the interface and name it "enter"Code:if theobject is "enter" then
at the end of the script we then have to do end if to end the thepart of the script.Code:if theobject is "enter"
after you do all this, hit build and if it builds without any errors you can close this window.
NEXT STEP! CREATING INTERFACE!
again in your main Xcode project where you found Project1.applescript
you should see a file called Mainmenu.nib.
this is where you build your interface
so click this and it should bring up a couple windows including: "window, Mainmenu.nib control panel, another control panel for putting interface objects in, and a header option.
first, click the window with all the interface objects, click the cocoa-controls tab, and then click and drag one of the buttons that say "button" over to the main window.
after you do that, double click your new button in the main window, and rename it to "enter". ( no quotations of course)
after that, make sure ur still clicked on the button "enter"
and head up to the top applebar where you will find Tools. after you see that, go to "Show Inspector"
this is how your going to link your button with your applescript! click the arrow, its default should be on Attributes, and go down to Applescript.
name it enter and make sure to click : Action, clicked. and at the very bottom Under script click Project1.applescript.
save your Mainmenu.nib and exit.
after that head back to your main Xcode project. and click build at the top of the Xcode window. after it builds search for "project1.app" and open it.
or you can choose build and go, which will build and then run your app.
and after you do that! your done!
click the button on your app "enter" and it should display spaaamm in game.
again, this is just a tutorial on how to link applescripts with Xcode, not for a good spambot :P this program we have made is kind of pointless as a spambot, but it could be used if you wanted, you can always go into project1.applescript and change your scripts.
one last note: if you want to have one or more applescripts in your program with buttons, you will need to define every button as following:
lets say if you want a simple display dialog script. you would do the following:
and so on and so on use " else if" defining new buttons as you go along.Code:on clicked theobject if theobject is "display dialog 1" then display dialog "this is a test 1" else if theobject is "display dialog 2" then display dialog "this is a test 2" end if end clicked
if you have any questions please ask and hope this was some help on getting you started off
and forgive me for typo's etc. Kinda late here