Adobe Illustrator scripting [closed] - vbscript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to create a scrips which will add different patterns saved as swatches, to a set of grouped items, which are part of a Layer. Unfortunately I can't find the right methods when looking through the Illustrator scripting guide. The grouped items have got a color property, which allows me to modify the base color, but I can't find any property which will allow changing the patterns.
Could anyone please assist?
Thank you,
Razvan Sodoleanu

The problem is that there's not a way to add a pattern from artwork using a script command - except there's a way with javascript to do an appExecuteMenuCommand to define the pattern. Well, we can run this little javascript from VBS without any problem, but the Pattern dialog comes up and we don't want that. So, simply send an Escape key to get out of the dialog, and your new pattern should be the latest swatch in the swatches collection!
Set AiApp = CreateObject("Illustrator.Application")
AppName = AiApp.Name
' MsgBox(AppName)
Set Doc = AiApp.ActiveDocument
Set MyGroup = Doc.GroupItems(1)
Doc.Selection = MyGroup
AiApp.DoJavaScript("app.executeMenuCommand('Adobe Make Pattern')")
Set WScriptShell = CreateObject("WScript.Shell")
WScriptShell.SendKeys("{Escape}")
EDIT:
I read your question again and in fact I answered a different problem with the above. Your real answer is the following snippet. You can't apply patterns to groups, but you can apply them only to PathItems. If your PathItems are in a group, you can reach into the GroupItem to get its PathItems property. This example shows referencing a path on the document-level, which takes into account every single path in the document, nested or not. In my document I just have one rectangle to demonstrate the VBS code.
Set AiApp = CreateObject("Illustrator.Application")
Set Doc = AiApp.ActiveDocument
Set MyPatternSwatch = Doc.Swatches.GetByName("Alyssa")
Set MyRect = Doc.PathItems(1)
MyRect.FillColor = MyPatternSwatch.Color

Related

Change record color based on property value [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I have a oracle form that has two blocks . I would like to have the cell change color base on it's value null or not . How can this be done?
There are two built-ins you can use: SET_ITEM_PROPERTY and SET_ITEM_INSTANCE_PROPERTY (have a look at Forms Online Help System for more info).
if you use the first one, it'll change all items in a tabular block (i.e. the whole column)
it means that - if it really is a tabular form ("two blocks" sound like "master-detail" where detail usually has tabular layout - you should use the second one, SET_ITEM_INSTANCE_PROPERTY which will change only one instance of that item
For example, you'd do this:
if :system.cursor_item is null then
set_item_instance_property(:system.cursor_item, current_record, visual_attribute, 'RED');
end if;

Storing the object of Select_list [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
Please consider the below code
a=b.select_lists[0]
a.select("Agent")
In the aforementioned code, the first line is taking so much time, So Can anyone tell me Is there any way to store value of "a" object for further use without getting from b.select_lists[0]? Or Is there anyway can we directly get the value of 'a'?
The code which I am trying to write for the select list follows below
<select class="ng-valid ng-dirty" style="" ng-change="selectionsAgentType(AgentType)" ng-model="AgentType"> <select class="ng-valid ng-dirty" ng-change="AgentCategorySelected(agentoptions)" ng-model="agentoptions">
If option with text: 'Agent' is unique on this page.
If you need just simulate select
b.option(:text, 'Agent').select
Also, if you need value of this option
a = b.option(:text, 'Agent').value
Else,
b.select_lists.first.option(:text, 'Agent').select
a = b.select_lists.first.option(:text, 'Agent').value

How to perform arithmetic on automator variables [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'd like to be able to divide the value of a variable in Automator by 2, before being passed to the next step. I imagine it can be done with 'run applescript' but can't figure out how.
Sure. If you have a variable with a number in it, you can:
Get Value of Variable
Run AppleScript
with the AppleScript something like:
on run {input, parameters}
set halfInput to input / 2
return halfInput
end run
I’ve attached a screenshot of this, so you can see how it works.
Note that depending on where the variable is set, it might be a list, in which case you’ll need to get the appropriate item from the list. For example, passing the result of a shell script to a variable will mean that the value is in a list, and the AppleScript will need to get the “first item of input” in order to treat that value as a number. Here’s an example:

Combo Box Boolean in Visual Basic [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I'm on visual studio and I have trouble doing some boolean on Visual Basic for a Combo Box Boolean. I am using Visual Studio btw. I tried to add the following:
if ClientBox.ValueMember() = "Agentleader1 (Leader)" Then
But it wouldn't work.
My program is a basic Contact-Us form for a person to fill out. A field (the combo-box field, called: clientbox) is a combo-box to where you can select which member of the whole group you want to send the contact-form to. Which is a problem. I'm very sorry I can't give a sample of the code. And btw, I just started C++ please don't give complex answers and maybe add a few annotations so I can understand. Please comment this question if I have not explained enough about my program! BTW, please no C# answers.
I found a solution to my problem, if anybody is wondering here it is, sorry for my amateur-ness! This actually kinda is a better answer than anything I could have come up with (except the fact that I found this answer by myself:
if ComboBox.SelectedItem().Equals("any choice of one of the items") = True Then
'execute command!
The above was the syntax, I got an example of my code below:
if ClientBox.SelectedItem().Equals("Agentleader1 (Leader)") = True Then
TEA = "****" 'That's my email!
Hope this helped to anybody that couldn't figure out how to find whether a specified item that is selected in a certain combo-box is selected!
is that exactly how it is written in your code? the single '=' is an assignment operator... you need '=='

Auto-Completion [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
How does Google or amazon implement the auto-suggestion at their search box. I am looking for the algorithm with technology stack.
PS: I have searched over the net and found this and this and many many more. But I am more interested in not what they do but how they do it. NoSQL database to store the phases? or is it sorted or hashed according to keyword's? So to rephrase the question: Given the list of different searches ignoring personalization, geographic-location etc, How do they store, manage and suggest it so well.
This comes under the domain of stastical language processing problems. Take a look at spelling suggestion article by Norvig. Auto - completion will use a similar mechanism.
The idea is that from past searches, you know the probability of phrases (or better called bigram, trigram, ngram). For each such phrase, the auto complete selects the one having max value of
P(phrase|word_typed) = P(word_typed|phrase) P(phrase) / P(word_typed)
P(phrase|word_typed) = Probability that phrase is right phrase if word typed
so far is word_typed
Norvig's article is a very accessible and great explanation of this concept.
Google takes your input and gives TOP4 RESULTS ACCORDING TO THE RANK IDs [if results are less it returns parameters as empty strings] given to different keywords which differ dynamically by the hit and miss count.
Then, they make a search query and returns 4 fields with url, title, and 2 more fields in Json, omnibox then populates the data using prepopulate functions in Chrome trunk.

Resources