Run Illustrator extension through a script - scripting

I have been using .jsx scripts to automate some tasks in Illustrator, but I haven’t figured out how to execute actions from extensions through a script. I would for example like to push from Illustrator to After Effects using the Overlord extension and export a lottie file by using the Bodymovin extension.
Is this possible? How would I get the list of possible actions for an extension inside a .jsx script?

As far as I know we have only two options in Illustrator:
To execute menu items this way:
app.executeMenuCommand("expandStyle");
More or less full list of menu commands is here: https://github.com/ten-A/AiMenuObject
To record actions and execute them this way: https://stackoverflow.com/a/42922124/14265469
So, if your extension doesn't work via menus or actions you can't execute it from script.
Sometimes something can be done with external apps like AutoHotkey (Windows) that able to move and click mouse cursor and press keyboard buttons.

Related

Upload File / Image using Dropzone.js with Selenium-Ide

Hi Everyone
I'm new to selenium, please bear with me, and guide me a little bit.
So I want to make an automation process with selenium-ide, with the hope that this automation will make testing in my project easier.
So using selenium-ide and trying to upload a file using dropzone.js, here is the normal flow.
Click the button 'Add Photo'
Windows explorer will pop up
After the file is selected, on the background, 'dropzone' will manipulate the file while opening a pop up "Image Editor"
After clicking "Confirm" the file will be uploaded to the server.
What I want to accomplish is "How can I manipulate click/select the file after file explorer opened, using selenium-ide? or is it possible?"
I have already spent hours trying to find the solution and have had no luck.
I try using the command "type" or "send key", and also on my discovery we could use javascript directly with the command "execute script", but I just don't know how to make it work
What I expect is, I could manipulate the manual proses of the selection file with automation from selenium-ide.
Thank You.
I got my own answer guys!
My goals above can be solved using selenium-ide command called "type",
Here is the explanation:
Command:
I use "type", according to selenium-ide it will store value to your element.
Target
Dropzone will create its own element 'input file' and it's hidden, of course, so this is one that we should get, instead of your own input file. You may find it with class dz-hidden-input, and since I have many file inputs I use an array at the end of XPath [{$check}]
Value This one is the exact path where you put your file locally.
**The Logic / How it works: **
with this solution, we don't need to trigger file explorer, because the above code will inject the image inside dropzone file input, and since dropzone listens to their file input which is dz-hidden-input, it will act the same way that we choose the file from file explorer.
I hope this answer will help someone whos bumped into the same problem.
Kudos XD

Automation for terminal commands input in IntelliJ IDEA-family IDEs?

If frequently input similar commands in IDE's terminal, can I automate it somehow?
For example, I use PhpStorm and frequently create MVC-controller in Laravel framework by console command like php artisan make:controller CotrollerName. The ideal that I want:
Some simple action like shortcut pressing
Modal window "Please, input controller name".
Pressing Enter
Then IDE will automatically input php artisan make:controller InputtedCotrollerName to console and run it.
What is currently possible instead of this?
I think you overcomplicate things, simple alias would be better for this, like:
alias pamc='php artisan make:controller '
which then you can use in PHPStrorm by opening embedded terminal (Alt + F12 by default) and typing pamc ControllerName
As seems like you use Laravel you could consider using the Laravel plugin for PhpStorm. Which should provide most of the functionality you want, and a bit more.
Or
you can do what streetturtle suggested and create alias. They can save lots of writing time.

Autohotkey: Show compiled script icon

Can anyone explain me, how can I show icon of my script at the custom window?
When I compile my script, I'm using Compile_AHK and choosing my custom icon.
But I can't make it showing in my script's window.
I've tryed to show like an image, like an icon, to pack it like resource, but still no result.
I found this tutorial, but script code of it's about window shows nothing at the icons places.
It would be useful to lear how can i show some icon without using external one. Thanks a lot!
Create your test.ahk file in e.g. C:\Users\Robert\AHK
Create your test.ico file in the same directory (C:\Users\Robert\AHK)
Open a CMD window from C:\Users\Robert\AHK (Use Shift+Right Click)
In CMD run:
"C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" /in test.ahk /icon test.ico

VB.NET call desktop application from 2 shortcuts - supply different parameters

I have a desktop application which reads files from a specified folder, then deposits the files to a folder in a third party document management system based on criteria that the user provides.
My question is:
is it possible to somehow provide different parameters to the code, depending on which shortcut of the application the user clicked on to start it up?
You can add command line parameters to a shortcut icon. Here's how you can do it in Windows:
On the Start Menu, navigate to Notepad.
Right click on Notepad and choose Send To > Desktop (Create Shortcut)
Right click on the newly-created desktop icon and choose Properties
Add your command line parameters to the Target text box.
For example, if you want notepad to open up the hosts file, this would be the content of Target property:
%SystemRoot%\system32\notepad.exe "C:\WINDOWS\system32\drivers\etc\hosts"
You can put pretty much anything into the Target property of a shortcut that you would put into a command line.
Yes.
The easiest way would be to have the shortcut pass those parameters in via the command line.
You could also use conditional compilation variables, and have 2 different .exes. You should be able to find samples of both approaches (command line and conditional compilation variable) in help.

Extract the contents of cmd.exe IDE to a text file using autohotkey scripts

I am trying to extract the contents of cmd.exe IDE to a text file using autohotkey scripts ie one test.ahk and its written as shown below:
WinGetText, text, "C:\WINDOWS\system32\cmd.exe"
FileAppend, %text%, C:\ThreePartition\ACTUAL.txt
I am not able to extract the contents. Can anyone please suggest the correct way to do the extraction?
The text retrieved is generally the same as what Window Spy shows for that window.
The Window Spy shows no text elements for CMD windows - what you see is not necessarily what you can get :)
What you can do is to simulate the Select All and Paste commands, and then use the clipboard contents.
I don't believe you can extract the contents of a cmd window without somehow using DllCall to read the process memory directly.
If you just want the output of a CLI command such as Grep or AWK, using stdout via the run command should work. Honestly though, I stopped relying on AHK because this sort of thing is just too clunky.
http://www.autohotkey.com/docs/commands/Run.htm.
Edit for comments:
What you want is doable, but the solution depends entirely on how your IDE works. What behavior does it have that's unique to building a project? If it makes temp files, you can overload your "build" button with an AHK subroutine that watches for the existence of those files, and then checks the modified date of the output executable to see if the build succeeded. The same kind of solution works if the IDE changes its window title when building. Be clever. :)
Failing that, you might have to install a message hook.