Illustrator :: Execution Of Menu Command Without User Interaction?
Oct 22, 2013
It's a shame that Illustrator's scripting ability isn't as robust as InDesign's.
Â
I have a script that goes through every path in a file and records all of the colors used in it. The problem is that it stumbles when faced with certain types of "PluginItem"s. I've been able to fix some of it, such as when it comes across a "Compound Shape" (as opposed to a Compound Path or other normal Illustrator object). In such an instance I can select the path, then call a menu command to expand that selection:
Â
if (currentItem.typename == "PluginItem")
{
   currentItem.selected = true;
   app.executeMenuCommand("expandStyle");
   currentItem = app.selection[0];
   app.executeMenuCommand("deselectall");
   colorsInUse(currentItem);
}
Â
I had to do some scrounging to figure out how to execute that "Expand Appearance" command that is in the "Object" menu in Illustrator. In fact, the only resource I discovered was a list that is partially in Japanese. By the way, that last item in the list is a recursive call to the same function in which this if statement resides.
Â
So, the above code works for "PluginItems" that can be rectified with a call to the "Object -> Expand Appearance" menu item. What about those that don't, such as an enveloped object? With those, I'd normally just run the command above "Expand Appearance", called simply "Expand…" Well, that menu items pops up a dialog which, when the user clicks "OK" on it, will properly expand the enveloped object so that the script can continue reading the paths that made it up and get fill & stroke colors.
Â
I can call this menu item with a simple "app.executeMenuCommand("Expand3");", but my problem is that dialog which appears. I don't want the user to have to click "OK" on it every time it pops up when the script wants to expand that object, but the traditional "app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;" method doesn't work.
Â
Is there any way to expand enveloped items without having a dialog pop up on the user?
View 9 Replies
ADVERTISEMENT
Jan 26, 2013
I have an assembly file with parts assembled, and I want the user to move and position the assembled part into a position as they desire, and then run VBA to extract coordinates information to do further calculation.Â
So, what I want to do is creat a VBA code that does the following in sequence
1. VBA runs code to assemble the parts (I can do this)
2. go to the autodesk interface and allow user to manipulate the part
3. when user presses a key (e.g. "enter", "space"), the control returns to VBA
4. VBA run some code to extract the coordinates and do some calculations (I can do this too)
there is something like an input box that waits for the user to click ok, before continuing to run the rest of the coding. But I realise that the input boxes and message boxes do not allow users to work on the model in the background. Since I need users to move/rotate the part to the desired position, I can't simply use input and message boxes.Â
View 4 Replies
View Related
May 14, 2013
I have got this code by KEAN WALMSLEY.His code will ask user to select a block and then list all of selected block's attributes. However, I need to tweak his code a little bit and instead of user interaction, the block has to be selected by its name and through my code.
Here is his code (with slight changes to suit my purpose):
rivate Sub ListAttributes()Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor Dim db As Database = Host Application Services.WorkingDatabaseDim tr As Transaction = db.TransactionManager.StartTransaction() Try Dim filList As TypedValue() = New TypedValue(0) {New TypedValue(CInt(DxfCode.Start), "INSERT")}Dim filter As New SelectionFilter(filList)Dim opts As
[code]....
 Now, I need to change this Sub to a Function as below:
Private Function ListAttributes (blockName As String) As Boolean
The aim is to list all block attributes if the 'blockName' exists in drawing and return True afterwards. Oppositely it should return me False and print nothing to Editor if blockName does not exist.
View 5 Replies
View Related
Aug 3, 2013
How to use an embedded cursor (mycursor.cur) via the SetCursor command under user interaction events. I can use built in cursors just not able to get it working with my resource.
Sample below throws an error type mismatch.
oInteraction.SetCursor(CursorTypeEnum.kCursorTypeCustom, My.Resources.mycursor)
Â
I have set the build action of the cursor to be embedded.
View 3 Replies
View Related
Dec 19, 2012
I would like to be able to have the screen refresh periodically to show the new objects I have added as a command method proceeds to execute. I am hoping to be able to achieve a kind of simple animation by doing this, and also to show progress while a computationally intensive operation is under way. Is there a way that I can do this?Â
I have tried using AcadApp.DocumentManager.MdiActiveDocument..Editor.Regen() and also .Editor.UpdateScreen(), but it only seems to work once and not multiple times. Do I have to commit the transaction and then .
View 8 Replies
View Related
Mar 1, 2012
I am a newbie having trouble getting the sample batch programs to run. I placed simple-unsharp-mask.scm in C:.gimp-2.6scripts and put the .bat file in the E: drive directory with the image file foo.png. When I run the .bat file on my PC running Vista, I get "batch command experienced an execution error." Here is the .bat file:
"C:Program FilesGIMP-2.0ingimp-2.6.exe" -i -b "(simple-unsharp-mask "foo.png" 5.0 0.5 0)" -b "(gimp-quit 0)"
Obviously, I am doing something wrong, but don't have a clue what it is?
View 12 Replies
View Related
Jan 28, 2012
I am using editor.writeline to send information to the command line during the execution of a command. Unfortunately, it will only display the last message written when the command ends. Is there a way to display all the messages when the command ends? Below is the code that I am using.Â
Public Sub CreateVentilationLayers()
CreateTrimbleLayer(VENT375)
CreateTrimbleLayer(VENT500)
CreateTrimbleLayer(VENT625)
CreateTrimbleLayer(VENT750)
[Code]...
View 9 Replies
View Related
Jan 3, 2014
Product: AutoCAD 2014
OS: Windows 7 64bit
First I will state that everything within the program, to my knowledge, works just fine. Although..
I'm having a really strange issue when I try to type a command. It's an intermittent problem that occurs very often and can be extremely frustrating.
If I try to type a command, i.e.. M followed by enter to move an object, often times the command will repeat "MMMMMMMMMMMMMMMMM" and the command entry will fail. This happens for every button I press too. Letters, numbers, and even the Enter key will be repeatedly entered into the command prompt. Often times I've already pressed enter to execute the command. During this process the whole program seems to freeze, but not for too long. So I often have to enter the command multiple times, regardless of which button is repeating itself.Â
The repeating of a keystroke only lasts between 1-2 seconds but as I said has a very frequent occurrence.
I'm almost positive that this has nothing to do with my keyboard, as I've never experienced this kind of problem elsewhere. This is my machine at work and I've never encountered an issue as frustrating at this. Could it be something that my machine is doing?
View 5 Replies
View Related
Jun 21, 2012
I'm building a custom action and it would be great if I could record clicking the layer eyeball off.
Â
Is there a menu command equivalent for turning current layer visibility off?
View 1 Replies
View Related
Jun 5, 2012
This week I have been rebuilding some of my custom menus in CDX6, but I could not find the Separator to add to my menu/toolbar. It was not listed under the Commands>User Menus where it should be...well at least I thought it was not there. If I mouse over the list I can see the text pop up intermittently.
I also checked via the All (Show All Items) command list. The space is there but the text for it is wonky. I caught a couple of screen shots to show you what I mean...
View 14 Replies
View Related
Dec 31, 2013
I made the switch from acad 2006 to 2014. I was able to add quick leader to my dimension menu in customize user interface, but I don't have an icon in my dimensions toolbar. I figured it out, I needed to customize toolbars also, not just menus.
View 0 Replies
View Related
Feb 21, 2013
I have a macro that automatically creates a Detailed view on a sheet. It works on 2 input's:
- mouse click 1 (set's the target to be detailed)
- mouse click 2 (set's the location where the balloon should be)
The code works fine. But sometimes the user will start another command, or restart the same command, while it is still running. This off course gives all kinds of problems.
Is there a possibility in VBA to prevent the user to start another command while this command is running?Or is this problem a part of the clicking itself?
Here is my (it uses a Class Module called: clsGetPoint, see code below)
Sub AutoDetailedView() On Error GoTo ErrorManagment '(error handling 2013/02/18) 'step 0 Create a transaction. -> for 1 undo command Dim oTransMgr As TransactionManager Set oTransMgr = ThisApplication.TransactionManager Dim oTrans As Transaction Set oTrans = oTransMgr.StartTransaction(ThisApplication.ActiveDocument, "AutoDetailedView") 'step 1 Select a drawingView 'Set a reference to the drawing document. Dim oDrawDoc As DrawingDocument Set oDrawDoc = ThisApplication.ActiveDocument 'Set a reference to the active sheet.
[code].....
View 5 Replies
View Related
Nov 8, 2011
I'm putting together a simple lisp routine to issue bound, purged drawings.
I have code that will do the binding & purging but need handling the saving.
This is my approach :
(1) ask the user to save the drawing using this line (command "_saveas" "" "~")
(2)Â run a subroutine that binds xrefs etc (this works ok)
(3) run the QSAVE command
Trouble is, if the user cancels or hits escape during the SAVEAS command the subroutine & QSAVE will still run, overwriting the current drawing. How do I handle this scenario? Or should my appoach be different?
View 9 Replies
View Related
Aug 1, 2013
Main question: I need the user to be able to type a command. Then use it or cancel it. Then i need them to type another lisp command. In the second command i need to know (have the string of) the previous command they typed in. How do i get that string?
What I have tried.
I have looked at "LASTPROMPT" though not extensively, and i believe it would just return "ineedhelp" if i tried that.
I have looked at "CMDNAMES" but that gives the command you're currently in.Â
And I have found one page on this forum titled: Command Line History Macro, but there was no answer on that post.
I could create a global variable for that string, but then I would have to put the set code in every function I create. Nope, will not.
Backstory:
There's a person that is going to make how-to videos on how to use some of my lisp routines.
Anyhow, I need the user to be able to type in "ineedhelp" and the lisp that runs must get the last command's string go to the shared drive and pull up the video file for that command.
I have made a lisp that opened a word file before, and if i could get the string of the previous command, i'm fairly certain that I can get the videos to work.
There will be approximately 60 lisp routine video's.
View 9 Replies
View Related
Jan 23, 2013
How do I add custom menu items to the main menu in Illustrator?
I would like to build my own menu with scripts that I use alot. This is a powerful feature that I use alot in other programs, but I have not seen any examples of this in illustrator.
View 2 Replies
View Related
May 11, 2009
way to Rename menu bar commands? Move menu bar commands to other menus? Add new menu bar commands wherever you want and bind scripts to those commands?
View 39 Replies
View Related
Apr 9, 2013
is there any possibility to use inventor commands like "AppContextual_ContinueCmd" in addin? I need to add to RadialMarkingMenu commands for continue or cancel during selection.Â
private void UIEvents_OnRadialMarkingMenu(Inventor.ObjectsEnumerator toEntities, Inventor.SelectionDeviceEnum toSelDevice, Inventor.RadialMarkingMenu toRadialMenu, Inventor.NameValueMap toAddInfo) { if (toSelDevice == Inventor.SelectionDeviceEnum.kGraphicsWindowSelection) { toRadialMenu.EastControl = this.oApp.CommandManager.ControlDefinitions["AppContextual_CancelCmd"]; toRadialMenu.WestControl = this.oApp.CommandManager.ControlDefinitions["AppContextual_ContinueCmd"]; } }
 The menu is correctly shown , command " AppContextual_CancelCmd" send Esc to events,
How to catch "AppContextual_ContinueCmd". is this possible?
View 4 Replies
View Related
Jun 20, 2012
I am working on a plugin for adobe illustrator CS6 by using adobe CS6 SDK. By using this plugin I need to add a Me nu Item In File Menu of Adobe Illustrator.
I have used the following code for this:
______________________________________________________________________ ________
SPBasicSuite *mBasic = message->d.basic;
   AIMenuSuite *sAIMenu;
   mBasic->AcquireSuite(kAIMenuSuite,kAIMenuVersion, (const void**)&sAIMenu);
   SPPluginRef plugin;
[Code]...
Â
But i have nothing as output.
View 9 Replies
View Related
Feb 1, 2004
What method do you guys use for exporting Freehand(MX) files into Photoshop (CS)?
I've tried exporting as editable eps, psd(v. 4 I think it is) and simply to cut and paste, but everything comes out terrible when transformed from vector to pixel.
View 5 Replies
View Related
Sep 6, 2013
Is there a reason the variations command is not available in the image adjustment menu?
View 1 Replies
View Related
Jun 19, 2012
AutoCAD Map 2010 has just been installed in my PC and since i first runned AC the command line, menu browser and key commands don´t work. This way I can´t do anything.
View 4 Replies
View Related
Nov 7, 2012
get the view command back on the list of menu commands as i seem to have lost it.
View 3 Replies
View Related
Jul 18, 2012
How can I add custom command (macro) to a context menu in Inventor 2010 via VBA?
(I searched the forum and got it to the point when I'm able to add commands that are built in Inventor)
View 1 Replies
View Related
Sep 4, 2011
I recently watch a movie with a couple of dinosaur characters fighting each other, and now I wonder: dealing with a lot of potential geometry interpenetration scenarios?
How do you deal with characters physically interacting with each other, as in two characters fighting, or hugging? Do you know if there is any nice tutorial covering that subject? I do not mean about clothing. That's a matter of dynamics and simulation.
regarding characters interacting with objects. Imagine a human character lifting a huge heavy barrel. The arms around that barrel should look like pressing against it. Or a person stepping up an extension ladder.
View 1 Replies
View Related
Jun 19, 2011
I tried to first open a KDC file, which is a RAW file from my Kodak Camera, by clicking on File>Open but it didn't work. So then I attempted to open it using "Import". That was when I found out Import was grayed out. Why would that be? I just installed the program and this happens! Is there a setting I need to change?
View 5 Replies
View Related
Feb 3, 2013
I am trying to use the Arc-aligned text command from the Express tools menu. No matter what style, height, offset i enter i get a box that says "Invalid text!". I never use this command in my work but am trying to create a banner
View 1 Replies
View Related
Jul 4, 2013
i coded this simple utility that allows the user to edit some dbtext without using the mouse (after selection).
It works but sometimes, it seems randomly, i get a fatal error.
This is the code
public void Run(object param)
{
Document doc = Application.DocumentManager.MdiActiveDocument;
Editor ed = doc.Editor;
[Code]....
The run function it's called from a commandmethod with the CommandFlags.Session flag.
View 3 Replies
View Related
Oct 23, 2013
I have my own Palette Set.
On this Palette Set I have a palette withe a tree.
On the right click of the node, I call a command (it's one of our own ObjectARX commands, but the problem is the same with a build in command).
The command wants the user to select a point, with a few options. If I first select a point (left click) and then click right, everything works fine.
But If I click with the right button, before I select anything, the menu is not shown.
The code for calling the command is really easy:
Â
Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute("_ARC
",true,false,false);
 As said before... I don't call the _ARC command... but for the arc Command the right click menu is not shown also...What can I do, to get the normal behavior of the right click?
View 2 Replies
View Related
Jul 17, 2013
How to set a tool tip to show up next to and follow the mouse during user interaction. It's the same function that the CommandManager.Pick does?
If it's not a built in function then I guess it's created by a tool tip that gets moved around to follow the mouse on mouse move?
View 1 Replies
View Related
Oct 19, 2012
SO what is everyone say, trick about speeding up constrain execution. I have started working on this new project with 2013. And i'm finding myself losing alot of time. Basicly what i do is insert part from our database or content center and assemble them. So 80% of my activities on inventor are constraints. Right now i have this assemblies 175 / 156(small to me). And executing a constraint is minimum 4 seconds each time. If you consider that about 3 contraint is needed for each piece and final total part will probably be around 1000. i'm losing alot of time here
Yeah, i am not using preview. Why is inventor recalculating that much each time? Is it doing a rebuilt after each constraint?
What have you done that really increase the excution time of constraints?
Workstaion is
Windows 7 64bit
Intel Extreme i7cpu I975 @ 3,33
12bg ram
4 ssd in Raid stripping.Nvidia FX3800
Inventor 2013 SP1
View 9 Replies
View Related
Sep 14, 2012
I've been out of the programming game for a few years. Â But, using the sample code to place a part or assembly in an assembly by placing it with the mouse should be possible in VBA.
View 1 Replies
View Related