Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync issue in create outgoing facetime? #5

Open
larsdennert opened this issue Mar 26, 2022 · 7 comments
Open

Sync issue in create outgoing facetime? #5

larsdennert opened this issue Mar 26, 2022 · 7 comments

Comments

@larsdennert
Copy link

tell application "System Events"
tell process "FaceTime"
--Click the "New FaceTime" button
set createButton to button 2 of window 1
click createButton
DO YOU NEED A DELAY OR CHECK FOR EXIST HERE?
SEEMS ANYTIME YOU WANT TO CREATE A WINDOW OBJECT YOU ARE NOT GUARANTEED OF THE TIMING IN A THREADED OS IS MY THOUGHT. THE SHEET MAY NOT YET EXIST WHEN YOU TRY TO GET IT.
--Get the sheet
set createSheet to sheet 1 of window 1

		--Focus the input field
		set inputField to text field 1 of createSheet
		set focused of inputField to true
@tagavari
Copy link
Member

tagavari commented Apr 2, 2022

Have you run into an issue where the input field is not available when the script tries to access it?

My understanding is that in most cases AppleScript calls will block until the UI interaction goes through, but this may not be the case.

@larsdennert
Copy link
Author

larsdennert commented Apr 2, 2022

That would be nice but you have delay statements all over. Leads me to believe you were dealing with those issues and seems to be the error messages people are getting where resources don't exist when your next call happens. Although the call to click a bottom blocks until the action is complete, it may not block for creation of the next window object that the click creates. Just my thoughts. I should qualify that i have not used apple script.

@larsdennert
Copy link
Author

Alpha 8 is more reliable. If you still get reports on this issue, try including the menu click at the top inside the repeat loop.
click menu item 1 of menu of linkButton

@larsdennert
Copy link
Author

I really think the following statement needs to be inside the repeat loop to copy the ft link:

click menu item 1 of menu of linkButton

Otherwise the repeat loop does nothing but repeatedly check for a clicked link that was missed and will never be clicked again. I'm getting this error on the timeout.

@tagavari
Copy link
Member

tagavari commented May 31, 2022

Thank you for helping to troubleshoot this! I understand where you're coming from with the delay statements, though I can't recreate this issue in this specific case.

I've created this script that opens the menu and immediately copies the link, then displays a dialog message that says whether the menu was present. Can you open it in Script Editor and run it on your machine and let me know if it works?

copylink.applescript

tell application "System Events"
	tell process "FaceTime"
		set linkButton to button 1 of window 1
		click linkButton
		if menu of linkButton is {} then
			display dialog "is empty"
		else
			click menu item 1 of menu of linkButton
			display dialog "is not empty"
		end if
	end tell
end tell

@larsdennert
Copy link
Author

Great idea. I'll mess with the script and see what I can do to get some fails for the whole sequence. That requires no functioning coding environment except Applescript. One of my Macs is dead slow so that will be perfect also as the lowest common denominator for people using old macs. If I get some code that looks robust I'll send it back for you to try.

@larsdennert
Copy link
Author

Well I think the issue is Facetime gets left in peculiar states, sometimes half way through the automation. Sometimes requests get stacked up and then they all flood in. It seems to be a MacOS/FT issue of some sort. Maybe closing FT after every call will help alleviate the problem. I ran the scripts and messed with variations of it, but they generally work as intended. When AM does it, sometimes a menu gets stuck. Eventually I could no longer receive FT calls on the phone and can only start them. Airmessage was not relaying the notification despite restarting all devices. I'll keep experimenting... I've never gotten FT to work from a browser.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants