Pascal Scripting with Inno Setup

Pascal Scripting with Inno Setup

Anonymous
Not applicable
1,246 Views
8 Replies
Message 1 of 9

Pascal Scripting with Inno Setup

Anonymous
Not applicable
In INNO setup I'd like to abort setup if AutoCAD is running. I would like to
use the function "FindWindowByWindowName(const WindowName: String):
Longint;" to determine whether AutoCAD is running in the InitializeSetup()
function. Does anyone know what window name to use for AutoCAD? Theres also
a FindWindowByClassName(const ClassName: String): Longint;" function if
anyone knows the class name.

Does anyone have any better suggestions?

Thanks,

D.M. Levesque
0 Likes
1,247 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
You don't have to go to that extents, not
to mention that it doesn't work reliably
since you can't count on exactly what the
AutoCAD window's caption might be.

You just need this:

uses
ComObj, ActiveX;

Function IsAutoCADRunning: Boolean;
begin
Result := True;
try
GetActiveOleObject('AutoCAD.Application');
except
Result := False;
end;
end;

--
http://www.acadxtabs.com


"Dale Levesque" wrote in message
news:B945D90D59C4344DDE818851539DEB13@in.WebX.maYIadrTaRb...
> In INNO setup I'd like to abort setup if AutoCAD is running. I would like to
> use the function "FindWindowByWindowName(const WindowName: String):
> Longint;" to determine whether AutoCAD is running in the InitializeSetup()
> function. Does anyone know what window name to use for AutoCAD? Theres also
> a FindWindowByClassName(const ClassName: String): Longint;" function if
> anyone knows the class name.
>
> Does anyone have any better suggestions?
>
> Thanks,
>
> D.M. Levesque
>
>
>
>
0 Likes
Message 3 of 9

Anonymous
Not applicable
On Fri, 22 Aug 2003 15:50:56 -0700, "Dale Levesque"
dynamicwindows.com> wrote:

>In INNO setup I'd like to abort setup if AutoCAD is running. I would like to
>use the function "FindWindowByWindowName(const WindowName: String):
>Longint;" to determine whether AutoCAD is running in the InitializeSetup()
>function. Does anyone know what window name to use for AutoCAD? Theres also
>a FindWindowByClassName(const ClassName: String): Longint;" function if
>anyone knows the class name.
>
>Does anyone have any better suggestions?
>
>Thanks,
>
>D.M. Levesque

You might want to try WinDowse from http://www.greatis.com/. It will
tell you the window name & class name of a running app, which you
should then be able to use in your code.

Ray Greene.
0 Likes
Message 4 of 9

Anonymous
Not applicable
You don't have to go to that extents, not
to mention that it doesn't work reliably
since you can't count on exactly what the
AutoCAD window's caption might be.

You just need this:

uses
ComObj, ActiveX;

Function IsAutoCADRunning: Boolean;
begin
Result := True;
try
GetActiveOleObject('AutoCAD.Application');
except
Result := False;
end;
end;

--
http://www.acadxtabs.com


"Dale Levesque" wrote in message
news:B945D90D59C4344DDE818851539DEB13@in.WebX.maYIadrTaRb...
> In INNO setup I'd like to abort setup if AutoCAD is running. I would like to
> use the function "FindWindowByWindowName(const WindowName: String):
> Longint;" to determine whether AutoCAD is running in the InitializeSetup()
> function. Does anyone know what window name to use for AutoCAD? Theres also
> a FindWindowByClassName(const ClassName: String): Longint;" function if
> anyone knows the class name.
>
> Does anyone have any better suggestions?
>
> Thanks,
>
> D.M. Levesque
>
>
>
>
0 Likes
Message 5 of 9

Anonymous
Not applicable
Thanks!

"Tony Tanzillo" wrote in message
news:9D8AE4534168A0240A8C0538F326608C@in.WebX.maYIadrTaRb...
> You don't have to go to that extents, not
> to mention that it doesn't work reliably
> since you can't count on exactly what the
> AutoCAD window's caption might be.
>
> You just need this:
>
> uses
> ComObj, ActiveX;
>
> Function IsAutoCADRunning: Boolean;
> begin
> Result := True;
> try
> GetActiveOleObject('AutoCAD.Application');
> except
> Result := False;
> end;
> end;
>
> --
> http://www.acadxtabs.com
>
>
> "Dale Levesque" wrote in message
> news:B945D90D59C4344DDE818851539DEB13@in.WebX.maYIadrTaRb...
> > In INNO setup I'd like to abort setup if AutoCAD is running. I would
like to
> > use the function "FindWindowByWindowName(const WindowName: String):
> > Longint;" to determine whether AutoCAD is running in the
InitializeSetup()
> > function. Does anyone know what window name to use for AutoCAD? Theres
also
> > a FindWindowByClassName(const ClassName: String): Longint;" function if
> > anyone knows the class name.
> >
> > Does anyone have any better suggestions?
> >
> > Thanks,
> >
> > D.M. Levesque
> >
> >
> >
> >
>
>
0 Likes
Message 6 of 9

Anonymous
Not applicable
Thanks again Tony but one question. I'm very new to Pascal scripting and I'm
unsure as to how to indicate that the function requires ComObj and ActiveX.

I tried pasting:

uses
ComObj, ActiveX;

just above the function but that didn't work.

Best regards,

Dale





"Tony Tanzillo" wrote in message
news:ECAF9CC8F8960FC74C6D3BB713523EDE@in.WebX.maYIadrTaRb...
> You don't have to go to that extents, not
> to mention that it doesn't work reliably
> since you can't count on exactly what the
> AutoCAD window's caption might be.
>
> You just need this:
>
> uses
> ComObj, ActiveX;
>
> Function IsAutoCADRunning: Boolean;
> begin
> Result := True;
> try
> GetActiveOleObject('AutoCAD.Application');
> except
> Result := False;
> end;
> end;
>
> --
> http://www.acadxtabs.com
>
>
> "Dale Levesque" wrote in message
> news:B945D90D59C4344DDE818851539DEB13@in.WebX.maYIadrTaRb...
> > In INNO setup I'd like to abort setup if AutoCAD is running. I would
like to
> > use the function "FindWindowByWindowName(const WindowName: String):
> > Longint;" to determine whether AutoCAD is running in the
InitializeSetup()
> > function. Does anyone know what window name to use for AutoCAD? Theres
also
> > a FindWindowByClassName(const ClassName: String): Longint;" function if
> > anyone knows the class name.
> >
> > Does anyone have any better suggestions?
> >
> > Thanks,
> >
> > D.M. Levesque
> >
> >
> >
> >
>
>
0 Likes
Message 7 of 9

Anonymous
Not applicable
Hi Tony,

Apparently Inno Setup does not allow the use of "uses" in it's [CODE]
section. Thanks anyway for the help.

Dale

"Tony Tanzillo" wrote in message
news:ECAF9CC8F8960FC74C6D3BB713523EDE@in.WebX.maYIadrTaRb...
> You don't have to go to that extents, not
> to mention that it doesn't work reliably
> since you can't count on exactly what the
> AutoCAD window's caption might be.
>
> You just need this:
>
> uses
> ComObj, ActiveX;
>
> Function IsAutoCADRunning: Boolean;
> begin
> Result := True;
> try
> GetActiveOleObject('AutoCAD.Application');
> except
> Result := False;
> end;
> end;
>
> --
> http://www.acadxtabs.com
>
>
> "Dale Levesque" wrote in message
> news:B945D90D59C4344DDE818851539DEB13@in.WebX.maYIadrTaRb...
> > In INNO setup I'd like to abort setup if AutoCAD is running. I would
like to
> > use the function "FindWindowByWindowName(const WindowName: String):
> > Longint;" to determine whether AutoCAD is running in the
InitializeSetup()
> > function. Does anyone know what window name to use for AutoCAD? Theres
also
> > a FindWindowByClassName(const ClassName: String): Longint;" function if
> > anyone knows the class name.
> >
> > Does anyone have any better suggestions?
> >
> > Thanks,
> >
> > D.M. Levesque
> >
> >
> >
> >
>
>
0 Likes
Message 8 of 9

Anonymous
Not applicable
Thanks Ray. That app seems to work fine but it's resulting class name
doesn't seem to work as far as my code goes.

Dale



"Ray Greene" wrote in message
news:6ohdkvgjeslumku3jogbbrgie8jdc90cs4@4ax.com...
> On Fri, 22 Aug 2003 15:50:56 -0700, "Dale Levesque"
> dynamicwindows.com> wrote:
>
> >In INNO setup I'd like to abort setup if AutoCAD is running. I would like
to
> >use the function "FindWindowByWindowName(const WindowName: String):
> >Longint;" to determine whether AutoCAD is running in the
InitializeSetup()
> >function. Does anyone know what window name to use for AutoCAD? Theres
also
> >a FindWindowByClassName(const ClassName: String): Longint;" function if
> >anyone knows the class name.
> >
> >Does anyone have any better suggestions?
> >
> >Thanks,
> >
> >D.M. Levesque
>
> You might want to try WinDowse from http://www.greatis.com/. It will
> tell you the window name & class name of a running app, which you
> should then be able to use in your code.
>
> Ray Greene.
0 Likes
Message 9 of 9

Anonymous
Not applicable
The Pascal script that's being used in Inno Setup 4 (which is
what I assume you're using) doesn't support ActiveX or 'uses",
so what I showed isn't going to work. I didn't even know that
version 4 had it, but it's still beta anyway.

--
http://www.acadxtabs.com


"Dale Levesque" wrote in message
news:5F6887F4F56BE15095D9AC7701ABEAB7@in.WebX.maYIadrTaRb...
> Hi Tony,
>
> Apparently Inno Setup does not allow the use of "uses" in it's [CODE]
> section. Thanks anyway for the help.
>
> Dale
>
> "Tony Tanzillo" wrote in message
> news:ECAF9CC8F8960FC74C6D3BB713523EDE@in.WebX.maYIadrTaRb...
> > You don't have to go to that extents, not
> > to mention that it doesn't work reliably
> > since you can't count on exactly what the
> > AutoCAD window's caption might be.
> >
> > You just need this:
> >
> > uses
> > ComObj, ActiveX;
> >
> > Function IsAutoCADRunning: Boolean;
> > begin
> > Result := True;
> > try
> > GetActiveOleObject('AutoCAD.Application');
> > except
> > Result := False;
> > end;
> > end;
> >
> > --
> > http://www.acadxtabs.com
> >
> >
> > "Dale Levesque" wrote in message
> > news:B945D90D59C4344DDE818851539DEB13@in.WebX.maYIadrTaRb...
> > > In INNO setup I'd like to abort setup if AutoCAD is running. I would
> like to
> > > use the function "FindWindowByWindowName(const WindowName: String):
> > > Longint;" to determine whether AutoCAD is running in the
> InitializeSetup()
> > > function. Does anyone know what window name to use for AutoCAD? Theres
> also
> > > a FindWindowByClassName(const ClassName: String): Longint;" function if
> > > anyone knows the class name.
> > >
> > > Does anyone have any better suggestions?
> > >
> > > Thanks,
> > >
> > > D.M. Levesque
> > >
> > >
> > >
> > >
> >
> >
>
>
0 Likes