Winbatch Studio

Started by siocnarf, November 24, 2016, 12:25:18 PM

Previous topic - Next topic

siocnarf

Hi,

It was a long time since I worked with Winbatch. I am trying to do something simple... I hope.

MyDialogFormat=`WWWDLGED,6.2`

MyDialogCaption=`WIL Dialog 1`
MyDialogX=045
MyDialogY=103
MyDialogWidth=374
MyDialogHeight=144
MyDialogNumControls=002
MyDialogProcedure=`DEFAULT`
MyDialogFont=`DEFAULT`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,0|128|255`
MyDialogConfig=0

MyDialog001=`147,111,064,024,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,@csDefButton,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`095,027,166,042,STATICTEXT,"StaticText_1",DEFAULT,"Une intervention est complétée",DEFAULT,20,@csCenter,"Microsoft Sans Serif|9728|70|34",DEFAULT,DEFAULT`

ButtonPushed=Dialog("MyDialog")



1. What I want is saving as test.exe and running it test.exe Windowtitle texttodisplay. So there would be 2 parameters Windowtitle texttodisplay
But how coding those parameters Inside the script to being able to use it?
Update: I found Param1, Param2 will be solving the situation. However Param0 seems to not get the first variable. Only Param1,2,3...

2. When the dialogue box is up, is it a way to force it to remain in front so no one would be able to click on anything making this window to be behind all programs.

Thanks,

François

JTaylor

param0 gives you the number of parameters passed.

Take a look at WindowOnTop()

Jim

siocnarf

Hi,

I tested this:

MyDialogFormat=`WWWDLGED,6.2`
Titre=Param1
WindowOnTop(Titre,1)

MyDialogCaption=Param1
MyDialogX=002
MyDialogY=060
MyDialogWidth=438
MyDialogHeight=136
MyDialogNumControls=004
MyDialogProcedure=`DEFAULT`
MyDialogFont=`Microsoft Sans Serif|9728|70|34`
MyDialogTextColor=`DEFAULT`
MyDialogBackground=`DEFAULT,255|255|255`
MyDialogConfig=0

MyDialog001=`193,117,036,012,PUSHBUTTON,"PushButton_OK",DEFAULT,"OK",1,10,@csDefButton,DEFAULT,DEFAULT,DEFAULT`
MyDialog002=`003,009,414,060,STATICTEXT,"StaticText_2",DEFAULT,%Param2%,DEFAULT,30,DEFAULT,"Microsoft Sans Serif|8192|70|34",DEFAULT,"255|255|255"`
MyDialog003=`005,101,410,012,STATICTEXT,"StaticText_4",DEFAULT,"________________________________________________________________________________________",DEFAULT,40,DEFAULT,DEFAULT,DEFAULT,DEFAULT`
MyDialog004=`077,077,278,024,STATICTEXT,"StaticText_5",DEFAULT,%Param3%,DEFAULT,50,@csCenter,"Microsoft Sans Serif|8192|70|34","255|0|0","255|255|255"`

ButtonPushed=Dialog("MyDialog")



Not sure to understand. I tried Windowontop with an error IntControl not found.

I tried IntControl(54,"",1,0,0), sound it is working on Windows 81 64 bit.
What is the difference between Windowontop and the Int?

Thanks,

François

td

WinBatch doesn't have an error message 'IntControl not found' so I am not sure which error you are receiving.  Maybe it was 'IntControl: Window not found' or something.  The IntControl and the WindowOnTop function use the same internal DLL function so they are almost functionally identical.  WindowOnTop does allow an additional, optional third parameter that will cause the function to perform multiple retries while attempting to locate a window.  The IntControl does not support this feature for backwards compatibility reasons.   When you call WindowOnTop without the optional parameter, WindowOnTop and the IntControl should be identical.  If you are getting the 'Window not found' error let us know and we will look into it some more.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

siocnarf

Hi,

I had hard time figuring how making windowontop working. This is why I end using intcontrol.

Thanks,


snowsnowsnow

The problem here is that WinBatch is single tasking, and you are trying to modify a window that doesn't exist until you do:

ButtonPushed = Dialog(...)

Once you are in the Dialog() function, you need some way to get outside of it and execute the WindowOnTop functionality - on a window that only exists while you are in the Dialog() function.

The solution is to run a secondary script.  The secondary script can apply the "on top" attribute to the window created by the Dialog() function.  The details of how to do this are somewhat complicated, but once you get used to it (as I have, as I do it frequently in my programs), it becomes easy.

Write back if you want me to post the details.

siocnarf

Hi,

But why putting this line at the top of my script will be working? IntControl(54,"",1,0,0)

Thanks,


td

 WindowOnTop("",1)  or  IntControl(54,"",1,0,0) works when called at the top of your script because the WinBatch main window is created before the first line of your script is executed and the 'Top Most' windows style is applied to that window when you call either at the top of your script.  The dialog window is owned by the WinBatch main window so it inherits the 'Top Most' window style from the WinBatch main window.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade