Reset Dialog Action and Combo box working with wrong box

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

Reset Dialog Action and Combo box working with wrong box

Post by kpassaur » Mon Mar 26, 2007 12:19 pm

I'm stumped on this one. As you will notice below from all the different things I have tried. (and there are many more). What is happening is that when I reset my mscombox1 it dosn't reset even thought I have the propper syntax. Howver, if I reset it with mscombox2 it works and there is no mscombox2.

I could live with that as it works, however, that deals with when the user presses the open button. When they press the save button I cannot get it to refresh the list.

I am sure there are many errors in this script now, but I cannot contiune until I address this one.

Thanks for any help.

Code: Select all




ReadIniFile>C:\Point_PDF_Filer\Filer.ini,Settings,ListSectionPath,ListPath
ReadIniFile>%ListPath%\Filer.ini,Settings,ProfilePath,PPath
Deletefile>C:\Point_PDF_Filer\templist.txt
Let>Variablelist=C:\Point_PDF_Filer\templist.txt

Let>Staticlist=%ListPath%\docTypes.txt
Let>Profilelist=
Let>NewProfileName=
Let>Variablelisttxt=

Gosub>Sub1
GoSub>ReadProfileSectionNames
Goto>BeginMenu

//iffileexists>C:\Point_PDF_Filer\CDfilelist.txt
Gosub>Sub2
Gosub>ReadProfileSectionNames
Else
Let>Variablelisttxt=
//Endif


SRT>Sub1
Let>list1=
Let>Staticlisttxt=
Let>k=1
Label>start1
ReadLn>%Staticlist%,k,list1
If>list1=##EOF##,finish1
ConCat>%list1%,%CRLF%
Let>Staticlisttxt=%Staticlisttxt%%list1%
Let>k=k+1
Goto>start1
Label>finish1
END>Sub1


SRT>Sub2
Let>z=1
Let>Variablelisttxt=
Label>start2
ReadLn>%Variablelist%,z,list2
If>list2=##EOF##,finish2
If>list2=,Blank2
ConCat>%list2%,%CRLF%
Let>Variablelisttxt=%Variablelisttxt%%list2%
Label>Blank2
Let>z=z+1
Goto>start2
Label>finish2
END>Sub2

SRT>ReadProfileSectionNames
GetFileList>%PPath%\*.pro,profiles
Separate>profiles,;,file_names
Let>numbprofiles=%file_names_count%
If>%numbprofiles%>0,Profilesexist
Let>Profilelist=
Goto>haveprofiles
Label>Profilesexist
////////////////////////////
Let>Profilelist=%CRLF%
GetFileList>%PPath%\*.pro,profiles
Separate>profiles,;,profile_names
 Let>p=0
Repeat>p

               Let>p=p+1

               Let>Profilecount=profile_names_%p%
			   StringReplace>%Profilecount%,.pro,,extstriped
			   StringReplace>%extstriped%,%PPath%\,,Cleanname
			   Concat>Cleanname,%CRLF%
			   Let>Profilelist=%Profilelist%%Cleanname%
			   If>%Profilelist%=%Dialog1.msComboBox1%
			   let>indexpos=p
			   Endif

Until>p,profile_names_count
Label>haveprofiles
END>ReadProfileSectionNames

Label>BeginMenu


Dialog>Dialog1
   Caption=Select Sections
   Width=347
   Height=461
   Top=127
   Left=499
   ListBox=msListBox1,22,69,121,185,%Staticlisttxt%
   ListBox=msListBox2,198,69,121,185,%Variablelisttxt%
   Button=Exit,240,368,75,25,2
   Button=>,150,101,41,25,1
   Button=<150>Dialog1



Show>Dialog1
Label>Dialog1loop
GetDialogAction>Dialog1,result
If>result=2,Donewithit
If>result=1,Addtolist
If>result=3,removefromlist
If>result=4,moveonup
If>result=5,moveondown
If>result=7,saveas
If>result=8,OpenProfile
If>result=10,EOF
Goto>Dialog1loop


SRT>saveas
Iffileexists>%PPath%\%Dialog1.msEdit1%.pro
Let>displayname=%Dialog1.msEdit1%
Ask>The Profile %displayname% already exists - Overwrite?,overwrite
if>%overwrite%=YES
DeleteFile>%PPath%\%Dialog1.msEdit1%.pro
Endif
Endif
WriteLn>%PPath%\%Dialog1.msEdit1%.pro,result,%Variablelisttxt%
CopyFile>C:\Point_PDF_Filer\templist.txt,%PPath%\%Dialog1.msEdit1%.pro
MDL>Profile Saved

GoSub>Sub2
GoSub>ReadProfileSectionNames
MDL>%Profilelist%
//Let>Dialog1.msEdit1=%Dialog1.msComboBox1%
//Let>NewProfileName=%Staticlisttxt%
//Let>Dialog1.msListBox1.Items.Text=Staticlisttxt
Let>Dialog1.msListBox2.Items.Text=Variablelisttxt
//Let>Dialog1.msListBox2.Items.Text=
Let>Variablelist=%PPath%\%Dialog1.msComboBox1%.pro
//Let>Dialog1.msComboBox2=%Profilelist%
//Let>Dialog1.msComboBox1.text=%Profilelist%
Let>Dialog1.msComboBox2.ItemIndex=%indexpos%
Let>Dialog1.msEdit1=%Dialog1.msEdit1%

ResetDialogAction>Dialog1
//Endif

END>saveas

SRT>OpenProfile
Let>Dialog1.msListBox1.Items.Text=Staticlisttxt
Let>Variablelist=%PPath%\%Dialog1.msComboBox1%.pro
GoSub>Sub2
GoSub>ReadProfileSectionNames
Let>Dialog1.msEdit1=%Dialog1.msComboBox1%
Let>Dialog1.msListBox1.Items.Text=Staticlisttxt
Let>Dialog1.msListBox2.Items.Text=Variablelisttxt
Let>Dialog1.msComboBox1.ITEMS.TEXT=%Profilelist%

/////////////////--------------------------------------------------------------------------- This line should be with ComboBox 1

Let>Dialog1.msComboBox2.ITEMINDEX=%indexpos%
/////////////////--------------------------------------------------------------------------- But it works with 2
ResetDialogAction>Dialog1
//Endif
END>OpenProfile

SRT>Addtolist
WriteLn>%Variablelist%,result,%Dialog1.msListBox1%
GoSub>Sub2
//MDL>%Variablelisttxt%
Let>Dialog1.msListBox1.Items.Text=Staticlisttxt
Let>Dialog1.msListBox2.Items.Text=Variablelisttxt
ResetDialogAction>Dialog1
END>Addtolist

SRT>removefromlist
DeleteFile>C:\Point_PDF_Filer\templist.txt
CopyFile>%Variablelist%,C:\Point_PDF_Filer\templist.txt
DeleteFile>%Variablelist%

Let>w=1
Label>wstart
ReadLn>C:\Point_PDF_Filer\templist.txt,w,wline
If>wline=##EOF##,wfinish
If>wline=%Dialog1.msListBox2%,skipthislinew
WriteLn>%Variablelist%,result,%wline%
Label>skipthislinew
Let>w=w+1
Goto>wstart
Label>wfinish
GoSub>Sub2
Let>Dialog1.msListBox1.Items.Text=Staticlisttxt
Let>Dialog1.msListBox2.Items.Text=Variablelisttxt
ResetDialogAction>Dialog1
END>removefromlist


SRT>Donewithit
CloseDialog>Dialog1
Let>result=10
END>Donewithit





///////////////////////////////////////////========================Beginning of Up Sub
SRT>moveonup
GoSub>getorder

If>x=1,nochange
Sub>x,1
DeleteFile>C:\Point_PDF_Filer\templist.txt
CopyFile>%Variablelist%,C:\Point_PDF_Filer\templist.txt
DeleteFile>%Variablelist%
Let>u=1
Label>ustart
Let>moved=NO
ReadLn>C:\Point_PDF_Filer\templist.txt,u,uline
If>uline=##EOF##,ufinish
If>u=x,changeordersub
If>%moved%=YES,skipthislineu
WriteLn>%Variablelist%,result,%uline%
Label>skipthislineu
Let>u=u+1
Goto>ustart
Label>ufinish
GoSub>Sub2
Let>Dialog1.msListBox1.Items.Text=Staticlisttxt
Let>Dialog1.msListBox2.Items.Text=Variablelisttxt
ResetDialogAction>Dialog1
      SRT>changeordersub
      ADD>u,1
      ReadLn>C:\Point_PDF_Filer\templist.txt,u,uline
      WriteLn>%Variablelist%,result,%uline%
      Sub>u,1
      ReadLn>C:\Point_PDF_Filer\templist.txt,u,uline
      WriteLn>%Variablelist%,result,%uline%
      Let>moved=YES
      ADD>u,1
      END>changeordersub
Label>nochange
End>moveonup
///////////////////////////////////////////========================End of Up Sub
SRT>moveondown
GoSub>getorder
ADD>x,1
If>x=o,nochangedown
Sub>x,1
//MDL>%x% %o%
//Goto>EOF

DeleteFile>C:\Point_PDF_Filer\templist.txt
CopyFile>%Variablelist%,C:\Point_PDF_Filer\templist.txt
DeleteFile>%Variablelist%
Let>d=1
Label>dstart
Let>moved=NO
ReadLn>C:\Point_PDF_Filer\templist.txt,d,dline
If>dline=##EOF##,dfinish
If>d=x,changeordersubd
If>%moved%=YES,skipthislined
WriteLn>%Variablelist%,result,%dline%
Label>skipthislined
Let>d=d+1
Goto>dstart
Label>dfinish

GoSub>Sub2
Let>Dialog1.msListBox1.Items.Text=Staticlisttxt
Let>Dialog1.msListBox2.Items.Text=Variablelisttxt
ResetDialogAction>Dialog1
    
	
	  SRT>changeordersubd
      Add>d,1
      ReadLn>C:\Point_PDF_Filer\templist.txt,d,dline
      WriteLn>%Variablelist%,result,%dline%
      Sub>d,1
      ReadLn>C:\Point_PDF_Filer\templist.txt,d,dline
      WriteLn>%Variablelist%,result,%dline%
      Let>moved=YES
      ADD>d,1
      END>changeordersubd
Label>nochangedown
End>moveondown



SRT>getorder
Let>selected=%Dialog1.msListBox2%
Gosub>Sub2
Separate>%Variablelisttxt%,%CRLF%,Orderoflist
If>Orderoflist_count=0,endoforder
Let>o=0
Repeat>o
               Let>o=o+1
			   If>Orderoflist_%o%=%Selected%
			   Let>x=o
               Endif
Until>o,Orderoflist_count
Label>endoforder
END>getorder

Label>EOF


User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Mon Mar 26, 2007 2:39 pm

Ok, I haven't read the ENTIRE script, but I get the idea. There is no EndDialog> at the end of Dialog1.

not saying that fixes anything, but I can say you will not get the expected results without it.

I'll continue looking at the code....

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

It must not have pasted the bottom of the Dialog

Post by kpassaur » Mon Mar 26, 2007 2:49 pm

Here is the dialog box - I used CTRL +A and CRTL + C to copy and paste I don't know why it was missing.

Code: Select all

Dialog>Dialog1
   Caption=Select Sections
   Width=347
   Height=461
   Top=127
   Left=499
   ListBox=msListBox1,22,69,121,185,%Staticlisttxt%
   ListBox=msListBox2,198,69,121,185,%Variablelisttxt%
   Button=Exit,240,368,75,25,2
   Button=>,150,101,41,25,1
   Button=<150>Dialog1



User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Mar 26, 2007 10:38 pm

pgriffin was pointing out that a line was missing at the end of the Dialog.

You need to insert this as the end, before the Show>Dialog1

Code: Select all

EndDialog>Dialog1
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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

End Dialog is not the issue

Post by kpassaur » Tue Mar 27, 2007 8:26 am

The EndDialog> Dialog1 is there I just do not understand why it is not pasting to this board. I used the code button above. This time I will paste it to notepad first and see if that will do it.

Dialog>Dialog1
Caption=Select Sections
Width=347
Height=461
Top=127
Left=499
ListBox=msListBox1,22,69,121,185,%Staticlisttxt%
ListBox=msListBox2,198,69,121,185,%Variablelisttxt%
Button=Exit,240,368,75,25,2
Button=>,150,101,41,25,1
Button=Dialog1

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Mar 27, 2007 8:37 am

If you get problems with pasting, try checking the "Disable HTML in this post" and "Disable Smilies in this post" boxes when you post, as these can interpret some code as html/board smilies.

Anyway, regarding your problem - combobox2 doesn't exist. But if setting that causes combobox1 to change this suggests a dodgy variable assigment which has caused Dialog1.msComboBox2 to equal Dialog1.msComboBox2 - or something like that. When stepping through with the debugger do you see a variable called Dialog1.msComboBox2 appear at any point? That's the first thing I would look for, and find out when that happens. Bottom line - step through with the debugger. Otherwise, looking at all your code here, we're trying to find a needle in a haystack.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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

Combo box in dialog with two reset dialog actions

Post by kpassaur » Tue Mar 27, 2007 5:34 pm

Make a few changes and it was difficult to determine why it would not work as I placed a message box before the update and it correctly showed the list and the position. But, when I added another ResetDialogAction it worked. Perhaps what it was doing (and I am not sure) was the last command first? In other words it was updating the postion but with the old list. Since it was using the old list the new value would not be there and it would be blank. This appears to have fixed it.

MDL>Index Positon = %indexpos%%CRLF%%Profilelist%
Let>Dialog1.msComboBox1.ITEMS.text=%Profilelist%
ResetDialogAction>Dialog1
Let>Dialog1.msComboBox1.ItemIndex=%indexpos%
Let>Dialog1.msEdit1=%Dialog1.msEdit1%
ResetDialogAction>Dialog1

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