dialog on top and list boxes

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

dialog on top and list boxes

Post by kpassaur » Fri Jan 19, 2007 10:17 am

I am trying to make a Dialog Box stay on top and I have found code in the forum that allows me to do this. I works great for typing in data or a couple buttons. However, I would like to use Combo Boxes in the Dialog box as well. I have tried adjusting the timer, but it never seems to work right. Does anyone know of a different way this can be done. The script is below that I currently use.

Code: Select all

Dialog>Dialog10
   Caption=Licensed to %Licensedto%
   Width=384
   Height=309
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=1
   Resize=0
   Edit=msEdit1,24,88,33,
   Edit=msEdit2,24,112,33,
   Edit=msEdit3,24,136,33,
   Edit=msEdit4,24,160,33,
   Edit=msEdit5,24,184,33,
   ComboBox=msComboBox1,88,88,97,%listvalue%
   ComboBox=msComboBox2,88,112,97,%listvalue%
   ComboBox=msComboBox3,88,136,97,%listvalue%
   ComboBox=msComboBox4,88,160,97,%listvalue%
   ComboBox=msComboBox5,88,184,97,%listvalue%
   Label=Extract Pages,12,64,true
   Label=Section Name,96,64,true
   Label=Format for Extract Pages:,224,88,true
   Label=To Extract pages 1 trrough 3,216,112,true
   Label=Enter 1-3 in Extract Pages Box,216,128,true
   Label=To Extract Pages 4 to the End,216,152,true
   Label=of the Document,216,168,true
   Label=Enter 4-L in Extract Pages Box,216,184,true
   Button=Continue,104,216,75,25,1
   Button=Exit,178,216,75,25,2
   Label=Copyright© eDocFile Inc. 2004-2007,88,248,true
   Image=C:\Point_PDF_Filer\images\Separatesections1.bmp,0,0,433,49
EndDialog>Dialog10

END>nochangesectionname


Show>Dialog10
Label>ExtractLoop
Let>HWND_TOPMOST=-1
Let>HWND_NOTOPMOST=-2
Let>SWP_NOSIZE=1
Let>SWP_NOMOVE=2
Let>SWP_NOACTIVATE=16
Let>SWP_SHOWWINDOW=64
LibFunc>user32,FindWindowA,dhwnd,TForm,Licensed to %Licensedto%
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags

  GetDialogAction>Dialog10,r
  If>r=1,Extractthepages
  If>r=2,EndofSub
  Wait>2
Goto>ExtractLoop

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Jan 19, 2007 2:37 pm

Keith,
I added some lines and remarked one line to make your submission run as a standalone. Look here for an explanation. This is a possible solution, there is no doubt, a better way to do it but this works.

Edit... Something happened to the script and some of it was missing. For some reason it still worked??? Its now fixed so perhaps it will now make sense.

Code: Select all

Let>listvalue=item1%CRLF%Item2%CRLF%item3
Let>Licensedto=Dick

Dialog>Dialog10
   Caption=Licensed to %Licensedto%
   Width=384
   Height=309
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=1
   Resize=0
   Edit=msEdit1,24,88,33,
   Edit=msEdit2,24,112,33,
   Edit=msEdit3,24,136,33,
   Edit=msEdit4,24,160,33,
   Edit=msEdit5,24,184,33,
   ComboBox=msComboBox1,88,88,97,%listvalue%
   ComboBox=msComboBox2,88,112,97,%listvalue%
   ComboBox=msComboBox3,88,136,97,%listvalue%
   ComboBox=msComboBox4,88,160,97,%listvalue%
   ComboBox=msComboBox5,88,184,97,%listvalue%
   Label=Extract Pages,12,64,true
   Label=Section Name,96,64,true
   Label=Format for Extract Pages:,224,88,true
   Label=To Extract pages 1 trrough 3,216,112,true
   Label=Enter 1-3 in Extract Pages Box,216,128,true
   Label=To Extract Pages 4 to the End,216,152,true
   Label=of the Document,216,168,true
   Label=Enter 4-L in Extract Pages Box,216,184,true
   Button=Continue,104,216,75,25,1
   Button=Exit,178,216,75,25,2
   Label=Copyright© eDocFile Inc. 2004-2007,88,248,true
   Image=C:\Point_PDF_Filer\images\Separatesections1.bmp,0,0,433,49
EndDialog>Dialog10

//END>nochangesectionname


Show>Dialog10

Let>HWND_TOPMOST=-1
Let>HWND_NOTOPMOST=-2
Let>SWP_NOSIZE=1
Let>SWP_NOMOVE=2
Let>SWP_NOACTIVATE=16
Let>SWP_SHOWWINDOW=64
LibFunc>user32,FindWindowA,dhwnd,TForm,Licensed to %Licensedto%
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags

Label>ExtractLoop
  GetDialogAction>Dialog10,r
  GetWindowPos>Licensed to %Licensedto%,wX,wY
  GetCursorPos>cX,cY
  Let>Xmin=%wX%+88
  Let>Xmax=%Xmin%+97
   If>{(%cX%>%Xmin%)and(%cX%<%Xmax%)}
    //do nothing
  Else
    WindowAction>0,Licensed to %Licensedto%
  EndIf
  If>r=1,Extractthepages
  If>r=2,EndofSub
  Wait>0.5
Goto>ExtractLoop

Label>EndofSub
Last edited by JRL on Sun Jan 21, 2007 1:39 am, edited 2 times in total.

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Combo Boxes on Dialog

Post by kpassaur » Sat Jan 20, 2007 10:41 am

JRL,

Thank you for your help. I have looked it over and, well it is above me, I would have never figured it out. This routine is used in quite a few instances in my Macro and the work to do it would be overwelming. Hopefully there will be an easier way in the future.

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Jan 22, 2007 2:17 pm

Keith,
Hopefully, the script posted above makes more sense now that Its been reposted with HTML turned off. Following is the same script with the cursor position analyzer portion broken out into a subroutine. All you need to do is place the "winaction" subroutine into any script then call it using the correct parameters.

GoSub>winaction,[Window Name],[ComboBox X Position],[ComboBox Width]
In your example that would be

GoSub>winaction,Licensed to %Licensedto%,88,97

Your script would look like this:

Code: Select all

Let>listvalue=item1%CRLF%Item2%CRLF%item3
Let>Licensedto=Dick

Dialog>Dialog10
   Caption=Licensed to %Licensedto%
   Width=384
   Height=309
   Top=CENTER
   Left=CENTER
   Max=0
   Min=0
   Close=1
   Resize=0
   Edit=msEdit1,24,88,33,
   Edit=msEdit2,24,112,33,
   Edit=msEdit3,24,136,33,
   Edit=msEdit4,24,160,33,
   Edit=msEdit5,24,184,33,
   ComboBox=msComboBox1,88,88,97,%listvalue%
   ComboBox=msComboBox2,88,112,97,%listvalue%
   ComboBox=msComboBox3,88,136,97,%listvalue%
   ComboBox=msComboBox4,88,160,97,%listvalue%
   ComboBox=msComboBox5,88,184,97,%listvalue%
   Label=Extract Pages,12,64,true
   Label=Section Name,96,64,true
   Label=Format for Extract Pages:,224,88,true
   Label=To Extract pages 1 trrough 3,216,112,true
   Label=Enter 1-3 in Extract Pages Box,216,128,true
   Label=To Extract Pages 4 to the End,216,152,true
   Label=of the Document,216,168,true
   Label=Enter 4-L in Extract Pages Box,216,184,true
   Button=Continue,104,216,75,25,1
   Button=Exit,178,216,75,25,2
   Label=Copyright© eDocFile Inc. 2004-2007,88,248,true
   Image=C:\Point_PDF_Filer\images\Separatesections1.bmp,0,0,433,49
EndDialog>Dialog10

//END>nochangesectionname


Show>Dialog10

Let>HWND_TOPMOST=-1
Let>HWND_NOTOPMOST=-2
Let>SWP_NOSIZE=1
Let>SWP_NOMOVE=2
Let>SWP_NOACTIVATE=16
Let>SWP_SHOWWINDOW=64
LibFunc>user32,FindWindowA,dhwnd,TForm,Licensed to %Licensedto%
Let>Flags={%SWP_NOACTIVATE% Or %SWP_SHOWWINDOW% Or %SWP_NOMOVE% Or %SWP_NOSIZE%}
LibFunc>User32,SetWindowPos,swpr,dhwnd,HWND_TOPMOST,0,0,0,0,Flags

Label>ExtractLoop
  GetDialogAction>Dialog10,r
  //GoSub>winaction,[Window Name],[ComboBox X Position],[ComboBox Width]
  GoSub>winaction,Licensed to %Licensedto%,88,97
  If>r=1,Extractthepages
  If>r=2,EndofSub
  Wait>0.1
Goto>ExtractLoop

Label>EndofSub


SRT>winaction
  GetWindowPos>%winaction_var_1%,wX,wY
  GetCursorPos>cX,cY
  Let>Xmin=%wX%+%winaction_var_2%
  Let>Xmax=%Xmin%+%winaction_var_3%
  If>{(%cX%>%Xmin%)and(%cX%<%Xmax%)}
    do nothing
  Else
    WindowAction>0,Licensed to %Licensedto%
  EndIf
END>winaction

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts