Jump to content

Applescript not working corretly


Recommended Posts

Hey folks,

 

I'm wondering if anyone can help me with this, I have pretty simple script to un-minimize all windows of formost application. 

tell application (path to frontmost application as text)
	try
		set miniaturized of every window to false
	on error errorMessage
		display alert errorMessage
		try
			set collapsed of every window to false
		on error errorMessage
			display alert errorMessage
			reopen
		end try
	end try
end tell

I bind this script to Hotkey (I tried both "Run script" /usr/bin/osascript and "Run NSAppleScript"), but It's not working as in AppleScript Editor.

 

 

For example for Finder with Alfred workflow, I'm getting error message "Finder got an error: Can’t set |collapsed| of every window to false." That is not happening when I'm testing this script in AppleScript Editor..

 

 

 

OSX 10.9

Alfred 2.1

 

 

Link to post

Hey folks,

 

I'm wondering if anyone can help me with this, I have pretty simple script to un-minimize all windows of formost application. 

tell application (path to frontmost application as text)
	try
		set miniaturized of every window to false
	on error errorMessage
		display alert errorMessage
		try
			set collapsed of every window to false
		on error errorMessage
			display alert errorMessage
			reopen
		end try
	end try
end tell

I bind this script to Hotkey (I tried both "Run script" /usr/bin/osascript and "Run NSAppleScript"), but It's not working as in AppleScript Editor.

 

 

For example for Finder with Alfred workflow, I'm getting error message "Finder got an error: Can’t set |collapsed| of every window to false." That is not happening when I'm testing this script in AppleScript Editor..

 

 

 

OSX 10.9

Alfred 2.1

 

Just so you don't think this is going unanswered, I'm trying to track down the issue on this. I tried a slightly modified approach to this and am getting the same issue. It seems that I can grab the path to the frontmost app as you did, I can grab every window and show a count to confirm that it finds all windows associated with that app, but when it gets to the part of telling it to set the miniaturized or collapsed property, it doesn't seem to work.

 

I looked at it for a little bit yesterday and don't remember console errors but I'll double check today and see if I can get a little further. I may check with Andrew on this as well.

Link to post
  • 7 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...