-
1. Re: get data from expression to script and move layers(up/down)
David Torno Feb 6, 2014 11:11 AM (in response to zipkiev)var expression_x_value="and here don't know what i must do to get X expression data"
var expression_y_value="and here don't know what i must do to get Y expression data"
I don't believe you can retrieve specific expression variable data directly. The resulting output to the layer property is what is accessible. So since x and y are the resulting values you would simply grab the position property value from the layer via your script.
myComp.layer(index).property("ADBE Transform Group").property("ADBE Position").value[0]; //Returns X value
myComp.layer(index).property("ADBE Transform Group").property("ADBE Position").value[1]; //Returns Y value
myComp.layer(index).property("ADBE Transform Group").property("ADBE Position").value[2]; //Returns Z value
imported_file_for_move.moveAfter(CurlayIndex); // i think line this not work
The moveAfter method requires a layer obj, not an layer index number. The reason for this is when you add a new layer, the index values of each layer will change, so you need to save the layer object for it.
imported_file_for_move.moveAfter(CurlayIndex);
should be...
imported_file_for_move.moveAfter(myComp.layer(CurlayIndex));
-
2. Re: get data from expression to script and move layers(up/down)
zipkiev Feb 6, 2014 3:28 PM (in response to David Torno)Hi David, thx for your help, i successful fix error on moving layer... but in question about getting data from x y i mean how transfer data from variables in expression to script variables, for easy understanding i choose simple example with position X Y, in fact i need help for get sampleImage() data, i want use this expression for find alpha on layer
Something like this:
1 loop trough all pixels
2 find RGB pixels and store data in expression variable
3 and hear i need somehow transfers data with RGB pixels coordinates from expression variable to script variable
4 receive data from expression and then calculate size of future precomp and create it
5 render file from this precomp
6 import it back
PS i try do something like autocrop script, i need this for trim my PNG files
PS2 sorry for bad English
-
3. Re: get data from expression to script and move layers(up/down)
Dan Ebberts Feb 6, 2014 3:37 PM (in response to zipkiev)I think I'd have the script:
- add a Point Control to the layer
- add the sampleImage expression to the Point Control
- read the value of the point control
- repeat as necessary (if you need to harvest values for top, bottom, left, and right, for example)
- remove the point control
Dan
-
4. Re: get data from expression to script and move layers(up/down)
zipkiev Feb 7, 2014 1:33 PM (in response to Dan Ebberts)thx Dan for your help, i think its what i need... i try to do with this algorithm...
Ps don't want to create new tread for easy question .... maybe some one answer here how used hot keys in ae script?
for example if i click 5 on keyboard script run my code. thx
-
5. Re: get data from expression to script and move layers(up/down)
David Torno Feb 7, 2014 2:02 PM (in response to zipkiev)The shortcuts document can be used to assign the first 20 scripts in your "Scripts" folder, not the "ScriptUI Panels" folder unfortunately.
AECC on mac:
Adobe After Effects 12.1 Mac en_US Shortcuts.txt
Just search for "ExecuteScript". You can assign them there. Just make sure the shortcut key you choose is not being used anywhere else in the document.
If you are wanting shortcut keys within your scriptUI, then you can add window event callback called "onShortcutKey" on PC. The JavaScript Tools Guide CC.pdf has info on...
Pg. 113
shortcutKey The key sequence that invokes this window’s onShortcutKey callback (in Windows only).
Pg. 122
onShortcutKey (In Windows only) Called when a shortcut-key sequence is typed that matches the shortcutKey value for this window.
-
6. Re: get data from expression to script and move layers(up/down)
zipkiev Feb 8, 2014 9:53 AM (in response to David Torno)Hi David, can u please write small example because i don't have " The JavaScript Tools Guide CC.pdf"(try use google, but also not find it), i have a JavaScriptToolsGuide_CS5.pdf and find shortcutKey and onShortcutKey, but i don't understand how use it, where i must write combination of keys?(ctrl + A, shift+f2 and etc)
for example:
button7=myPanel.add("button", undefined, "key test");
button7.onClick=some_function; //this for example, how i click on button by mouse
button7.onShortcutKey(); //and here i don't understand what i must write to execute "some_function"Thx
-
7. Re: get data from expression to script and move layers(up/down)
David Torno Feb 8, 2014 6:44 PM (in response to zipkiev)i have a JavaScriptToolsGuide_CS5.pdf and find shortcutKey and onShortcutKey
Same description for them as the AECC pdf. It is lacking as far as samples go.
I don't have a PC nearby to test the proper syntax, but I did find this post that may help you with it.
-
8. Re: get data from expression to script and move layers(up/down)
zipkiev Feb 9, 2014 3:09 PM (in response to David Torno)thx David, i try your link, it work only when script palette selected(but i need working in all ae, for example if i select layer in time line and press Alt+f1 script done something), and now i don't know this is problem in my script(and example from link) or all scripts(include mac ) cant gets pressed buttons in full AE window and i must better forget about hot keys?
for now i have
button7=myPanel.add("button", undefined, "test");
button7.onClick=somecode;
button7.shortcutKey = 'w'; //set key w
button7.onShortcutKey =button7.onClick;
PS super easy thing, but on this Extended script always cant find examples for such simple tasks(for example in visual studio this can be done vary easy...), i totally don't understand "AE java script guide" examples for shortcutKey, and google also cant find interesting for me information, i see only Dan and David write examples for people..., and again thx guys
PS2 lazy adobe do super extended scripting guide for noobs....
-
9. Re: get data from expression to script and move layers(up/down)
David Torno Feb 11, 2014 8:18 AM (in response to zipkiev)As far as I know script shortcut keys are only active when in that script's window. Otherwise a single shortcut key could be assigned to multiple scripts and a lot of things would fire off at once.
-
10. Re: get data from expression to script and move layers(up/down)
zipkiev Feb 12, 2014 6:39 AM (in response to David Torno)thx David... to bad hear that... maybe in far future ae has this feature...



