PDA

View Full Version : IF else statement


synistics
04-21-2007, 04:22 AM
IF else I do not work this out the wife is going to come in here and brain me. 3 am and still pounding away

I have an if statement that I have had as an if..then..else, now as an if..then
neither way is working

-----one way-----
ndata = ComboBox.GetItemData("FileType","",nil);






if ndata == "1"
then
ForMP3 ()
end

if ndata == "2"
then
ForWAV ()
end

if ndata == "3"
then
ForM3U ()
end

if ndata == "4"
then
ForPLS ()
end
------other way------

ndata = ComboBox.GetItemData("FileType","",nil);






if ndata == "1"
then
ForMP3 ()
else

if ndata == "2"
then
ForWAV ()
else

if ndata == "3"
then
ForM3U ()
else

if ndata == "4"
then
ForPLS ()
end
end
end
end

Both are only seeing the first function and not moving on to the other selections in the combobox.

Thanks

synistics
04-21-2007, 05:39 AM
ndata = ComboBox.GetText("FileType");

if (ndata == "*.mp3") then ForMP3();

elseif (ndata == "*.wav") then ForWAV();

elseif (ndata == "*.m3u") then ForM3U();

elseif (ndata == "*.pls") then ForPLS();
end

wasim21k
04-21-2007, 12:30 PM
hi tried all ways but i came with this idea and i think you dont have to use so many if as i did :D
if e_Key == 13 then

fname = Input.GetText("Input1");
if fname == "" then
Dialog.Message ("Error", "Please enter Staff ID", MB_OK, MB_OK, MB_ICONEXCLAMATION)
return
end
drive = "\\\\fc1\\users\\";
folder = fname;
search_results = Folder.Find(drive, folder, false, nil);

if (search_results == nil) then
fname = Input.GetText("Input1");
drive = "\\\\cfc1\\USERS0\\";
folder = fname;
search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then
drive = "\\\\cfc2\\users1\\";
search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\cfc4\\users2\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\cfc5\\users3\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\cfc6\\users\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\fc7\\adlusers\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\vc1\\USERS\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\hxc1\\users0\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\hxc2\\users0\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\cxc1\\cusers\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\xs1\\users\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\xs1\\Users\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\fvfc1\\users\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\vxc1\\USERS\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\xs1\\users\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\xs1\\users\\";

search_results = Folder.Find(drive, folder, false, nil);
if (search_results == nil) then

drive = "\\\\dxs1\\users\\";

search_results = Folder.Find(drive, folder, false, nil);

if (search_results == nil) then
drive = "\\\\tcxc1\\users\\";
search_results = Folder.Find(drive, folder, false, nil);

if (search_results == nil) then
drive = "\\\\kfc1\\users\\";
search_results = Folder.Find(drive, folder, false, nil);

if (search_results == nil) then
Dialog.Message("Notice", "There is No Folder " ..folder.. " on Network.");
else
Clipboard.CopyText(search_results[1]);
end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end
else
Clipboard.CopyText(search_results[1]);

end


isText = Clipboard.IsTextAvailable();
if isText then
cbText = Clipboard.GetText();
end
Label.SetText("Label2", cbText);

Size = DLL.CallFunction(_SourceFolder.."\\AutoPlay\\Docs\\xfsize.dll", "GetFolderSize", "\""..cbText.."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
Size = String.ToNumber(Size)
if Size >= 1073741824 then
Size = Size/1024; Size = Size/1024; Size = Size/1024;
Size = Math.Round(Size, 1);
Size = Size.." GB";
elseif Size >= 1048576 then
Size = Size/1024; Size = Size/1024;
Size = Math.Round(Size, 1);
Size = Size.." MB";
elseif Size >= 1024 then
Size = Size/1024
Size = Math.Round(Size, 1);
Size = Size.." KB";
else
Size = Math.Round(Size, 1);
end
Label.SetText("result", "Size: "..Size)







end

synistics
04-21-2007, 12:33 PM
My last post in was the solution. It works very well and leaves the functions on a global so I can actually call them on another page as well.

Thanks for the big help there.