Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How can I open "Place..." dialog from my plugin?

New Here ,
Dec 23, 2009 Dec 23, 2009

Hello All,

There is a "Place..." item in  "File -> ...". If we can click on "Place...",  "Place" dialog will open and asks for .ai file to place the whatever the art is there in that file in the current document. Right.

Now what I want is, if I click on one of the button in my plugin UI, "Place" dialog will open and art will be drawn in the current document.

I looked into the API documentation and found AIPlacedSuite::ExecPlaceRequest( ) function, but no use.

How can I open "Place" dialog from my plugin?

TOPICS
SDK
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Contributor , Dec 25, 2009 Dec 25, 2009

You can use "execve". This example will copy /tmp/file1 to /tmp/file2

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

pid_t forkPid;
char *childargs[] = { "cp", "/tmp/file1", "/tmp/file2", 0 };

if( ( forkPid = fork() ) == 0 ) {
  execve( "/bin/cp", childargs, NULL );
} else if( forkPid > 0 ) {
  printf( "Success!" );
} else {
  printf( "Can't fork" );
}

For more information, man execve.

Translate
Adobe
Contributor ,
Dec 23, 2009 Dec 23, 2009

The SDK does not provide any calls to open the Place dialog directly.

You have a few potential solutiuons, however.

A. Implement your own file dialog box, and use the Place suite. Which I think is perhaps the most elegant solution.

B. Programitcally create an action that opens the Place dialog. You can record an action that does this to see what file would have to be written (see "Insert Menu Item..." then type "Place", enter while recording). Then you could call the action with the Action suite.

C. The dialog could be opened using the scripting capabilites (for instance AppleScript). Your program could then write/call the AppleScript. I know it can be done with AppleScript, and I suspect other scripting languages such as Java might be able to do it.

Hope this helps.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 23, 2009 Dec 23, 2009

I think, there is no API which executes the script from a plugin in AI CS4. Right?

Then how can we open "Place..." dialog with the scripting capabilities?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Dec 23, 2009 Dec 23, 2009

Oddly enough this is related to something I just filed to Adobe as a bug in the SDK. Not only can you not trigger the menuitem 'Placed...', you can't detect when its invoked. Its just plain missing from AIMenuCommands.h

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 23, 2009 Dec 23, 2009

You can execute a script by, well, executing it.

On Mac OS X you can use 'fork' and 'exec' or 'execv' (or another variant) - they are defined in <unistd.h>. I have that working in an Illustrator plugin, so let me know if you are on Mac OS X and I can provide you with sample code.

On Windows, I am sure it is possible, but I do not know what you would call.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 25, 2009 Dec 25, 2009

yes, could you please provide me the sample code?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 25, 2009 Dec 25, 2009
LATEST

You can use "execve". This example will copy /tmp/file1 to /tmp/file2

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

pid_t forkPid;
char *childargs[] = { "cp", "/tmp/file1", "/tmp/file2", 0 };

if( ( forkPid = fork() ) == 0 ) {
  execve( "/bin/cp", childargs, NULL );
} else if( forkPid > 0 ) {
  printf( "Success!" );
} else {
  printf( "Can't fork" );
}

For more information, man execve.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines