• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: OT: Favourite features missing from Leopard [was: Applescript and Bluetooth]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OT: Favourite features missing from Leopard [was: Applescript and Bluetooth]


  • Subject: Re: OT: Favourite features missing from Leopard [was: Applescript and Bluetooth]
  • From: Peter Baxter <email@hidden>
  • Date: Sat, 10 Nov 2007 22:47:45 +1100

I didn't need to add much to Martin's script to get a viable log in script:

--UI Script to get bluetooth device names/types
--clear text file
try
set _TempFile to ((path to desktop) & "temp.txt") as text

try
close access file _TempFile -- Make sure the file wasn't accidentally left open
on error
tell application "TextEdit" to quit
delay 0.5
end try

open for access file _TempFile with write permission
set eof file _TempFile to 0 -- clear the file contents
close access file _TempFile
end try
--start process
repeat 2 times
set theTime to (do shell script "date +'%F %H-%M-%S'")
activate application "Bluetooth File Exchange"
tell application "System Events"
tell process "Bluetooth File Exchange"
delay 2
-- close default choose dialog
if exists window "Select File to Send" then
click button "Cancel" of window "Select File to Send"
end if
-- open Browse Device window
keystroke "o" using {command down, shift down}
-- wait for devices to be found
delay 10
set myFlag to false
repeat until myFlag is true
set foundText to value of static text 4 of window "Browse Files"
if foundText contains "Found" then
set myFlag to true
else
delay 2
end if
end repeat
-- grab device names
set n to count value of attribute "AXRows" of table 1 of scroll area 1 of window "Browse Files"
if n is 0 then
set theList to "No bluetooth devices found"
else
set theList to {}
set foo to table 1 of scroll area 1 of window "Browse Files"
repeat with x from 1 to n
set theName to value of text field 1 of row x of foo
set theType to value of text field 2 of row x of foo
if theType is "Mobile Phone" then
set end of theList to "Mobile Phones in range: " & theName & tab & " " & theType & return & theTime & return & return & return
end if
end repeat
end if
end tell
end tell
try
set _TempFile to ((path to desktop) & "temp.txt") as text

try
close access file _TempFile -- Make sure the file wasn't accidentally left open
on error
tell application "TextEdit" to quit
delay 0.5
end try

open for access file _TempFile with write permission
write theList to file _TempFile starting at eof
close access file _TempFile

end try
tell me to activate
display dialog theList giving up after 5
end repeat




"For every complex problem, there is a solution that is simple, neat and wrong." -H.L.Mencken


Peter Baxter email@hidden



_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: OT: Favourite features missing from Leopard [was: Applescript and Bluetooth]
      • From: Martin Orpen <email@hidden>
References: 
 >Applescript and Bluetooth (From: Peter Baxter <email@hidden>)
 >Re: Applescript and Bluetooth (From: Martin Orpen <email@hidden>)
 >OT: Favourite features missing from Leopard [was: Applescript and Bluetooth] (From: Martin Orpen <email@hidden>)
 >Re: OT: Favourite features missing from Leopard [was: Applescript and Bluetooth] (From: Peter Baxter <email@hidden>)
 >Re: OT: Favourite features missing from Leopard [was: Applescript and Bluetooth] (From: Martin Orpen <email@hidden>)
 >Re: OT: Favourite features missing from Leopard [was: Applescript and Bluetooth] (From: Peter Baxter <email@hidden>)

  • Prev by Date: Re: OT: Favourite features missing from Leopard [was: Applescript and Bluetooth]
  • Next by Date: Re: OT: Favourite features missing from Leopard [was: Applescript and Bluetooth]
  • Previous by thread: Re: OT: Favourite features missing from Leopard [was: Applescript and Bluetooth]
  • Next by thread: Re: OT: Favourite features missing from Leopard [was: Applescript and Bluetooth]
  • Index(es):
    • Date
    • Thread