Hi,
I created a user code collection the other day, and now I want to reuse this collection in a new Ranorex project. How do I achieve this? I added the *.cs file to the new solution where it appears under "Solution items" but I cannot select the function from the collection when I want to add a "user code" action.
Thanks
Hans
How to reuse user code
Re: How to reuse user code
did you add "[UserCodeMethod]" (yeah ... without the quotation marks) to every method?
Like this:
Like this:
Code: Select all
/// <summary>
///
/// <para/>Beendet alle Prozesse, die mit 'pProcessName' beginnen
/// <para/>
/// <para/>03.08.2018 A.Fischer
/// </summary>
///
/// <param name="processname">Name of the process to kill</param>
[UserCodeMethod]
public static void KillProcessStartingWith(string pProcessName){
String sExeName;
Process[] tmpProc;
Process[] processes = Process.GetProcesses();
if((processes!=null) && (processes.Length>0)){
for(int i=0; i<processes.Length; i++){
if(processes[i].ProcessName.StartsWith(pProcessName)){
sExeName = processes[i].ProcessName;
tmpProc = Process.GetProcessesByName( sExeName );
for(int j=0; j<tmpProc.Length; j++){
tmpProc[j].Kill();
}
}
}
}
}
Vorsprung durch Wahnsinn
www.Doktor-Andy.de
www.Doktor-Andy.de
Re: How to reuse user code
Yes I did... In the meantime, I somehow managed to pull the cs file into the test case (not into the solution... that may have been my error) and use it 
