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

eldany

macrumors newbie
Original poster
Nov 30, 2011
4
0
Hello everybody! This is my first post here. (and i want your help! :)

I want to use my ipad2 as main monitor and without a router because
id like to take my mac mini, be everywhere and don't care if there's
some hotspot for connectivity....

The best app i tried was AIR DISPLAY...its great! very good refresh via
wifi, mouse pointer update (i couldn't find a VNC for ipad that updates the
pointer at least you move it in the ipad with your finger) and the ipad can
be used as secondary monitor or clone of the main monitor. That's exactly
what i was looking for.

My problem is creating a AD HOC access...there's no way to save it in a
profile or something...once you disconnect it dissapears and you have to
create it mannually again...that's useless for me because i want to have
the access point when i turn my computer on and without a real monitor.

I was googling a lot and found many many scripts that are supposed to do
just that: create a AD HOC automatically....the problem is that none of
them is working in my computer...i guess something was changed in
LION 10.7...no luck...tried to understand and tweak those scripts without luck.

Any help? :)

Thanks in advance!!!

EL |) /\ /\/ )/
 

johnhurley

macrumors 6502a
Aug 29, 2011
777
56
I was googling a lot and found many many scripts that are supposed to do
just that: create a AD HOC automatically....the problem is that none of
them is working in my computer...i guess something was changed in
LION 10.7...no luck...tried to understand and tweak those scripts without luck.

How about pointing us to an example of a script that you think should be relevant?
 

eldany

macrumors newbie
Original poster
Nov 30, 2011
4
0
Sure

http://www.svenbit.com/2011/02/create-a-new-wireless-network-ad-hoc-on-mac-os-using-an-applescript/

----------

APPLE SCRIPT ERROR

System Events got an error: Can't get menu item
"Create Network..." of menu 1 bar item 7 of
menu bar 1 of process "SytemUIServer".

When i run the script it opens the menu where is the day and time (the
one beside the search icon, upper right side of the window) instead the
Wifi icon/menu.

I tried with both scripts of that page an many others...same problem.
 

Partron22

macrumors 68030
Apr 13, 2011
2,655
808
Yes
"SytemUIServer" is spelled with two esses
"SystemUIServer"

See if that helps.

I get:
Code:
get every UI element of menu bar 1 of process "SystemUIServer"
		-->  {menu bar item 1 of menu bar 1 of application process "SystemUIServer"
 menu bar item 2 of menu bar 1 of application process "SystemUIServer"
 menu bar item 3 of menu bar 1 of application process "SystemUIServer"
 menu bar item 4 of menu bar 1 of application process "SystemUIServer"
 menu bar item 5 of menu bar 1 of application process "SystemUIServer"
 menu bar item 6 of menu bar 1 of application process "SystemUIServer"}
 

eldany

macrumors newbie
Original poster
Nov 30, 2011
4
0
i mistaken the error code...it is correct (SystemUIServer)

I don't know what is that code you posted...i don't know
applescript :(

"SytemUIServer" is spelled with two esses
"SystemUIServer"

See if that helps.

I get:
Code:
get every UI element of menu bar 1 of process "SystemUIServer"
		-->  {menu bar item 1 of menu bar 1 of application process "SystemUIServer"
 menu bar item 2 of menu bar 1 of application process "SystemUIServer"
 menu bar item 3 of menu bar 1 of application process "SystemUIServer"
 menu bar item 4 of menu bar 1 of application process "SystemUIServer"
 menu bar item 5 of menu bar 1 of application process "SystemUIServer"
 menu bar item 6 of menu bar 1 of application process "SystemUIServer"}
 

Partron22

macrumors 68030
Apr 13, 2011
2,655
808
Yes
That code just shows that I do get a collection of menubar items back from "SystemUIServer".

It looks to me lijke the code should work if you have a "Airport Menu Extra" menu bar item in your menu bar. However, user interface scripting like that shown is notorious for needing tweaks whenever Apple updates its OS.
Here's a bit of code that might help you understand what that script's doing:
Code:
tell application "System Events"
	tell process "SystemUIServer"
		tell menu bar 1
			set menu_extras to value of attribute "AXDescription" of menu bar items
			-- this just gets the names of all the menu bar items
			-- the loop just checks to see if the one we want is there, and saves its index
			
			-- the AXpress stuff just clicks an (indexed) menu bar item.
			tell menu bar item 3 -- Change this number and watch what happens on your display
				perform action "AXPress"
			end tell
		end tell
	end tell
end tell
return menu_extras -- (open the results pane to see these values)
However, if you want to set up an autoconnect to your iPad as a monitor yourself, you're going to have to learn Applescript programming yourself. It's not all that hard, and it does give you unique access to a lot of functionality from many Mac applications.
 

eldany

macrumors newbie
Original poster
Nov 30, 2011
4
0
HEY! that was a great hint! i am almost there now...
The main problem was that the item i was looking for wasn't
"Airport Menu Extra" it was "Wi-Fi, No Signal."

Now the script works but without security...can't make the password stuff
to work...may you give me the last hint? :)

there we go:

property CreateMenuName : "Create Network…"
property NetworkName : "HOTSPOT MACMINI"
property NetworkPassword : "paswd"

tell application "System Events"
tell process "SystemUIServer"
tell menu bar 1
set menu_extras to value of attribute "AXDescription" of menu bar items
repeat with the_menu from 1 to the count of menu_extras
if item the_menu of menu_extras is "Wi-Fi, No Signal." then exit repeat
end repeat
tell menu bar item the_menu
perform action "AXPress"
delay 0.2
perform action "AXPress" of menu item CreateMenuName of menu 1
end tell
end tell
repeat until exists window 1
delay 0.5
end repeat
tell window 1
click pop up button 2

-- the last line clicks the popup security:
-- items are: None and separated by a line: 40-bit wep and 128-bit wep
-- My problem here is that the next line is not selecting 40-bit as i want :(

click menu item 1 of menu 1 of pop up button 2

--set value of text field 1 to NetworkName -- not working yet…need 40-bit...
--set value of text field 2 to NetworkPassword -- same as above
--set value of text field 3 to NetworkPassword -- same as above

click button 1 -- It creates the AD HOC! but not password yet :(
end tell
end tell
end tell

That code just shows that I do get a collection of menubar items back from "SystemUIServer".

It looks to me lijke the code should work if you have a "Airport Menu Extra" menu bar item in your menu bar. However, user interface scripting like that shown is notorious for needing tweaks whenever Apple updates its OS.
Here's a bit of code that might help you understand what that script's doing:
Code:
tell application "System Events"
	tell process "SystemUIServer"
		tell menu bar 1
			set menu_extras to value of attribute "AXDescription" of menu bar items
			-- this just gets the names of all the menu bar items
			-- the loop just checks to see if the one we want is there, and saves its index
			
			-- the AXpress stuff just clicks an (indexed) menu bar item.
			tell menu bar item 3 -- Change this number and watch what happens on your display
				perform action "AXPress"
			end tell
		end tell
	end tell
end tell
return menu_extras -- (open the results pane to see these values)
However, if you want to set up an autoconnect to your iPad as a monitor yourself, you're going to have to learn Applescript programming yourself. It's not all that hard, and it does give you unique access to a lot of functionality from many Mac applications.
 

Partron22

macrumors 68030
Apr 13, 2011
2,655
808
Yes
My problem here is that the next line is not selecting 40-bit as i want
click menu item 1 of menu 1 of pop up button 2
Do you have a copy of Xcode?
If so, the Accessibility Inspector.app (in /Developer/Applications/Utilities/Accessibility Tools/) can help you sort out which UI element you need to address.
If you don't have Xcode, you can probably still fins a copy of the tool thru Google, There's also an earlier version of the App that might work for you. It's called UIElementInspector, and can be found online.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.