PDA

View Full Version : Got another question


Codyclark
02-21-2007, 07:44 PM
Okay I KNOW its on this forum somewhere I think ive seen it but I have searched everything.. So.. what I need is to have a tree and make it open a .exe file when clicked.. Simple but can't find it =|

coderanger
02-21-2007, 08:02 PM
I believe you would use Tree.GetNode from the help manual.
Find out what the selected node is and open the appropriate
file from there.

Someone please correct me if I'm wrong.

Patrick

Codyclark
02-24-2007, 06:09 PM
Okay i've messed around with it too much.. I tried as much as I can with Get.TreeNode.. I'm pretty new with AMS could you help me some more?

I would really appreciate it
Thanks

ianhull
02-24-2007, 07:24 PM
I have never messed with the tree component but I would think that it is something like this




result = Tree.GetSelectedNode("Tree1");
result1 = File.Run("AutoPlay\\Docs\\"..result, "", "", SW_SHOWNORMAL, false);

Codyclark
02-25-2007, 05:19 AM
Thats on the right path, but I need it to open a diffrent program for each node

ianhull
02-25-2007, 08:40 AM
This should open a different program/file depending on the value of each node.


as I said I'm not familiar wih the AMS Tree object so if anyone else could help on this great.

RizlaUK
02-25-2007, 11:28 AM
hi,

i think this is more what you are looking for


node = Tree.GetNode("Tree1", e_NodeIndex);
result = File.Run("AutoPlay\\Docs\\"..node.Data, "", "", SW_SHOWNORMAL, false);

hope it helps

Codyclark
02-26-2007, 12:08 PM
Yay, it worked perfect RizlaUK, thanks to everyone! =D

Codyclark
02-26-2007, 01:33 PM
Okay again thanks for the code BUT one quick question..
Say I wanted to open a program in the folder the program was in..

I think its "_sourcefolder//somethingsomething" I looked around the forum a lot, I remember seeing a post about it I cant find it though.

Intrigued
02-26-2007, 05:59 PM
Okay again thanks for the code BUT one quick question..
Say I wanted to open a program in the folder the program was in..

I think its "_sourcefolder//somethingsomething" I looked around the forum a lot, I remember seeing a post about it I cant find it though.

This?

http://www.indigorose.com/forums/showthread.php?t=11327&highlight=SFX

RizlaUK
02-26-2007, 06:49 PM
yeah, Intrigued's code is great for finding the path to the exe location (when compiled into a web/email exe) i have used it in many projects

but if you are making the app in a folder then "_sourcefolder" would do the trick

eg:
node = Tree.GetNode("Tree1", e_NodeIndex);
result = File.Run(_sourcefolder.."\\"..node.Data, "", "", SW_SHOWNORMAL, false);

or useing Intrigued's code

function fnEXEOrigLoca(runexe)
strCWF = Folder.GetCurrent()
strPath = String.Replace(_CommandLineArgs[1], "SFXSOURCE:", "", true)
return strPath;
end

-- An example "function call" (to use the function)
fnEXEOrigLoca(_DesktopFolder.."\\app_name.exe")

node = Tree.GetNode("Tree1", e_NodeIndex);
result = File.Run(strPath.."\\"..node.Data, "", "", SW_SHOWNORMAL, false);

Roboblue
02-26-2007, 08:22 PM
Look in the Help file under Contents-Variables-Global Variables. You can learn about all the Global Variables in AMS that can make your coding a lot easier.

Codyclark
02-27-2007, 08:53 PM
..Okay either i've gottin retarded or ..I don't know I have done pretty much everything I know its something simple im doing wrong but thats whats ****ing me off and messing me up.. SO.. I have my folder.. Got my app running I have a folder in the same folder as I have my app.. Now I in that folder is the programs I want to run.. The folder name is GENS so I was guessing this would be the code..

node = Tree.GetNode("Tree1", e_NodeIndex);
result = File.Run(_SourceFolder.."//Gens"..node.Data, "", "", SW_SHOWNORMAL, false);

But its not working.. I don't know what the heck im missing please help before I lose more brain cells

Roboblue
02-27-2007, 09:00 PM
The slash's are backwards
should be
result = File.Run(_SourceFolder.."\\Gens"..node.Data, "", "", SW_SHOWNORMAL, false);

Codyclark
02-28-2007, 11:56 PM
I tried that before I posted, I have no idea what is wrong..

SourceFolder -> Gens


..=|

Dermot
03-01-2007, 02:36 AM
Your missing the \\ after Gens

result = File.Run(_SourceFolder.."\\Gens\\"..node.Data, "", "", SW_SHOWNORMAL, false);