PDA

View Full Version : Is It Possible?


Mina
11-01-2005, 07:32 AM
hey
its me again

if (for example) you make an app. with a media player plugin in it and build the program eventually. Could you right-click a song, select "Open With" then choose the app. i built? is this possible with ams6?

hope that makes sense

Worm
11-01-2005, 07:35 AM
yes, but you will need to process the commandline within your app. Someone correct me if I'm wrong, but the OS will fire the associated application with the file as a command line parameter. AMS allows you to accept commandlines parameters, so this is definitely doable.

Mina
11-01-2005, 10:34 AM
glad its doable.. but "how" is the problem!
if anybody can help me id greatly appreciate it.. :yes

Worm
11-01-2005, 11:54 AM
You didn't ask that...

Look in the help file for Commandline, you'll find info there for how to deal with them. If you have trouble after that, post some code, and someone here will more than likely help get you going in the right direction.

Mina
11-02-2005, 03:12 AM
thnx for the tip but the AMS help file only shows you command line arguments and command line variables..

Mina
11-02-2005, 03:20 AM
maybe it has something to do with the Global functions?

Worm
11-02-2005, 07:30 AM
if _CommandLineArgs[1] ~= "" then
--open the file
sFileName = _CommandLineArgs[1];
--do whatever you need to here
else
--no file was passed to the app
end

TJ_Tigger
11-02-2005, 07:48 AM
I see that Worm has posted, the story of my life, day late and a dollar short . . . is that violins that I hear. . . That reminds me of a funny story. My kids told our neighbors that they were not able to watch a certain movie because of the violins. Are we raising our kids to be prejudice against violins? NO, but we don't let them watch VIOLENT movies either. :D

Anywho, here was my stab at the code, I have also added the command line stuff to a project if you want to see how it works.


if _CommandLineArgs[1] then
if File.DoesExist(_CommandLineArgs[1]) then
strInput = _CommandLineArgs[1];
else
Dialog.Message("ERROR", "There was an error in loading the file.");
strInput = Application.LoadValue("IR Product CodeViewer\\Settings", "LastFileViewed");
end
else
strInput = Application.LoadValue("IR Product CodeViewer\\Settings", "LastFileViewed");
end


The above code was used for the IR Project CodeViewer. (http://www.indigorose.com/forums/showthread.php?p=67482#post67482)

Tigg

Mina
11-03-2005, 06:05 AM
appreciate ur help
thnx

Mina
11-03-2005, 08:20 AM
to try it i used

result = Application.GetMenu();
Paragraph.SetText("Paragraph1", result);

but it gives an error: it must be a type of string
what should i do about that?

mina

rhosk
11-03-2005, 08:28 AM
Mina, you should really utilize the help guide. Would save you so much posting time, grief, waiting.

Just use the string variables below (sMessage) and apply it to your paragraph object -

function OutputMenu (tMenuToOutput, nLevelCount, sMenuString)
-- Since we don't want to make nLevelCount required (for the first call),
-- we have to initialize it if it is not passed to the function
if not nLevelCount then
nLevelCount = 0;
end

-- sMenuString is not a required variable (for the first call),
-- therefore we must initialize it if it was not passed to the function.
if not sMenuString then
sMenuString = "";
end

-- Menu table is numerically indexed, step through for each node
for nIndex, tMenuItem in tMenuToOutput do
-- Add the current menu item to the string to return, whether it has a sub menu or not
sMenuString = sMenuString .. String.Repeat(" ", nLevelCount*4) .. tMenuItem.Text .. " (ID: " .. tMenuItem.ID .. ")".. "\r\n";
-- Check if a sub menu exists at the current menu's location
if type(tMenuItem.SubMenu) == 'table' and tMenuItem.ID == -1 then
-- A sub menu exists. Recursively call this function to include the sub menu.
-- Increasing the level count by 1 controls the indent that the item will have in the output.
sMenuString = OutputMenu (tMenuItem.SubMenu, nLevelCount + 1, sMenuString);
end
end

-- Return the menu string
return sMenuString;
end

-- Get the menu structure and store in a table
tMenu = Application.GetMenu();

-- Set the title and message for the Dialog.Message box
sTitle = "Current Menu Structure";
sMessage = OutputMenu(tMenu);

-- Display a Dialog.Message box to the user
Dialog.Message(sTitle, sMessage);

Worm
11-03-2005, 08:29 AM
Application.GetMenu returns a table, you need to use the table elemtents

result.ID --(number)
result.Text --(string)
result.Enabled --(boolean)
result.Checked --(boolean)
result.SubMenu --(table)


to try it i used

result = Application.GetMenu();
Paragraph.SetText("Paragraph1", result);

but it gives an error: it must be a type of string
what should i do about that?

mina

Corey
11-03-2005, 12:46 PM
I agree with Tigg, peaceful non-violins is the only way to go. :D

That's the first time I've heard of anyone limiting their childrens' media intake toward that end though. Commendable stuff Tigg, that's some mighty fine parenting. You guys never fail to impress me. Your tykes have got it made in the shade with pink lemonade. :yes

Mina
11-03-2005, 02:49 PM
feel so much like a beginner here.. :eek:
thnx for all the help

Corey
11-03-2005, 02:54 PM
You'll be surprised how quickly you can get some decent traction with AMS. The basics are pretty straightforward and once you have those the rest is gravy. :yes

Mina
11-03-2005, 02:56 PM
yeh (experienced with ams4)