Author Topic: OE: object batch convert?  (Read 2062 times)

Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« on: September 26, 2007, 02:41:19 PM »
Hi

Has anybody tried any commercial desktop macro softwares for the task?

I  am trying to do a same function with python:

import SendKeys
SendKeys.SendKeys("""
    %^§
    [pause=15]
    %f
    c
    +{TAB}
    {END}
    ~
    [pause=5]
    %f
    e
""")


This script open the OE with my assigned windows shortcut.
Then it open the Convert dialog and select the first .ac file from the list and hit enter.
Close to OE.

Still the loop and 1-by-1 file selection needs to solve.

Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #1 on: October 01, 2007, 03:04:56 PM »
Here we go


This script will convert all .ac files from HTC/ah2editor/ahiiterr/Tiles/ folder.


# The Batch convert tool for the Aces High 2 Object-Editor(OE) by Xjazz
# Script requires the python 2.4+ and the SendKeys module installation
# The SendKeys module is available at:
# [url]http://www.rutherfurd.net/python/sendkeys/index.html[/url]
#
# This script assumes, your OE windows short-cut is CRTL+ALT+1
# Place script to the ah2editor folder and run it by double clicking it
#
# Ver. 0.2beta / 01.10.2007

import os, SendKeys

# You must set the path to the Tiles-folder
path = 'c:/Program Files/HTC/ah2editor/ahiiterr/Tiles/'

def getFiles(path):
    ac_names = []
    arqs = os.listdir(path)
    for a in arqs:
        if a.endswith('.ac'):
        ac_names.append(a)

          # User can adjust the PAUSE times at will. YMMV
        SendKeys.SendKeys("{PAUSE 1}%^1{PAUSE 5}%fc"+a+"~{PAUSE 2}%fe")
  return ac_names

getFiles(path)

# 'You must delete the "cache" folder before you restart the OE'


No error handling to mention. Make sure you have proper texture files copied to the Tiles folder.

Offline croduh

  • Gold Member
  • *****
  • Posts: 2509
OE: object batch convert?
« Reply #2 on: October 02, 2007, 01:54:17 AM »
Will have to try that, nice work.

Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #3 on: October 04, 2007, 02:03:26 PM »
Quote
Originally posted by croduh
Will have to try that, nice work.


S! Croduh,

Let me know how it is working for you. All ideas are welcome.

(Mumbling by myself:Lots of views but only one feedback... Maybe this has something to do with the windmills)

....

Aaanyhow

I'm doing now a test  version coding for the Batch_Checking script, which will do a pre-convert checking for files in Tiles folder as far as possible:

-  Check if all ac. file assigned .bmp texture files are available in Tiles folder.
- Check if *.bmp textures are in index mode and  *_a.bmp alpha layers are in grayscale mode.
- If *_.txt file is present, the user defined GLOBAL alpha channel value is checked from target *.bmp.
- If sub-object has a 'StencilAlpha' flag, the texture related _a.txt file checked.

-----------------------

The future visions

Possible options:
- The automatic texture mode conversion and _a.txt file creation with valid alpha channel data (with PIL)
- The converted *.shp & *.htx file are copied to the target project texsrc folder.
- The whole project folder is zip back-upped before any copy-to actions.
- The TE is launched to the target project (sendkeys)

Offline Easyscor

  • Plutonium Member
  • *******
  • Posts: 10888
OE: object batch convert?
« Reply #4 on: October 04, 2007, 02:15:17 PM »
Clearly you know what you're doing but it's all :noid

You're way too far ahead of me to know what's going on but it's still interesting to read. Glad you finally found a soul mate.:aok
Easy in-game again.
Since Tour 19 - 2001

Offline Ghastly

  • Silver Member
  • ****
  • Posts: 1756
OE: object batch convert?
« Reply #5 on: October 04, 2007, 02:59:54 PM »
Quote
Lots of views but only one feedback


I read everything in this forum, even when  it's way way way "out there" from the level I'm at, and far removed from what I'm doing at this time.

Someday, when I need it, I'll go - "wait a minute, didn't someone post ... ?????"

"Curse your sudden (but inevitable!) betrayal!"
Grue

Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #6 on: October 04, 2007, 03:29:13 PM »
(some bites are working better than brand x brand bites...) :D

The manager level message is: I invent something, which will cut-down the routine work load in long run'.

I bet some people didn't take a time to adjust several object property  parameters at once...

--------

Somehow it is sad,...After all these years, it takes my kind of self learned Sunday code quack to do a OE-TE related utile, which will cut-down the custom object-terrain maker workload.

I was cooking my idea now & then several months. The HTC could do same thing since OE T0 with in hour or quarter.

------------------

But... If there's simple no need for the batch check / convert tool. Why I typing here?!

Offline NHawk

  • Silver Member
  • ****
  • Posts: 1787
OE: object batch convert?
« Reply #7 on: October 04, 2007, 03:41:42 PM »
Quote
Originally posted by Xjazz
....(Mumbling by myself:Lots of views but only one feedback... Maybe this has something to do with the windmills)....
I try to read every post in this forum. Sometimes twice! So I inflate the view count on many messages. :)
Most of the people you meet in life are like slinkies. Pretty much useless, but still bring a smile to your face when you push them down the stairs.
-------------------------------
Sometimes I think I have alzheimers. But then I forget about it and it's not a problem anymore.

Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #8 on: October 04, 2007, 03:54:47 PM »
Quote
Originally posted by NHawk
I try to read every post in this forum. Sometimes twice! So I inflate the view count on many messages. :)


It was YOU?! Why you little!!!! :D

-----

Making a OE-TE things a manually in old fashion way don't make you any better than rest of us... The progress is here.

Offline croduh

  • Gold Member
  • *****
  • Posts: 2509
OE: object batch convert?
« Reply #9 on: October 05, 2007, 02:46:35 AM »
Well first it seems i have to get my self that phyton and send keys...

Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #10 on: October 05, 2007, 01:47:02 PM »
Quote
Originally posted by croduh
Well first it seems i have to get my self that phyton and send keys...


Yes, you need to install python before you can run *.py / *.pyc files.

Python 2.51
http://python.org/download/

SendKeys module in needed with my script
http://www.rutherfurd.net/python/sendkeys/index.html

but

I'm working now with stand alone windows exe version :)

Offline BlauK

  • Platinum Member
  • ******
  • Posts: 5091
      • http://www.virtualpilots.fi/LLv34/
OE: object batch convert?
« Reply #11 on: October 06, 2007, 05:43:08 AM »
It is so stupid that one cannot just simply select several files at the same time in  the OE's convert dialog.
Very good heads up Xjazz :aok Gotta check this out next time I have several objects under work.


  BlauKreuz - Lentolaivue 34      


Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #12 on: October 07, 2007, 07:50:56 AM »
Hi

Here is a latest batch convert script version.
http://www.warezhouze.1g.fi/Here/Blender3d/AH_scripts/OE_batch_convert_py_v04b.zip

The zip file contains the script and settings files. Unzip them to your ?:/Program Files/HTC/ah2editor/ahiiterr/Tiles/ folder.

The 'installation':
- Create the OE shortcut with CTRL+ALT+1 shortcut key(default). OR define your own.
- Update the 'oe_bs.txt' settings file content with proper path and OE shortcut data.
- Create the Batch_Convert_py2exe_04b.py shortcut,with minimized 'Run' window, to the desktop.

Run the script:
- COPY .ac files with all needed textures and related files to the //Tiles/ folder
- Close all other applications and start the script with desktop shortcut.
- Don't open other applications while script is running.
- The batch convert is  finished when the script Taskbar window disappear.

This .py file is a stand-alone windows .exe candidate.
« Last Edit: October 07, 2007, 07:55:55 AM by Xjazz »

Offline croduh

  • Gold Member
  • *****
  • Posts: 2509
OE: object batch convert?
« Reply #13 on: October 07, 2007, 08:10:57 AM »
Don't understand some parts of your instructions:

Where do i create the OE shortcut?On desktop?In the tiles folder?
Sorry, but what you wrote is a bit confusing:D

Offline Xjazz

  • Gold Member
  • *****
  • Posts: 2653
OE: object batch convert?
« Reply #14 on: October 07, 2007, 02:37:51 PM »
Quote
Originally posted by croduh
Don't understand some parts of your instructions:

Where do i create the OE shortcut?On desktop?In the tiles folder?
Sorry, but what you wrote is a bit confusing:D


I write it in hurry....

So

1. Create a ahobedit.exe (OE) shortcut to the ah2editor folder.



2. Create a shortcut key (ctrl+alt+1) for OE shortcut in shortcut properties.



3. Create a shortcut for the Batch_Convert_py2exe_04b.py script to the Tiles folder.



4. A. Drag and drop the Batch_Convert_py2exe_04b.py shortcut to the Taskbar or to the desk top.
4. B. Set Run-mode to the 'Minimized'.


Ok? :)