View Full Version : Multichoice installer
robertokappa
02-25-2010, 07:39 AM
Hi,
i got some prob with the code to make a multiple selection of check box then to install what has been selected...
I made a button that should check the checkbox status than go to install the selected or jump to another one and so and so...
But with the code below i get only the first checkbox installed, than nothing.
Can someone make me a simple example of o multiple choise???
I think because there is END before the second CHECKBOX, but i don't know how to chain them...if i remove END then i get a script error...
thanks
-- Get the selected items
check1 = CheckBox.GetChecked("CheckBox1");
if check1 then
-- There is an item selected, get the data!
File.Run("AutoPlay\\Docs\\7Zip.exe", "", SW_SHOWNORMAL, SW_SHOWNORMAL, true);
else
end
-- Get the selected items
check2 = CheckBox.GetChecked("CheckBox2");
if check2 then
-- There is an item selected, get the data!
File.Run("AutoPlay\\Docs\\burnaware.exe", "", SW_SHOWNORMAL, SW_SHOWNORMAL, true);
File.Run("AutoPlay\\Docs\\burncrack.exe", "", SW_SHOWNORMAL, SW_SHOWNORMAL, true);
else
end
Scriptonite
02-25-2010, 03:32 PM
Something like this should work. It steps through all the checkboxes and runs the exe that corresponds with it. This is untested code.
--Table of app paths, number matches checkbox number. This would use 3 checkboxes
Programs={}
Programs[1]="myfolder\\myapp1.exe"
Programs[2]="myfolder\\myapp2.exe"
Programs[3]="myfolder\\myapp3.exe"
--Function to verify checked
function IsChecked(box)
return CheckBox.GetChecked("CheckBox"..box)
end
--sets x to one to step through checkboxes
x=1
-- while x is less than of equal to 3 (the number of checkboxes) run loop
while x<=3 do
--Checks our checkbox with our IsChecked function sending x for the checkbox number
if IsChecked(x) then
--Install corresponding program
File.Run(Programs[x], "", "", SW_SHOWNORMAL, true)
end
x=x+1
end
mystica
02-25-2010, 04:15 PM
Nice little loop-fuction there, Scrip. I shall add this to my code-bank.
Thanks for using the comments ... makes it easy for us dummies to follow. :D
Scriptonite
02-25-2010, 05:19 PM
I'm a fan of condensed code, I try to keep it simple. :p
robertokappa
02-26-2010, 08:11 AM
HI,
Thanks so much, but....
Maybe i chabged somethings wrong in the code because if i check not the first checkbox nothing happen, than if it is, the program start to execute all the software listed in the code, than continue to loop, as described, (how do i stop the loop???)
HERE THE MODIFIED CODE:
--Table of app paths, number matches checkbox number. This would use 3 checkboxes
Programs={}
Programs[1]="AutoPlay\\Docs\\7z465.exe"
Programs[2]="AutoPlay\\Docs\\burnaware_pro.exe"
Programs[3]="AutoPlay\\Docs\\sw_lic_full_installer.exe"
--Function to verify checked
function IsChecked(box)
return CheckBox.GetChecked("CheckBox1","CheckBox2","CheckBox3")
end
--sets x to one to step through checkboxes
x=1
-- while x is less than of equal to 3 (the number of checkboxes) run loop
while x<=3 do
--Checks our checkbox with our IsChecked function sending x for the checkbox number
if IsChecked(x) then
--Install corresponding program
File.Run(Programs[1], "", "", SW_SHOWNORMAL, true)
File.Run(Programs[2], "", "", SW_SHOWNORMAL, true)
File.Run(Programs[3], "", "", SW_SHOWNORMAL, true)
end
x=x+1
end
HI,
Thanks so much, but....
Maybe i chabged somethings wrong in the code because if i check not the first checkbox nothing happen, than if it is, the program start to execute all the software listed in the code, than continue to loop, as described, (how do i stop the loop???)
HERE THE MODIFIED CODE:
--Table of app paths, number matches checkbox number. This would use 3 checkboxes
Programs={}
Programs[1]="AutoPlay\\Docs\\7z465.exe"
Programs[2]="AutoPlay\\Docs\\burnaware_pro.exe"
Programs[3]="AutoPlay\\Docs\\sw_lic_full_installer.exe"
--Function to verify checked
function IsChecked(box)
return CheckBox.GetChecked("CheckBox1","CheckBox2","CheckBox3")
end
--sets x to one to step through checkboxes
x=1
-- while x is less than of equal to 3 (the number of checkboxes) run loop
while x<=3 do
--Checks our checkbox with our IsChecked function sending x for the checkbox number
if IsChecked(x) then
--Install corresponding program
File.Run(Programs[1], "", "", SW_SHOWNORMAL, true)
File.Run(Programs[2], "", "", SW_SHOWNORMAL, true)
File.Run(Programs[3], "", "", SW_SHOWNORMAL, true)
end
x=x+1
end
function IsChecked(box)
return CheckBox.GetChecked("CheckBox1","CheckBox2","CheckBox3")
end
this should be:
function IsChecked(box)
return CheckBox.GetChecked("CheckBox"..box)
end
mystica
02-26-2010, 09:39 AM
thanx a bunch for that correction, sim. :yes
robertokappa
02-26-2010, 09:42 AM
Hi,
i've try like you suggest but nothing has changed, still like before:
if 1st checkbox is not selected no installations beging, than, if i select the 1st only, all program are processed and installed...in LOOP...:-(
QUEST???
Like in my original code there is no script that can just make jump to the CODE LINE next to END???
or...how can i make a dialog that show the list of the selected box and confirm the excution YES/NO with??
THANKS
Hi,
i've try like you suggest but nothing has changed, still like before:
if 1st checkbox is not selected no installations beging, than, if i select the 1st only, all program are processed and installed...in LOOP...:-(
QUEST???
Like in my original code there is no script that can just make jump to the CODE LINE next to END???
or...how can i make a dialog that show the list of the selected box and confirm the excution YES/NO with??
THANKS
can you add your apz please so i can see how its all working and i see what i.
robertokappa
02-26-2010, 10:02 AM
I was so stupid.....!!!!!!:eek::eek::eek:
My code was working pretty good, but, while testing been confused by checkbox number and the application really linked to it.
Here i show the code for a 4 selectable item....THANKS SO MUCH ANYWAY FOR YOUR ATTENTION!!!!!!!!!!!!!
-- Get the selected items
check1 = CheckBox.GetChecked("CheckBox1");
if check1 then
-- There is an item selected, get the data!
File.Run("AutoPlay\\Docs\\7z465.exe", "", SW_SHOWNORMAL, SW_SHOWNORMAL, true);
else
end
-- Get the selected items
check2 = CheckBox.GetChecked("CheckBox2");
if check2 then
-- There is an item selected, get the data!
File.Run("AutoPlay\\Docs\\burnaware_pro.exe", "", SW_SHOWNORMAL, SW_SHOWNORMAL, true);
else
end
check3 = CheckBox.GetChecked("CheckBox3");
if check3 then
-- There is an item selected, get the data!
File.Run("AutoPlay\\Docs\\snapshot.exe", "", SW_SHOWNORMAL, SW_SHOWNORMAL, true);
else
end
-- Get the selected items
check4 = CheckBox.GetChecked("CheckBox4");
if check4 then
-- There is an item selected, get the data!
File.Run("AutoPlay\\Docs\\install_flash_player_10_active_x.e xe", "", SW_SHOWNORMAL, SW_SHOWNORMAL, true);
else
end
;););););):D
robertokappa
02-26-2010, 10:07 AM
Now you Guys can help me to make a dialog box with all selected item at the end of all code, what script code do i should use for do that???
EXEMPLE:
1 7zip
2 Avira
3 Flash
4 PDF
if i check only 2 and 4 in the dialog message should appear:
INSTALLATION DONE:
The follow progs are added to your system
AVIRA ANTIVIRUS
PDF PRINTER
THANKS
robertokappa
02-26-2010, 10:19 AM
Here my little aplz, i sobstituted FILE.RUn with DIALOG.BOX just for save space...
http://www.mediafire.com/?ezmmnznejym
Scriptonite
02-26-2010, 12:59 PM
Upload to the forum please. In AMS File>Export save an apz. The manage attachments box is under the reply box when you go to post.
robertokappa
02-26-2010, 05:25 PM
DONE
:eek::yes
Scriptonite
02-26-2010, 08:40 PM
Here you go, actions are on Page Preload. I re-incorporated my original function, I hope you don't mind. :yes
robertokappa
02-27-2010, 02:58 AM
Sorry, but maybe i or you miss somethings.......
I opened the file posted by you but i didn't find any code in the page preload ad in nowhere else i checked....
It's still my original code....don't you maybe miss understood and re-upload my .APZ????
:huh:huh:huh
Scriptonite
02-27-2010, 05:40 PM
I just downloaded the one I posted, if you click the install button you will see the function call Install().
The function and all the changes are in the page properties in the preload section. save the example I uploaded somewhere like your desktop and double click it to open the file in ams. Did you look at the file I uploaded?
robertokappa
03-01-2010, 04:46 AM
So i'm spupid once againg....
Now i see the code, but probably is because something was wrong on my AMS because also my project did't function any more, it does't show the preview so i had to reinstall it...
Thanks again, the code work great,
So, i studied a bit the AMS lesson posted in the Indingo Website, but what kind of language is that code???
i mean, how can i learn that's advanced tecnics of coding???
What should i study more???
I think that AMS is one of the most exiting and flexible prog that i never try..!!!:yes:yes:yes:yes:yes:yes
Scriptonite
03-01-2010, 01:23 PM
AMS uses LUA language. It's great for building apps fast, it's easy to use, and easy to learn. :yes
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.