New Beginner

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

sabre-150
Newbie
Posts: 18
Joined: Thu May 01, 2008 1:32 pm
Contact:

New Beginner

Post by sabre-150 » Thu May 01, 2008 1:47 pm

I have downloaded Macro Schedular and are new to this type of software, I develop scenery for a particular Flight Simulator and one of the areas that I help develop and design is the Scenery for this Simulator.

Here is what I would like to complete in making a script and hope that I have explained well enough to understand.

I have over 1000 bitmap images that are 800 x 800 pixels in size, with the first file being named like in this example below:

Layer_D1.bmp

I would like to split the above bitmap image into 4 smaller bitmap images so would end up with 4 x 400 x 400 pixels in size and would name these with the following names:

Layer_D1a.bmp
Layer_D1b.bmp
Layer_D1c.bmp
Layer_D1d.bmp

Then repeat this process many times, I'm not sure how best to approach this idea.

Will look forward to if anyone is able to help.

Thank you.

User avatar
JRL
Automation Wizard
Posts: 3505
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu May 01, 2008 2:07 pm

I'd start by using GetFileList> to create a list of BMP file names. Then I'd create a dialog that displayed each BMP one after another. While each BMP is displayed on the dialog use ScreenCapture> 4 times in the four sectors of the displayed BMP to capture 400 x 400 pixels areas and write the results to a new location with the required name.

Sounds easy enough if all the BMPs are sized correctly. I'm not sure about the specifics of a SceenCapture> generated BMP file. If you have specific requirements, you may want to ask Marcus what type of BMP will be created before you spend the time on this.

sabre-150
Newbie
Posts: 18
Joined: Thu May 01, 2008 1:32 pm
Contact:

Post by sabre-150 » Thu May 01, 2008 2:21 pm

JRL,

Thank you for your reply, the bitmap images are 24 bit, I will try with what you have suggested to try and make a start.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu May 01, 2008 2:28 pm

If you are doing this kind of image manipulation it's worthwhile to get familiar with ImageMagick, a very versatile, free, suite of tools which can be very conveniently automated with MacroScheduler. I assumed the images were numbered sequentially so this would be my code to do what you request:

Code: Select all

//change to the imagemagick install directory
Change Directory>C:\IMAG
//set up a repeat loop
Let>k=0
Repeat>k
Let>k=k+1
//crop the image 4 times
RunProgram>convert.exe c:\temp\Layer_D%k%.bmp -crop 400x400+0+0 c:\temp\Layer_D%k%a.bmp
RunProgram>convert.exe c:\temp\Layer_D%k%.bmp -crop 400x400+0+400 c:\temp\Layer_D%k%b.bmp
RunProgram>convert.exe c:\temp\Layer_D%k%.bmp -crop 400x400+400+0 c:\temp\Layer_D%k%c.bmp
RunProgram>convert.exe c:\temp\Layer_D%k%.bmp -crop 400x400+400+400 c:\temp\Layer_D%k%d.bmp
//end the looping when all images are processed (change 2 to the correct number
Until>k,2
If the filenames aren't sequential then you will have to use GetFileList> as JRL suggests.

sabre-150
Newbie
Posts: 18
Joined: Thu May 01, 2008 1:32 pm
Contact:

Post by sabre-150 » Thu May 01, 2008 2:29 pm

I have the Editor window open, then click on the + button next to File Handiling, if I then drag the GetFileList to the main editor window nothing happens, or if I right click on the mouse then 3 options become available, Insert Command, Add to Favorites and Command Help.

Is it a simple mistake that I have made, I'm sure I will have many questions but first is there an area that I should read first.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu May 01, 2008 2:33 pm

Just left click on it once. A dialog will come up helping you to construct the command and insert it into the editor.

Or, just type into the editor.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
JRL
Automation Wizard
Posts: 3505
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu May 01, 2008 2:34 pm

Try clicking Help > Contents > Getting Started

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu May 01, 2008 2:34 pm

I think I'd go with Me_again's approach - automate ImageMagick.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

sabre-150
Newbie
Posts: 18
Joined: Thu May 01, 2008 1:32 pm
Contact:

Post by sabre-150 » Thu May 01, 2008 2:41 pm

Me_again,

Below is a step by step guide to exactly what steps I'm taking.

Open Layer_D1.bmp bitmap
Select - Image then Attributes
Change Width from 800 to 400
Press Tab Key
Change Height from 800 to 400
Click OK
Select - File then Save As
Save file name as - Layer_D1a

Open Layer_D1.bmp bitmap
Select - Image then Flip and Rotate and select Flip horizontal
Click OK
Select - Image then Attributes
Change Width from 800 to 400
Press Tab Key
Change Height from 800 to 400
Click OK
Select - Image then Flip and Rotate and select Flip horizontal
Select - File then Save As
Save file name as - Layer_D1b

Open Layer_D1.bmp bitmap
Select - Image then Flip and Rotate and select Flip Vertical
Click OK
Select - Image then Attributes
Change Width from 800 to 400
Press Tab Key
Change Height from 800 to 400
Click OK
Select - Image then Flip and Rotate and select Flip Vertical
Select - File then Save As
Save file name as - Layer_D1c

Open Layer_D1.bmp bitmap
Select - Image then Flip and Rotate and select Flip Vertical
Click OK
Select - Image then Flip and Rotate and select Flip horizontal
Click OK
Select - Image then Attributes
Change Width from 800 to 400
Press Tab Key
Change Height from 800 to 400
Click OK
Select - Image then Flip and Rotate and select Flip Vertical
Select - Image then Flip and Rotate and select Flip horizontal
Click OK
Select - File then Save As
Save file name as - Layer_D1d

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu May 01, 2008 2:48 pm

What program are you doing that in?

sabre-150
Newbie
Posts: 18
Joined: Thu May 01, 2008 1:32 pm
Contact:

Post by sabre-150 » Thu May 01, 2008 2:55 pm

mspaint

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu May 01, 2008 2:56 pm

>> Open Layer_D1.bmp bitmap

In what? Photoshop, Fireworks, Paintshop Pro, Paint, Apperture, Lightroom, ..... ? Either way - you know the app better than we do.

Read:
http://www.mjtnet.com/blog/2006/01/17/h ... on-script/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

sabre-150
Newbie
Posts: 18
Joined: Thu May 01, 2008 1:32 pm
Contact:

Post by sabre-150 » Thu May 01, 2008 3:09 pm

I'm just using Microsoft Paint that's located in \Windows\system32 directory

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu May 01, 2008 3:11 pm

sabre-150 wrote:mspaint
OK, that's doing the same thing as the code that I posted. But you can also automate mspaint as Marcus suggests, it would not be difficult.

sabre-150
Newbie
Posts: 18
Joined: Thu May 01, 2008 1:32 pm
Contact:

Post by sabre-150 » Thu May 01, 2008 4:11 pm

Not having much success at the moment, must be something simple that I'm doing wrong, would it be possible for someone to create and post a simple script with what I'm trying to do as above at least this will be a starting point and hopefully will start to get an understanding of it all.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts