Marcus' Macro Blog

Tips and News on Macro Recording and Automating Windows with Macro Scheduler
February 12th, 2015 by Marcus Tettmar

February 6th, 2015 by Marcus Tettmar

We received this email today and I just had to share it …

Macro Scheduler image recognition just saved me 6 hours of mind numbing work and my program took me about 15 minutes to write, test, and start using. Such an AWESOME solution you provide.

Richard A. San Jose, CA USA

For more info on how to use Image Recognition see:
http://help.mjtnet.com/article/39-how-to-use-macro-schedulers-image-recognition-functions

January 23rd, 2015 by Marcus Tettmar

Electric cars and hybrids are becoming more common and it’s great to see more and more of them on the road. My next car, due next month, will be a plug-in hybrid.

I see the industry moving rapidly. Advancements in battery technology and range are happening all the time. If I didn’t have a large family I’d be happy with a small pure-EV with a range of over 200 miles. But I don’t think it will be long before larger family sized cars can do the same. In fact Tesla recently revealed a prototype 7 seater – the Model-X – which promises a range of 270 miles. Right now it’s a bit pricey, but it won’t be long before other manufacturers catch up. I can’t wait.

The same technology is now being tried in other forms of transport. Near my home town of Harwich this month the first battery powered train was tested. Much of our train network has been or is being electrified. But inevitably there are gaps which at present must be filled by diesel engines. A battery powered solution would allow trains to continue to work on electricity through the gaps and recharge when back on overhead power.

Recently I read about a battery powered electric chain ferry in Norway. It has now been sailing for over a year. Great stuff. There’s a chain ferry near us in Poole Harbour. I hope they look to similar technology.

Of course we also need to make sure the electricity used to charge these batteries is not being made by burning coal. But it’s good to see this kind of progress towards a reduction on our dependence on oil, which is sorely needed:

A third of the world’s oil, half of its gas, and 80 percent of its coal reserves must remain unused if we are to have a good chance of avoiding potentially devastating climate change.

January 16th, 2015 by Marcus Tettmar

Well, it’s a new year and with that comes new years resolutions. For MJT Net Ltd I decided we needed to do more to lessen our impact on the environment.

We’ve already made some changes:

Our web sites, mjtnet.com and clipmagic.com, are now hosted in a data center which runs directly on 100% renewable generated electricity.

Web servers run 24/7. So I think switching to green data centers is an important move.

null

For our office electricity we have recently switched to ecotricity who generate all their electricity using renewable sources – the wind, sun and sea. We’re also planning to install our own solar panels this year.

Where possible we will source second hand/reconditioned IT hardware.

We’re not a large company, so these changes may seem minuscule in the grand scheme of things. But it all helps and if everyone did this it will help much more.

January 15th, 2015 by Marcus Tettmar

Our very own Dorian Ellis drove this beautiful MJT liveried virtual car to a 1st in class win at Prague in Forza Motorsport 5:

MJT Macro Car

The design is courtesy of Chris Henwood. Great work Chris!

December 22nd, 2014 by Marcus Tettmar

Someone asked me how they could buy a Macro Scheduler subscription for a friend, for Christmas and I thought what a great idea!

A monthly subscription costs only $15. Or you can buy a three month subscription for $40.

More info and subscription signups here.

That would make a great Christmas present for someone. You can buy a three month subscription and then cancel before the end of the term and they get three months of uninterrupted, unlimited use. A great way to introduce someone to the power and flexibility of Macro Scheduler.

If you want to buy someone a subscription, use your details when you signup and then forward them the activation email. Keep the subscription going for as long as you want.

December 15th, 2014 by Marcus Tettmar

Just a quick note to wish all our customers and readers of this blog good tidings for this festive season. Whether you celebrate this time of the year or not, we’ll be raising a glass to all of you.

Forum regular JRL has put together this snazzy little Macro Scheduler script. Paste it into a new macro and hit run for some festive cheer:

OnEvent>key_down,VK27,0,Quit
SRT>Quit
  SetControlText>Sparkler,TEdit,1,Complete
  WaitWindowClosed>Sparkler
  Wait>1
  DeleteFile>%temp_dir%Sparkler.scp
  Exit>0
END>Quit

DeleteFile>%temp_dir%Sparkler.scp
LabelToVar>SparkleScript,vScrData

Dialog>Dialog1
object Dialog1: TForm
  BorderStyle = bsNone
  Caption = 'Happy Holidays'
  ClientHeight = 330
  ClientWidth = 780
  Color = 111111
  Position = poScreenCenter
  object Panel3: TPanel
    Left = 0
    Top = 0
    Width = 780
    Height = 330
    BevelEdges = []
    BevelOuter = bvNone
    Caption = 'And a Happy New Year'
    Color = 111111
    Font.Charset = ANSI_CHARSET
    Font.Color = clRed
    Font.Height = -80
    Font.Name = 'Vladimir Script'
    Font.Style = []
    ParentFont = False
    Visible = False
  end
  object Panel2: TPanel
    Left = 0
    Top = 0
    Width = 780
    Height = 330
    BevelEdges = []
    BevelOuter = bvNone
    Caption = 'Merry Christmas'
    Color = 111111
    Font.Charset = ANSI_CHARSET
    Font.Color = clRed
    Font.Height = -96
    Font.Name = 'Old English Text MT'
    Font.Style = []
    ParentFont = False
  end
  object Panel1: TPanel
    Left = 0
    Top = 0
    Width = 780
    Height = 330
    BevelEdges = []
    BevelOuter = bvNone
    Caption = ''
    Color = 111111
  end
end
EndDialog>Dialog1

Show>Dialog1

ExecuteFile>%temp_dir%Sparkler.scp

Let>WIN_USEHANDLE=1
  GetWindowPos>Dialog1.handle,Dia1X,Dia1Y
Let>WIN_USEHANDLE=0
Add>Dia1Y,165
Let>StartY=Dia1Y
Let>YFlag=1
Wait>0.3

Let>kk=0
Repeat>kk
  Add>kk,4
  If>Dia1Y>{%StartY%+20}
    Let>YFlag=0
  EndIf
  If>Dia1Y<{%StartY%-20}
    Let>YFlag=1
  EndIf
  Add>Dia1X,4
  If>YFlag=1
    Add>Dia1Y,8
  Else
    Sub>Dia1Y,8
  EndIf
  Wait>0.025
  If>Dia1X>40
    SetControlText>Sparkler,TEdit,1,%Dia1X%;%Dia1Y%
  EndIf
  SetDialogProperty>Dialog1,Panel1,Left,kk
Until>kk>750

Timer>Begin

GetWindowPos>Sparkler,SparkX,SparkY

Label>Loop
If>{%Dia1X%<%SparkX%+150}
  Add>Dia1X,1
EndIf
If>Dia1Y>StartY
  Sub>Dia1Y,1
EndIf
If>Dia1YDia1Y,1
EndIf
SetControlText>Sparkler,TEdit,1,%Dia1X%;%Dia1Y%
Wait>0.01
Timer>Stop
If>{%Stop%-%Begin%>5000}
  GoSub>Fade
EndIf
Goto>Loop

SRT>Fade
  SetDialogProperty>Dialog1,,AlphaBlend,True
  Let>Fader=255
  Repeat>Fader
    Sub>Fader,5
    SetDialogProperty>Dialog1,,AlphaBlendValue,Fader
    Wait>0.1
  Until>Fader<0
  Let>Fader=255
  SetDialogProperty>Dialog1,Panel3,Visible,True
  SetDialogProperty>Dialog1,Panel2,Visible,False
  SetDialogProperty>Dialog1,,AlphaBlendValue,Fader
  Wait>3
  Timer>Begin
  GetScreenRes>ScreenX,ScreenY
  While>{%Stop%-%Begin%<10000}
    Timer>Stop
    Random>100,Pct
    Add>pct,1
    Let>Dia1X={round(%ScreenX%*(%pct%/100))}
    Random>100,Pct
    Add>pct,1
    Let>Dia1Y={round(%ScreenY%*(%pct%/100))}
    SetControlText>Sparkler,TEdit,1,%Dia1X%;%Dia1Y%
    Sub>Fader,5
    SetDialogProperty>Dialog1,,AlphaBlendValue,Fader
    Wait>0.2
  EndWhile
  SetControlText>Sparkler,TEdit,1,Complete
  WaitWindowClosed>Sparkler
  Wait>1
  DeleteFile>%temp_dir%Sparkler.scp

  Exit>0
END>Fade

/*
SparkleScript:
Let>size=200

OnEvent>key_down,vk27,0,Quit

SRT>Quit
  Exit>0
END>Quit

Dialog>Dialog2
object Dialog2: TForm
  BorderStyle = bsNone
  Caption = 'Sparkler'
  Color = 1
  TransparentColor = True
  TransparentColorValue = 1
  object Panel1: TPanel
    Left = 0
    Top = 0
    BevelOuter = bvNone
    Caption = 'Panel1'
    Color = 1
    TabOrder = 0
  end
  object Edit1: TEdit
    Text = '-1000;-1000'
    Visible = False
  end
end
EndDialog>Dialog2

Let>WIN_USEHANDLE=1
  MoveWindow>Dialog2.handle,-1000,-1000
Let>WIN_USEHANDLE=0
AddDialogHandler>Dialog2,,OnClose,Quit
SetDialogProperty>Dialog2,,ClientHeight,size
SetDialogProperty>Dialog2,,ClientWidth,size
SetDialogProperty>Dialog2,Panel1,Height,size
SetDialogProperty>Dialog2,Panel1,Width,size
SetDialogProperty>Dialog2,,AlphaBlend,True
SetDialogProperty>Dialog2,,AlphaBlendValue,0
Show>Dialog2

Let>halfSize={round(%size%/2)}
Let>85Per={round(%halfSize%*0.85)}
Let>15Per={round(%halfSize%*0.15)}
Let>ang2=0
Let>kk=0
SetDialogProperty>Dialog2,,AlphaBlendValue,255
Repeat>kk
  GetDialogProperty>Dialog2,Edit1,Text,vPos
  If>vPos=Complete
    Let>kk=-100
    Goto>Done
  EndIf
  Separate>vPos,;,Cur
  Sub>Cur_1,%halfSize%
  Sub>Cur_2,%halfSize%
  MoveWindow>Sparkler,Cur_1,Cur_2
  Add>kk,1
  Random>85Per,res
  Add>res,%15Per%
  Random>50,color
  Add>Color,45500
  Random>90,ang2
  Let>ang2=%ang2%*4
  GoSub>Angle,Dialog2,Panel1,ang2,%halfSize%,%halfSize%,%halfSize%,4,1
  Random>90,ang3
  Let>ang3=%ang3%*4
  GoSub>Angle,Dialog2,Panel1,ang3,%halfSize%,%halfSize%,%halfSize%,4,1
  Random>90,ang
  Let>ang=%ang%*4
  SetDialogProperty>Dialog2,Panel1,caption,space
  GoSub>Angle,Dialog2,Panel1,ang,%halfSize%,%halfSize%,res,2,color
  Label>Done
Until>kk<0

//Angle Usage:
//GoSub>Angle,Dialog,Object,Angle(in degrees),XStart,YStart,Length,PenSize,PenColor
//Requires Drawline subroutine
SRT>Angle
  Let>DegreeAngle=Angle_var_3
  Let>XStart=Angle_var_4
  Let>Ystart=Angle_var_5
  Let>LineLength=Angle_var_6
  Let>RadAngle={%DegreeAngle%*(pi/180)}
  Let>XEnd={trunc((cos(%RadAngle%))*%LineLength%)}
  Let>YEnd={trunc((sin(%RadAngle%))*%LineLength%)}
  Let>XEnd=%XEnd%+%XStart%
  Let>YEnd=%YEnd%+%YStart%
  GoSub>DrawLine,%Angle_var_1%.%Angle_var_2%.Handle,Angle_var_7,Angle_var_8,XStart,YStart,XEnd,YEnd
END>Angle

SRT>DrawLine
  LibFunc>user32,GetDC,HDC,%DrawLine_var_1%
  LibFunc>gdi32,CreatePen,Penres,0,%DrawLine_var_2%,%DrawLine_var_3%
  LibFunc>gdi32,SelectObject,SOPres,hdc,Penres
  Libfunc>gdi32,MoveToEx,mtres,HDC,%DrawLine_var_4%,%DrawLine_var_5%,0
  LibFunc>gdi32,LineTo,ltres,hdc,%DrawLine_var_6%,%DrawLine_var_7%
  LibFunc>gdi32,DeleteObject,DOres,Penres
  LibFunc>user32,ReleaseDC,RDCres,HDC_1,HDC
END>DrawLine
*/

Enjoy! :-)

December 2nd, 2014 by Marcus Tettmar

“Here in the North Pole our elves work hard every year to ensure presents are created and delivered on time to good little boys and girls all over the world,” says Santa Claus, “but with a booming world population and the ever increasing demands of modern employment and elf-and-safety regulations, our task is getting harder and harder and we need to modernize without breaking the bank or requiring specialist skills”.

On Christmas Day Santa Claus delivers toys to well behaved boys and girls all over the world. Budgets are tight, especially with the collapse of the Icelandic banking system where most of Santa’s investments were held. As an ethical organization Santa’s operation must also be seen to be economic and efficient and now has to adhere to strict new guidelines on the amount of hours per day elves can work.

Up until now Santa’s operation was largely manual. “We are in an awkward position,” says Claus “people expect us to carry on our traditions of elf-labour and creating products by hand, but at the same time the world has moved on and we need to compete with the likes of Walmart and ToysRUs and cut our costs. So we needed to find ways of improving efficiency without losing our traditional appeal. 100% mechanization is a no-no. But something that would help with the repetitive manual number crunching and data entry tasks would be ideal. We also had to find something that didn’t require specialist IT knowledge. I mean, our elves, bless them, they’re wonderful at toy-making, but technology? Not so much. So we turned to Google and found Macro Scheduler.”

Many of the tasks carried out by the elves are repetitive and time-consuming, taking elves away from the more productive work of producing toys and wrapping presents. “Once a day we have to download the new lists from our incoming server. There’s the naughty list and the good list.” says Jingle, Santa’s Chief Elf, “We need to check for duplicates, then copy and paste each list into our own master list. Of course boys and girls can switch from list to list too, so we need to cross reference. If someone was on the good list but has been naughty we need to find their record, remove it from the good master list and place it on the naughty list. This used to be a manual process, taking around 6 hours a day. With Macro Scheduler we were able to automate the entire process. A macro trigger responds to the lists appearing in the inbox and then reads through the data and cleans our master list automatically. It’s entirely automated. We used to take turns doing this job and you wouldn’t believe how much happier everyone is now that they can make toys instead.”

That task alone is saving over 2000 elf-hours a year. But it’s not just the elf-savings that Santa’s team is benefiting from. Elves are happier too. It also saves a number of embarrassing mistakes. “In the past it was easy to mess up a change in the lists. Some poor kid ends up being put on the naughty list by mistake and he doesn’t get a present. That was a real PR nightmare! Santa would lose his rag too. I mean you didn’t want to be there! Yeh, the elves are much happier now and we’re now more likely to hit our toy-creation performance targets too. Everyone wins”.

Santa and his team are now using Macro Scheduler wherever they can and can see many opportunities to expand its use across their North Pole operations center over the following year.

“We’re really impressed with the product and the support that comes with it. None of our elves were programmers, with only basic IT skills, but they’ve picked up Macro Scheduler quickly. The possibilities are endless and we’re really glad we found it.” says Claus.

For more information on Macro Scheduler click here. For more case studies and success stories go here.

November 25th, 2014 by Marcus Tettmar

Today I was asked if Macro Scheduler can trigger an action if the number of connected monitors changes. Yes, all we need is a way to determine how many monitors are connected to the system. VBScript is one way to do that. So then all we need is a loop that constantly checks this value. So we end up with something like this:

November 21st, 2014 by Marcus Tettmar

When robots get it wrong:

      Get FREE Consultation



      Archives

  • Categories