Jump to content
Sign in to follow this  
Champak

Windows Status Variable

Recommended Posts

Champak

I did not do a search for this because I suspect the results would be overwhelming. Anyway, is it possible in anyway to have the Windows activity as a variable. It seems the regular way doesn't work.

Ex. $WinExists = IniRead(....)

Why? Because I have an option in my app that allows the user to choose if they want certain functions to work while the window is active or while generally exists....this is pertinent and useful to this particular app.

Thanks.

Share this post


Link to post
Share on other sites
martin

I did not do a search for this because I suspect the results would be overwhelming. Anyway, is it possible in anyway to have the Windows activity as a variable. It seems the regular way doesn't work.

Ex. $WinExists = IniRead(....)

Why? Because I have an option in my app that allows the user to choose if they want certain functions to work while the window is active or while generally exists....this is pertinent and useful to this particular app.

Thanks.

I'm not sure I understand what you want to do. If you want to find the state of a window then you can do something like

$wstate = WinGetState($gui1)
if @error = 0 then
  $wexists =  BitAnd($wstate,1) = 1
  $Wvisible =  BitAnd($wstate,2) = 2
  $wenabled = BitAnd($wstate,4) = 4
.
.
endif

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites
Champak

I'm 3/4 asleep right now so I don't know if you showed me exactly what I need, so let me try to explain it a little clearer. My GUI gives someone the option of setting how it detects a certain applications window...whether it is WinActive or WinExists---this is saved in an ini file. When they run the GUI, it reads the ini file for WinExists or WinActive which should look like this:

If $winactivity("application") then
.....
EndIf

But I get some type of error saying I can't have that as a variable. Is there some other way I can do this, or is what you showed me what I need to do?....it doesn't seem like it.

Thanks

Edited by Champak

Share this post


Link to post
Share on other sites
Xandl

Hello,

I think $winactivity("application") should be winactivity("application").

Something starting with $ will be interpreted as variable, not as function call.

ciao

Xandl

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

you can use Execute like

Execute("MsgBox('64', 'Titel', 'Text', 3)")

or tanslate the vaule and do If then else in the code.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
Champak

@Xandl

How I have it is the right way I need it.

Xenobiologist

I don't think "Execute" will work (I've never used that before note) because the "IF" function is going to be around 15 lines, not 1.

I also have never done this "translate" you are talking about. How do I translate a variable? And why would I need to do that anyway (besides this instance here)? I thought a variable is read like the actual word or whatever was there.

Share this post


Link to post
Share on other sites
Champak

The error I'm getting is when I execute the application after the script is compiled...so the program will work except when I call this function. the error is an AutoIt error:

L -:

Error: Error in expression

Share this post


Link to post
Share on other sites
Xenobiologist

Hi,

can you show a little example, please.

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
Champak

Hi, there is nothing major in the code, it is simply as follows:

$winactivity = "WinExists";This var is changed in the settings by the user to different detection schemes.
If $winactivity("Microsoft") Then
    MsgBox(0,1,1)
EndIf

That throws an expression error.

Thanks

Share this post


Link to post
Share on other sites
Champak

Last call...Anyone????????????????????????/

Share this post


Link to post
Share on other sites
Bowmore

Hi, there is nothing major in the code, it is simply as follows:

$winactivity = "WinExists";This var is changed in the settings by the user to different detection schemes.
If $winactivity("Microsoft") Then
    MsgBox(0,1,1)
EndIfoÝ÷ Ù8Z¶Øk£ìi­ë,Þ®º+N§Ïêº^
§ì¨º·(uëhjëh×6$winactivity = "WinExists";This var is changed in the settings by the user to different detection schemes.
If $winactivity = "Microsoft" Then
    MsgBox(0,1,1)
EndIf

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites
Champak

That's brilliant. You have to be a certified genius to post such an asinine and useless response.

Share this post


Link to post
Share on other sites
evilertoaster

hum well still not to clear on what you're trying to do.

This will read a command from an .ini file and run whichever one is specified. The syntax will only work for things like WinActive, or WinExists which have 1 argument.

$WinStatus=IniRead(@ScriptDir&"\config.ini","Settings","WindowsState","WinActive")
$result=Execute($WinStatus&"('Microsoft')")
MsgBox(0,"Return value",$result)
Edited by evilertoaster

Share this post


Link to post
Share on other sites
Champak

This does pretty much what I wanted. The only thing is I have to change the "IF" to look for a "1" or a "0". I never came across that "Execute" function before...at first I was wondering what the hell this code was suppose to do.

Thanks.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.