Basically want to make a macro script

Casey via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 13 14:20:56 PST 2014


On Thursday, 13 November 2014 at 21:56:48 UTC, Casey wrote:
> On Thursday, 13 November 2014 at 16:04:43 UTC, Adam D. Ruppe 
> wrote:
>> On Thursday, 13 November 2014 at 07:01:08 UTC, Rikki 
>> Cattermole wrote:
>>> I did find this [0]. I don't know what state its in for 
>>> compilating/running ext. But it might give you a good 
>>> starting point.
>>>
>>> [0] https://github.com/pythoneer/XInputSimulator
>>
>> ooh there's some nice code for Linux in there! The Windows is 
>> only half implemented though... but this combined with my 
>> Windows code should get you enough example to write a 
>> cross-platform thing if you need it.
>
> Thank you so much!  I really appreciate this!  But I have a few 
> questions.
>
> 1) Which compiler should I use?  I'm attempting to use the DM D 
> comiler, but afaik it doesn't have a GUI and I can't make any 
> sense of how to use it otherwise.  I'll look up a tutorial on 
> it if this is the one you recommend.  If it's not the one you 
> recommend, I'll give yours a try.
>
> 2) I can't figure out what the heck half of this code means.  
> It seems that at the bottom you have what each of the hotkey 
> buttons are, and I can see a few times where you referenced 
> them.  I can also see a efw listeners for the keybinds to be 
> pressed, and then where you use the writeln command.  Other 
> than that, I can't tell what's going on.  I feel like a noob, 
> sorry that I don't understand this.
>
> 3) I'm sure that everything you have in there has a meaning, 
> but it looks over complicated to me.  Shouldn't it look 
> something like this?
>
> [code]
> void main() {
>     import std.stdio;
>     import simpledisplay;
>     import *Others that need to be imported*;
>     if (*hotkey command here*) {
>     then writeln ("We're losing Alpha!")
>     return 0;
> }
> [/code]
>
> I know there's a /LOT/ more to it than that, but wouldn't that 
> be the basics?  I honestly don't know a whole lot about what 
> you did, but at least I understand the basic concept of 
> programming.
>
> I'm going to start looking up a few tutorials on compiling 
> using the DM D compiler, let me know if you recommend a 
> different one.
>
> Could you tell me which keys you used for the hotkey in your 
> sample code?  I can't figure it out, but my guess it alt + c?  
> Not sure though.
>
> Thanks again, I am really impressed with you for actually 
> writing the basic concept of it for me!  I can diffidently use 
> this for my building block of learning how to program better!


Ok so I've found out how to compile using the DM D compiler via 
terminal...  I can't cd to my directory for whatever reason... so 
I'm running this:

[code]
dmd D:\Documents\Other\Hotkeys\D\Keybinds.d
[/code]
But it's spitting out errors left and right.  Here's what I get:


[code]
C:\Users\Casey>dmd D:\Documents\Other\Hotkeys\D\Keybinds.d
D:\Documents\Other\Hotkeys\D\Keybinds.d(11): Error: undefined 
identifier KEYEVEN
TF_UNICODE
D:\Documents\Other\Hotkeys\D\Keybinds.d(25): Error: module 
simpledisplay is in f
ile 'simpledisplay.d' which cannot be read
import path[0] = D:\Program Files (x86)\DM D Programming Language 
Compiler\D\dmd
2\windows\bin\..\..\src\phobos
import path[1] = D:\Program Files (x86)\DM D Programming Language 
Compiler\D\dmd
2\windows\bin\..\..\src\druntime\import

[/code]

It's basically telling me I need the two files you mentioned that 
are on your Github.  So I then went and got your two files, 
copied their stuff into their own folders, and tried to compile 
them.  Here's what I got:

[code]
C:\Users\Casey>dmd D:\Documents\Other\Hotkeys\D\simpledisplay.d
D:\Documents\Other\Hotkeys\D\simpledisplay.d(274): Error: module 
color is in fil
e 'arsd\color.d' which cannot be read
import path[0] = D:\Program Files (x86)\DM D Programming Language 
Compiler\D\dmd
2\windows\bin\..\..\src\phobos
import path[1] = D:\Program Files (x86)\DM D Programming Language 
Compiler\D\dmd
2\windows\bin\..\..\src\druntime\import


C:\Users\Casey>dmd D:\Documents\Other\Hotkeys\D\color.d
OPTLINK (R) for Win32  Release 8.00.15
Copyright (C) Digital Mars 1989-2013  All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
OPTLINK : Warning 23: No Stack
color.obj(color)
  Error 42: Symbol Undefined __fltused
color.obj(color)
  Error 42: Symbol Undefined __d_arraybounds
color.obj(color)
  Error 42: Symbol Undefined __memset80
color.obj(color)
  Error 42: Symbol Undefined __d_assert
color.obj(color)
  Error 42: Symbol Undefined __d_arraycatT
color.obj(color)
  Error 42: Symbol Undefined __d_throwc
color.obj(color)
  Error 42: Symbol Undefined 
_D6object9Exception6__ctorMFNaNbNfAyaAyakC6object9Th
rowableZC9Exception
color.obj(color)
  Error 42: Symbol Undefined __d_newclass
color.obj(color)
  Error 42: Symbol Undefined _D9Exception7__ClassZ
color.obj(color)
  Error 42: Symbol Undefined _D12TypeInfo_Aya6__initZ
color.obj(color)
  Error 42: Symbol Undefined __d_arrayappendcTX
color.obj(color)
  Error 42: Symbol Undefined _D14TypeInfo_Array6__vtblZ
color.obj(color)
  Error 42: Symbol Undefined __d_assert_msg
color.obj(color)
  Error 42: Symbol Undefined _D9invariant12_d_invariantFC6ObjectZv
color.obj(color)
  Error 42: Symbol Undefined _D11TypeInfo_Ah6__initZ
color.obj(color)
  Error 42: Symbol Undefined __d_newarrayT
color.obj(color)
  Error 42: Symbol Undefined __d_arraycast
color.obj(color)
  Error 42: Symbol Undefined _D15TypeInfo_Struct6__vtblZ
color.obj(color)
  Error 42: Symbol Undefined __d_arraycatnT
color.obj(color)
  Error 42: Symbol Undefined __d_arrayappendcd
color.obj(color)
  Error 42: Symbol Undefined _D11TypeInfo_Aa6__initZ
color.obj(color)
  Error 42: Symbol Undefined _D6object6Object8toStringMFZAya
color.obj(color)
  Error 42: Symbol Undefined _D6object6Object8opEqualsMFC6ObjectZb
color.obj(color)
  Error 42: Symbol Undefined _D6Object7__ClassZ
color.obj(color)
  Error 42: Symbol Undefined _D6object6Object6toHashMFNbNeZk
color.obj(color)
  Error 42: Symbol Undefined _D14TypeInfo_Class6__vtblZ
color.obj(color)
  Error 42: Symbol Undefined _D6object6Object5opCmpMFC6ObjectZi
color.obj(color)
  Error 42: Symbol Undefined _D3std9algorithm12__ModuleInfoZ
OPTLINK : Warning 134: No Start Address
--- errorlevel 28

[/code]

I'm not sure what this all means, but I'm sure I'm doing 
something wrong.  It doesn't spit out any files, and from what 
I've seen it's supposed to spit out 3 new ones.


More information about the Digitalmars-d-learn mailing list