PDA

View Full Version : Script commands to import files into layer?



_spike_
07-22-2011, 02:17 PM
I'm really enjoying the new scripting feature in Artrage and I hope to see it continually expand. With the added functionality, I've decided to put some time into seeing if I could write scripts to do some automation to save time. I went through the advanced scripting document but I wasn't able to find some functionality I require and hopefully I can get some answers here.

1) Is there any way to get the current working directory or the directory of the script being executed? For now I just prompt the user with an input box so the directory can can entered manually.

2) I'd like to iterate through all files in a directory and import each image into a new layer. I tried recording a script and importing images to a layer manually to see the command. But the import command takes the actual binary data of the image being imported instead of a file path. Is there a way to do this and specify a file path instead?

Thanks and great work!

AndyRage
07-22-2011, 03:21 PM
ArtRage scripting language has some useful functions for reading and writing files.
http://www.artrage.com/advanced-scripting.html

Check out the section on File Variables, and File Variable Functions in the scripting manual.

terrygillooly
07-22-2011, 05:31 PM
ArtRage scripting language has some useful functions for reading and writing files.
http://www.artrage.com/advanced-scripting.html

Check out the section on File Variables, and File Variable Functions in the scripting manual.

Good lord! If we have to write our own image decoder, I quit! :)

AndyRage
07-22-2011, 09:17 PM
I can see you're going to ask me to expose my CImage and ImageIO classes in the scripting language...

Really though, if you're wanting that level of control, you probably want to be writing a compatible Filter Plugin.

The scripting language isn't really intended to be a full development environment - its original intent was just simple flow control of recorded elements.

But, if there's a demand for it, I'm sure I can fit it into the language.

Strandy
07-23-2011, 04:39 AM
...if there's a demand for it, I'm sure I can fit it into the language...

Script coders hate functions which are not exposed much more than these which are. ;)

Unfortunately there are only fewest (but very talented) scripters in the artists community, so not sure about massive demand for it. Anyway, I vote for maximum functionality available for these few, who might make a good use of it :)

terrygillooly
07-23-2011, 04:28 PM
I can see you're going to ask me to expose my CImage and ImageIO classes....

No, no, let's keep this forum family-friendly. :rolleyes:

I think _spike_ is asking for a function such as ImportLayer("filename"), that would convert an image file into an ArtRage layer. I'd like that too. Super useful for automating certain tasks (i.e. importing image files into layers).

And a corresponding ExportLayer("filename", "file format"), of course. :)

AndyRage
07-23-2011, 09:39 PM
Ah - I see what you're asking. Being able to specify a path and filename for import to layer/tracing/document/whatever would definitely be useful for batch processing.

I'll add it to the script language wish-list.

_spike_
07-24-2011, 02:30 PM
Yes, that's exactly what I was thinking about. I would definitely make good use of this new addition. :)

terrygillooly
07-28-2011, 02:50 PM
Really though, if you're wanting that level of control, you probably want to be writing a compatible Filter Plugin.

Wait, what, we can write our own Filters? How would we do that?

I've come to the conclusion that some tasks are just too onerous for scripting (finding and erasing all white pixels, for example). :(

AndyRage
07-28-2011, 03:19 PM
Absolutely. ArtRage Studio Pro supports Photoshop filter plugins.

That's definitely the prefered way to do more complex image manipulation tasks. You can get access to image maps and selection maps through the filter interface.

aardbewoner
07-29-2011, 04:56 AM
MM How to get use photoshop plugins as i dont have the program , ok a old v4.0 i have .
Before wasting time by trying can the old be used ? Hints are welcome.
Artrage got a lot of things :) but stay easy in the basics !

Juz
07-29-2011, 07:22 AM
@Terrygillooly
here's what you need to make photoshop filters
http://www.filtermeister.com/

@aardbewoner
You can find freeware Photoshop Plugs here.. use the licence dropdown to sort by freeware
http://photoshop.pluginsworld.com/index.php?directory=adobe&software=photoshop&license=1
Note: not all Photoshop Plugz work in Artrage... you pretty much have to test them to see. You may actually have better luck with the older ones

terrygillooly
07-29-2011, 09:32 AM
Thanks for the link, Juz! Although... programming filters... I'm not sure I want to fall down that rabbit hole :eek:

AndyRage
07-29-2011, 03:11 PM
It's a deep rabbit hole. :)
The Ambient Design team wrote many of the KPT 5, 6 and KPT effects suites of filters for MetaCreations and later Corel.
Also we wrote the Texture Anarchy suite of Photoshop filters for Digital Anarchy.

Juz
07-29-2011, 05:11 PM
Andy you're making me miss the good ol' days
*wipes tear from eye ;):)

terrygillooly
07-30-2011, 11:49 AM
That kind of advanced math wizardry makes my head explode. (Personally, I feel all clever* when I realize one can't call a layer that doesn't exist.)

I must say, I really appreciate that Ambient turned its attention from writing plug-ins to developing a naturalistic painting program.

*for actual emotion felt, substitute antonym

AndyRage
08-02-2011, 03:13 PM
Waaaaiiiit a moment...

It says here in my notes that I *have* put an import path command into the ArtRage scripting language already.
Try something like this:

EvType: Command CommandID: ImportLayer Idx: 0 Path: "C:\\Image.png"

or
string csPathName = "c:\\image.png"
EvType: Command CommandID: ImportLayer Idx: 0 Path: (csPathName)


Tell me if it does anything or explodes most horribly.

terrygillooly
08-02-2011, 04:29 PM
Now off to have a field day with this.... :cool:

AndyRage
08-02-2011, 04:40 PM
There you go... we're so responsive to user requests we add features you ask for, then send them back in time so they're in there before you asked. :D

terrygillooly
08-03-2011, 08:38 AM
There you go... we're so responsive to user requests we add features you ask for, then send them back in time so they're in there before you asked. :D

:eek: Now that's a competitive edge.

Anyway, [several explosions later], is there a way to specify the path in LoadDialog()? It always seems to default to the Scripts directory.

MattRage
08-09-2011, 02:15 PM
You can't currently do this, though that may be something we can add in the future.

runningbull
01-09-2012, 07:44 PM
No, no, let's keep this forum family-friendly. :rolleyes:

I think _spike_ is asking for a function such as ImportLayer("filename"), that would convert an image file into an ArtRage layer. I'd like that too. Super useful for automating certain tasks (i.e. importing image files into layers).

And a corresponding ExportLayer("filename", "file format"), of course. :)

Yes, that would be a great start!

désirant
07-26-2014, 06:53 PM
Waaaaiiiit a moment...

It says here in my notes that I *have* put an import path command into the ArtRage scripting language already.
Try something like this:

EvType: Command CommandID: ImportLayer Idx: 0 Path: "C:\\Image.png"

or
string csPathName = "c:\\image.png"
EvType: Command CommandID: ImportLayer Idx: 0 Path: (csPathName)


Tell me if it does anything or explodes most horribly.

Hi there - this is my first post - this thread looks kind of dead but I'll try anyway ....

... on ArtRage 4.06 on my mac, inserting this line into my AR script causes the script to go into an endless loop of opening the bitmap file ... any ideas ?

But the other thing is, I can't help thinking that there has to be a better way of doing what I am trying to do: to run an existing AR script file that renders paint strokes on top of an existing canvas design. Of course I can do this manually, i.e. without the script, but is there really no way of scripting the process of setting the canvas texture by importing e.g. a paper texture bitmap ? It seems not, and so even if I get the ImportLayer command above to work, I'd have to pre prepare a differently sized bitmap background for every new painting size. Someone suggested the photoshop plugin idea as a workaround, but can the import of photoshop plugins into AR be scripted ? I suspect not ...

any ideas welcome - btw thanks for a wonderful piece of software, just find that the scripting documentation could be extended IMO (I have the pdf guide of course)

many thanks in advance

MattRage
09-22-2014, 11:21 AM
Sorry for the delay replying to this. We've made some changes in 4.5.2 that should help with some of the issues here. The main problem appears to have been with the parser understanding smart quotes, followed by a bug that caused the script to restart when encountering this error rather than drop in to Stopped state. Those have been resolved and the script should work more smoothly.