Getting the name of a process in VB.NET - vb.net

I've been looking around for how to find the name of a process object gotten using System.Diagnostics.Process.GetProcesses (for instance, for the process firefox, 'Firefox') , and haven't been able to find anything. I've tried using MainWindowTitle, but instead of returning 'Firefox' it returns the name of the current tab, as that's what Firefox names it's window. Is there any way to find the actual display name of a process?

For Each p As Process In Process.GetProcesses()
Debug.WriteLine(p.ProcessName)
Next
This might work, but is untested.
https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.process.processname

Related

Using minecrafts plugin Skript - How to make a loop, that checks, if player goes in WorldGuard region?

So, I wanna make a loop, that checks, if player goes in WorldGuard region. I don't have any specific details, just i wanna know how to do it.
This is how my code looks like:
set {_rg::*} to %region at player%
loop {_rg::*}:
if "%loop-value%" contains "fail1_1"
execute console command "tp %player% -425.5 9.87500 2299.767 0.0 50.0"
if "%loop-value%" contains "fail1_2":
execute console command "tp %player% -425.5 10 2304.5 0.0 50.0"
Im not really an expert, but i tried to look it up. So, nothing really happened, there were no errors, but it didn't work as i expected (if you fall into region, you get teleported to a location)
I think it is most likely that your Skript installation is broken, your code should give multiple errors that make you aware why your code is not working. Try the latest version of Skript that is available on GitHub.
set {_rg::*} to %region at player%
If you are not working inside a text, you can't use the percentage signs, these are made to interpolate the given variable to text. Skript would create a working {_rg:*} list variable without the percentage signs.
You could use the percentage signs if you wanted to message at which regions the player is:
message "Regions: %region at player%" to player
if "%loop-value%" contains "fail1_1"
A colon is missing at the end of this statement, which should lead to errors while parsing.
execute console command "tp %player% -425.5 9.87500 2299.767 0.0 50.0"
While you can execute commands to teleport players using Skript, you can also teleport players without executing console commands. The reason for this is that Skript will not check if the command is going to work.
Instead, you can use the location function to create a new location and teleport the player to it.
teleport player to location(-425.5, 9.87500, 2299.767, player's world, 0.0, 50.0)

verifyText using *text* instead of verifyTextPresent (deprecated)

I'm kind of new to selenium IDE and automated test and I don't know much about programming languages. I have a question concerning verifyText command as verifyTextPresent is deprecated. If I put the target word/text in * * will it work as if I was using verifyTextPresent? Could waitForText work?
I am trying to verify that the search function of a website is working as expected. I search the word "client" and I want to verify that the word is present in the results.
clickAndWait css=div.cf-tooltip-text
type id=edit-global-search client
clickAndWait id=edit-submit-global-search
verifyText id=content-column *client*
This works, but in the Log I can not understand what it really does. Also if I try the word on its own "client" I get an error which I understand because it compares it to the text of the whole column. I also tried to put an irrelevant word between asterisks such as youwillnotfindthetext (just to make sure that everything between asterisks will pass the test) and there I had an error too.
So it seems to be working somehow but I want to ask some of you expert guys.
Thanks
If you put a * in starting and ending means it will look for the inner text containing in the specific element. If a text is present as you given in the script it will return a pass. If the text u specified in the script is not present, it will throw an error. That's what happens when you put youwillnotfindthetext in between the *.
Check this link Selenium: test if element contains some text

PsychoPy Builder - How to I take a rest part way through a set of trials?

In PsychoPy builder, I have a lot of trials and I want to let the participant take a rest/break part way through and then press SPACE to continue when they're ready.
Any suggestions about how best to do this?
PsychoPy Builder uses the TrialHandler class and you can make use of its attributes to do control when you want to take a rest.
Assuming you're trial loop is utilising an Excel/csv file to get the trial data then make use of trialHandler's attribute : thisTrialN
e.g.
1/ Add a routine containing a text component into your loop (probably at the beginning) with your 'now take a rest...' message and a keyboard component to take the response when they are ready to continue.
2/ Add a custom code component as well and place something similar to this code into its "Begin Routine" tab:
if trials.thisTrialN not in [ int(trials.nTotal / 2) ]:
continueRoutine=False
where 'trials' is the 'name' of your trial loop.
The above will put a rest in the middle of the current set of trials but you could replace it with something like this
if trials.thisTrialN not in [10,20]:
continueRoutine=False
if you wanted to stop after 10 and again after 20 trials.
Note, if you're NOT using an Excel file but are simply using the 'repeat' feature of a simple trial loop, then you'll need to replace thisTrialN with thisRepN
If you're using an Excel file AND reps you'll need to factor in both when working out when you want to rest.
This works by using one of Builder's own variables - continueRoutine and sets it false for most trials so that most of the time it doesn't display the 'take a rest' message.
If you want to understand more, then use the 'compile script' button (or F5) and take a look at the python code that Builder generates for you.

Get Physical Folder site is running under

I am looking to get the folder that my website is running under. I have used many different methods within HttpContext.Current.Request but none of them were returning what I was looking for. I can easily get the value using substring but it doesn't look very clean and was wondering if there was a shorthand way of getting the folder.
For example when I use the code.
HttpContext.Current.Server.MapPath("~")
I get C:\ClientProjects\Dev\v10.3\src\MySite
I can use:
HttpContext.Current.Server.MapPath("~").Substring(HttpContext.Current.Server.MapPath("~").LastIndexOf("\") + 1)
But this seems really bloated way to get the folder I'm running under.
You will be able to get the directory name from a System.IO.DirectoryInfo object.
Dim info As New System.IO.DirectoryInfo(HttpContext.Current.Server.MapPath("~"))
Dim name As String = info.Name ' name will have the value "MySite"

using Selenium: how to use output from one test as input to another test

I'm a Selenium n00b... it's clear how easy it is to run a test and verify a particular response, but how can I take a value from one response and use it in the next test?
an example might be a contact creation form...
type in name/email and click submit
response arrives with new ContactID
grab the ContactID that was returned and put it into "get" textbox and click "submit"
response arrives with contact details
verfy the name/email match the first set
how might I go about doing this in Selenium?
And now something completely different:
Now I understand when you say "test", you mean a single assertion within one test case. So you want to use a value returned from a request as input for another request in the same test case.
Assuming you use selenium ide: To do this, use one of the "store..." commands in selenium ide and store the value into a variable. The contactID can be found using a matching selector with the storeText command. For example:
command: storeText
target: selector for element containing contactId
value: contactId
Then, use variable substitution and the type command to insert that text somewhere else.
command: type
target: selector for target input box
value: ${contactId}
Hope this helps :)
(This answer is still correct I think if you interpret "test" as "test case". For another, totally different answer see below.)
You don't do this. Each test should be independent from all other tests. For your second test, just repeat the steps in the first test. This way, you can reproduce test success and failures in a reliable way.
If you have many tests which all start from a certain application state which requires many steps to reach, just write a private helper method to reach that state.
The alternative: All steps you describe can be put into a single test. There is no reason not to have several asserts in one test.