The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Activate broken in 92632 Thread Tools Search this Thread Display Modes
I'm not a fan of shipping compiled scripts, but then if I'd quit breaking the suite, this wouldn't be a problem... :)

Just as a data point, is there a disadvantage to shipping scripts in source form? I guess the biggest problem that comes to mind is that the compiler would launch all the target applications to get their dictionaries, but as long as you don't compile until you need the script this isn't an issue.
__________________
CTO, The Omni Group
 
Tim,

I may be misunderstanding, but to be clear, I wasn't advocating for shipping compiled scripts and I don't do so myself. But it appears to me that Script Editor does, in fact, compile scripts when they are saved as "script" format, storing both the text and the compiled form. I'm taking "compiled" very liberally here; it may simply be tokenizing and mapping to class codes from the application dictionaries. I haven't read the AppleScript developer notes. The problem with activate appeared to be related to a broken mapping of some sort, but it went away for me before we could get any reliable log data.

All the scripts I share live in my ~/Library/Scripts folder, or its descendants. And they're all stored as "scripts" from Script Editor so that I can run them and edit them. The shared versions are just zipped up with their instructions. The first disadvantage of shipping scripts saved in "text" mode is that I have a bunch of extra work to do to share the scripts. Frankly, maintaining my RSS feed and web page are at, or just slightly beyond, what I can rationalize in terms of support for the scripts. The second disadvantage is that users have to use Script Editor to run the scripts.
__________________
Cheers,

Curt
 
Downloaded the newest build, this morning, I still have this issue. Is there any consistent workarounds? It's driving me crazy! I love OmniFocus, but I need my automation... (twitch, twitch)
 
Both of these work for me:

Code:
tell app "OmniFocus" to activate

tell app "OmniFocus"
    activate
end
Do both fail for you, or only the first one?
__________________
CTO, The Omni Group
 
Quote:
Originally Posted by Tim Wood View Post
Both of these work for me:

Code:
tell app "OmniFocus" to activate

tell app "OmniFocus"
    activate
end
Do both fail for you, or only the first one?
Both of the above scripts work for me from Script Editor, the script menu, and from Quicksilver. However, they do not work for me from Keyboard Maestro.

Thanks for looking into this.
 
You didn't ask for Keyboard Maestro output, but activate does not work from Keyboard Maestro as of OmniFocus 95014. Here is the debug output:
Code:
AE2000 (584): Received an event:
------oo start of event oo------
{ 1 } 'aevt':  misc/actv (i386){
          return id: 13238293 (0xca0015)
     transaction id: 0 (0x0)
  interaction level: 112 (0x70)
     reply required: 1 (0x1)
             remote: 0 (0x0)
      for recording: 0 (0x0)
         reply port: 40743 (0x9f27)
  target:
    { 1 } 'psn ':  8 bytes {
      { 0x0, 0x19019 } (Keyboard Maestro)
    }
  fEventSourcePSN: { 0x0,0x19019 } (Keyboard Maestro)
  optional attributes:
    { 1 } 'reco':  - 2 items {
      key 'subj' - 
        { -1 } 'null':  null descriptor
      key 'csig' - 
        { 1 } 'magn':  4 bytes {
          65536l (0x10000)
        }
    }

  event data:
    { 1 } 'aevt':  - 0 items {
    }
}

------oo  end of event  oo------
In comparison, here's the output when the script is invoked from the Script Menu:
Code:
AE2000 (584): Received an event:
------oo start of event oo------
{ 1 } 'aevt':  misc/actv (i386){
          return id: 38469634 (0x24b0002)
     transaction id: 0 (0x0)
  interaction level: 96 (0x60)
     reply required: 1 (0x1)
             remote: 0 (0x0)
      for recording: 0 (0x0)
         reply port: 40967 (0xa007)
  target:
    { 1 } 'psn ':  8 bytes {
      { 0x0, 0x4f04f } (AppleScript Runner)
    }
  fEventSourcePSN: { 0x0,0x4f04f } (AppleScript Runner)
  optional attributes:
    { 1 } 'reco':  - 2 items {
      key 'subj' - 
        { -1 } 'null':  null descriptor
      key 'csig' - 
        { 1 } 'magn':  4 bytes {
          65536l (0x10000)
        }
    }

  event data:
    { 1 } 'aevt':  - 1 items {
      key '----' - 
        { -1 } 'null':  null descriptor
    }
}

------oo  end of event  oo------
 
Hrm; Keyboard Maestro does seem to have a few differences. I'm not sure how they could arrange that unless they are building their own AppleEvents w/o using Apple's compiler.

They have the right codes though (misc/actv), but the Cocoa scripting support seems to want the 'null' they dropped out of the 'event data'. It might work if I stopped specifying a 'direct-parameter' in my sdef, but then 'activate quick entry' wouldn't work.

Could you try this to see if this is even the right track:

- Quit OmniFocus and Keyboard Maestro
- Use Finder's context menu to "Show Package Contents" on OmniFocus
- Navigate to Contents/Resources and open OmniFocus.sdef in your favorite text editor

Look for:

Code:
		<command name="activate" code="miscactv" description="Activates the application or window.">
			<direct-parameter type="specifier" description="the object(s) to activate."/>
		</command>
and replace it with:

Code:
		<command name="activate" code="miscactv" description="Activates the application or window."/>
Note the '/>' at the end of this line instead of just '>'.

Then relaunch and try your script.

Even if this does fix the problem in Keyboard Maestro, it will break scripting Quick Entry...
__________________
CTO, The Omni Group
 
Quote:
Originally Posted by Tim Wood View Post
Even if this does fix the problem in Keyboard Maestro, it will break scripting Quick Entry...
This does fix the problem, thanks. I will forward this thread to the KM developers- perhaps they can fix it on their end.
 
On my system, activate appears to be broken again in build 96394. It's only broken for OmniFocus and only for my account.

Executing the following in "Script Editor"
Code:
tell application "OmniFocus" to activate
or
Code:
tell application "OmniFocus"
	activate
end tell
generates the error "OmniFocus got an error: Some parameter is missing for activate."

If it helps, heres the AEDebug output:
Code:
~ b% AEDebugReceives=1 /Applications/OmniFocus.app/Contents/MacOS/OmniFocus
OCCCrashCatcher: Not enabling crash catching since we're connected to a tty (and thus presumably in gdb)
AE2000 (6463): Received an event:
------oo start of event oo------
{ 1 } 'aevt':  misc/actv (i386){
          return id: 407830626 (0x184f0062)
     transaction id: 0 (0x0)
  interaction level: 64 (0x40)
     reply required: 1 (0x1)
             remote: 0 (0x0)
      for recording: 0 (0x0)
         reply port: 36875 (0x900b)
  target:
    { 1 } 'psn ':  8 bytes {
      { 0x0, 0x125125 } (Script Editor)
    }
  fEventSourcePSN: { 0x0,0x125125 } (Script Editor)
  optional attributes:
    { 1 } 'reco':  - 2 items {
      key 'subj' - 
        { -1 } 'null':  null descriptor
      key 'csig' - 
        { 1 } 'magn':  4 bytes {
          65536l (0x10000)
        }
    }

  event data:
    { 1 } 'aevt':  - 0 items {
    }
}

------oo  end of event  oo------
AE2000 (6463): Received an event:
------oo start of event oo------
{ 1 } 'aevt':  aevt/rapp (i386){
          return id: 15139455 (0xe7027f)
     transaction id: 0 (0x0)
  interaction level: 112 (0x70)
     reply required: 0 (0x0)
             remote: 0 (0x0)
      for recording: 0 (0x0)
         reply port: 34567 (0x8707)
  target:
    { 1 } 'psn ':  8 bytes {
      { 0x0, 0x15015 } (LiteSwitch X)
    }
  fEventSourcePSN: { 0x0,0x15015 } (LiteSwitch X)
  optional attributes:
    < empty record >
  event data:
    { 1 } 'aevt':  - 0 items {
    }
}

------oo  end of event  oo------
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
activate Perspectives ptone OmniFocus Extras 3 2008-02-11 01:14 PM
Applescript - Activate Issue geoffbarrall OmniFocus Extras 2 2007-11-02 11:19 AM
Can't activate browser window / crash on launch neilio OmniWeb General 3 2006-08-17 07:55 PM
Window menu does not activate windows Ward OmniWeb Bug Reports 2 2006-05-13 06:26 PM
Clicking in-browser does not activate. danlurie OmniWeb Bug Reports 6 2006-04-14 11:08 AM


All times are GMT -8. The time now is 07:49 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.