Recent menu does not work.

Here's where to discuss using Stéphane Leys' very well done alternative runtime editor. If you're a control freak at runtime you have to check this out!

Recent menu does not work.

Postby drpitcairn » Fri Nov 18, 2011 9:42 am

This is not new, but I am just getting around to report it again. I have gotten used to opening from the Finder instead.
If I open a project from within SC, using the MPI menu "open" and the project then opens and is later closed — it is indeed listed in the Recents menu but clicking on it gives me this error message. Is there an easy fix?

open recent boger.png
error window
open recent boger.png (35 KiB) Viewed 7038 times
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Recent menu does not work.

Postby S. Leys » Fri Nov 18, 2011 11:53 am

drpitcairn wrote:If I open a project from within SC, using the MPI menu "open" and the project then opens and is later closed — it is indeed listed in the Recents menu but clicking on it gives me this error message. Is there an easy fix?


I've no idea why the Finder can't find the original from the alias.
We need a clue :
- Does this happen for all projects listed in the recents menu or only for some of them ?
- What is the path name of the original which fails ?
- Try opening the "MPI recents" folder in the SC Pouch, right-click the aliases in this folder and see if the Finder can find the original.
- Try creating a new project with a short and simple path (no unusual chars in the folder names) and see if the recents menu succeeds to open it.

S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: Recent menu does not work.

Postby drpitcairn » Fri Nov 18, 2011 7:46 pm

I checked some of the other recents and they open.
The path is: Bogers GA.sc45/Bogers GA/Projects/Documents/my user name/Users/Macbook Pro
In the SC Pouch I was able to right click and open the file.
I made a new project and closed it and was able to bring it back, open, again by using the Recents menu.
On trying to use Recents menu to open the project I am having trouble with, I got the same error message as I posted before.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Recent menu does not work.

Postby S. Leys » Fri Nov 18, 2011 11:42 pm

drpitcairn wrote:The path is: Bogers GA.sc45/Bogers GA/Projects/Documents/my user name/Users/Macbook Pro

I was asking for the long name of the project, exactly as SC is seeing it. I expected to find a clue in it, some unexpected char or something like that.
I checked some of the other recents and they open.
In the SC Pouch I was able to right click and open the file.
I made a new project and closed it and was able to bring it back, open, again by using the Recents menu.
On trying to use Recents menu to open the project I am having trouble with, I got the same error message as I posted before.

So, it works for other projects, you're having trouble with only one project. You need to find what is specific to this project, the place where it is stored ...

Actually, this alias stuff is not done by MPI, not even by SC itself, it is done by an AS callback
Code: Select all
function GetOrig aliasName
    get script(do, AppleScript, merge("tell application `Finder` to return the original item of file `[[aliasName]]` as string "))
    get value(it)
    if exists(file,it) then return it
    Alert caution "The Finder couldn't find the original file. The Alias will be deleted from the recents folder." &cr & it
    delete file aliasName
    rebuildrecentsList
    return ""
end GetOrig

The error message you get clearly shows that AS couldn't resolve the alias. You need to find why.
Try making a copy of the project, move it to another place and see if it works.
Try making a new project in the same place ...

S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: Recent menu does not work.

Postby drpitcairn » Sat Nov 19, 2011 7:47 am

I don't know how to get the path from within SC.
The other projects that I tested (prior post) were all in the same folder.
I made a copy of the project last night and it seems to be working now. Might have to do with the closing of it. I have been having trouble with a window being left open and to close twice. Bet that has to do with it.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Recent menu does not work.

Postby S. Leys » Sat Nov 19, 2011 8:11 am

drpitcairn wrote:I don't know how to get the path from within SC.

long name of proj "myProj" -- myProj = short name of the project
The other projects that I tested (prior post) were all in the same folder.
I made a copy of the project last night and it seems to be working now. Might have to do with the closing of it. I have been having trouble with a window being left open and to close twice. Bet that has to do with it.

So, it seems that the problem was in your script rather than in MPI, SC or AS.
Are you sure that you don't still have a problem we already talked about :
Code: Select all
on closeproject
  open cd ... of wd ...


S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: Recent menu does not work.

Postby drpitcairn » Sat Nov 19, 2011 9:10 am

Right now I am thinking the problem was that the project not closing properly. Could that be a factor? I had a CloseProject script that opened a window and did some cleaning up but it would often leave the window open and I had to close it a second time. Maybe somehow that screwed things up. I just now put an anchor window in to see if that would solve this problem and it might have. Need more time to be sure. Will test and let you know.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Recent menu does not work.

Postby S. Leys » Sat Nov 19, 2011 12:33 pm

drpitcairn wrote:Right now I am thinking the problem was that the project not closing properly. Could that be a factor?

Apparently, it is.
I had a CloseProject script that opened a window and did some cleaning up but it would often leave the window open and I had to close it a second time. Maybe somehow that screwed things up.

We already talked about that. If you open a cd or wd on closeproject, SC thinks that you changed your mind and the closing process aborts.
I just now put an anchor window in to see if that would solve this problem and it might have.

An anchor window won't solve the problem.

Why don't you simply do this cleaning on openproject ?

S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: Recent menu does not work.

Postby Dave_Higgins » Sat Nov 19, 2011 1:11 pm

S. Leys wrote:Why don't you simply do this cleaning on openproject ?

If there's not a LOT of cleanup to do, and depending on how complicated it is, you also have the option of cleaning up without opening the window... You can use a long descriptor and do something like:

Code: Select all
put "" into fld "someField" of cd 1 of window "windowToClean"
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Recent menu does not work.

Postby S. Leys » Sat Nov 19, 2011 1:27 pm

Dave_Higgins wrote:you also have the option of cleaning up without opening the window

or opening it inv.
S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: Recent menu does not work.

Postby drpitcairn » Sat Nov 19, 2011 1:29 pm

Stephane,
I have the script at close as this software is used for working up a patient's case and at close the user given the option of either saving it as it is, for later work, or emptying out all the information for a fresh start next time. I don't see any other way to give that option but at closing. Well, I could just give it and let them refresh it once it is open but I was hoping to have it work this other way.

Dave,
How do I trigger that cleanup if not with a closeproject?
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Recent menu does not work.

Postby drpitcairn » Sat Nov 19, 2011 1:34 pm

S,
When I did not include the line "open wd casework" then I would get an error message that the window could not be found. The only solution seemed to be to open the window again.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Recent menu does not work.

Postby S. Leys » Sat Nov 19, 2011 1:36 pm

drpitcairn wrote:I have the script at close as this software is used for working up a patient's case and at close the user given the option of either saving it as it is, for later work, or emptying out all the information for a fresh start next time. I don't see any other way to give that option but at closing. Well, I could just give it and let them refresh it once it is open but I was hoping to have it work this other way.

set a "cleanOnOpen" userprop of the proj to true or false on closeproject and read it back on openproject.

S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: Recent menu does not work.

Postby S. Leys » Sat Nov 19, 2011 1:44 pm

drpitcairn wrote:When I did not include the line "open wd casework" then I would get an error message that the window could not be found. The only solution seemed to be to open the window again.

Code: Select all
on openproject
  if the cleanOnOpen of this proj then
     open inv wd casework
    -- do the cleaning
     close wd casework -- or keep it open and show it later if necessary
  end if
end openproject

on closeproject
  set  the cleanOnOpen of this proj to true/false
   
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: Recent menu does not work.

Postby drpitcairn » Sat Nov 19, 2011 1:45 pm

Great idea. I will put that in.
Thanks.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Recent menu does not work.

Postby Dave_Higgins » Sat Nov 19, 2011 3:22 pm

drpitcairn wrote:Dave,
How do I trigger that cleanup if not with a closeproject?

If you were to go this way (although Stéphane's way of doing it might be better/easier), you would do that within a closeProject handler:

Code: Select all
on closeProject
  put "" into fld "someField" of cd 1 of window "windowToClean"
  put "" into fld "anotherField" of cd 1 of window "windowToClean"
  -- just examples... Do what you need
  pass closeProject -- make sure you actually close after you clean up
end closeProject

S. Leys wrote:or opening it inv.

Wouldn't that still cause the abort? You're still going to send openWindow/etc... messages even when opened invisible.

Another thought... Would locking the messages prevent the abort?
My two favorite teams are Detroit and whoever's playing Chicago.
User avatar
Dave_Higgins
 
Posts: 454
Joined: Mon Jul 07, 2008 9:50 am
Location: Dark Side Of The Moon

Re: Recent menu does not work.

Postby drpitcairn » Sat Nov 19, 2011 3:34 pm

I tried locking messages but that had no effect. I am thinking that the opening of a window in the script is what interferes — as Stephane has said.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona

Re: Recent menu does not work.

Postby S. Leys » Sat Nov 19, 2011 11:56 pm

Dave_Higgins wrote:
S. Leys wrote:or opening it inv.

Wouldn't that still cause the abort? You're still going to send openWindow/etc... messages even when opened invisible.

Yes, it would. I was assuming that it would be done on openproject. I followed my idea and missed that you were suggesting another way of doing it on closeproject.

Another way would be to store the data in userproperties and update the fields on openwindow. Then, it would be easy to clear or not the userprop on closeproject without having to open the window.
This technique would even allow saving several cases in different userprop, list them in a palette, switch from one case to another one, save some of them and not others ...

S.
User avatar
S. Leys
 
Posts: 628
Joined: Sun Jul 06, 2008 11:03 am

Re: Recent menu does not work.

Postby drpitcairn » Sun Nov 20, 2011 7:19 am

I thought of userprops but there are too many locations where data stored. It could be done but this recent suggestion you made has worked best I can tell. I created the userprop that was set on close and triggered on open. Tried it 3-4 times and no problems. Don't know why I didn't think of that. I was stuck on having to do it on closing so I appreciate you insight. Sometimes we get stuck in an idea and can't see other possibilities. I might add that having the anchor window off screen allows me to open the wd as invisible, do the cleanup and then show it.
Many thanks.
User avatar
drpitcairn
 
Posts: 1023
Joined: Thu Apr 02, 2009 9:39 am
Location: Sedona, Arizona


Return to Using MPI

Who is online

Users browsing this forum: No registered users and 1 guest

cron