Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

nick-vorie

macrumors newbie
Original poster
May 18, 2011
1
0
Ok,
As an internet marketer I am always looking was to increase profit for minimal effort, thats where my (somewhat) decent programing skills come in. I'm creating an application to AUTOMATICALLY post a random (preset) post to a random (preset) wall with a different FB account each time promoting my site. I have the login system working and the posting system down for the most part but this is how its set up:

Desktop file (AutoPoster)(has the codes,automator workflows,the predefined post texts ect)

In the main file (AutoPoster (again)) It has the source code for easy editing and the application to run the process.
this is the source code:

Code:
repeat 10
random number from 1 to 3
set a to result
if a = 1 then
	tell application "LOGIN_MACRO_1"
		activate
	end tell
else if a = 2 then
	tell application "LOGIN_MACRO_2"
		activate
	end tell
else if a = 3 then
	tell application "LOGIN_MACRO_3"
		activate
		delay 30
	end tell
 end repeat
end if


When it chooses a random "Macro" it will open that file (Heres one for example):

Code:
tell application "FB_LOGOUT"
	activate
	delay 28
end tell
tell application "JOE_M_FB"
	activate
	delay 33
end tell
random number from 1 to 3
set b to result
if b = 1 then
	tell application "FB_POST_1"
		activate
	end tell
else if b = 2 then
	tell application "FB_POST_2"
		activate
	end tell
else if b = 3 then
	tell application "FB_POST_3"
		activate
	end tell
end if


That will log in to the account and choose one of the posts...

All works out...Until the near end of the script,I get this error:
LOGIN_MACRO_1 got an error: Connection is invalid. (will say that for all of the "macros")
BUT only if I run the WHOLE application, if I run the Macro ITS SELF it is fine no errors. :confused: :confused: :confused:

At 14 I am VERY puzzled...thing is, I've been using apple script for 1 or 2 years and NEVER have I encountered this error.

//NIck
 
Last edited by a moderator:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.