Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
kdtrog
- Junior Coder
- Posts: 43
- Joined: Wed Mar 28, 2007 9:36 am
Post
by kdtrog » Fri Feb 17, 2017 10:54 am
I am trying to transfer text between Powershell 5.0 and MacroScheduler via Clipboard.
I am running a PS Script within a MS script using RunProgram>powershell.exe. The PS script does a set-clipboard command.
Code: Select all
RunProgram>powershell.exe -command "& {Set-Clipboard -value 'true'}"
wait>1
GetClipBoard>check_ps
The result variable does not contain the newest value (in this case "true")
Any ideas?
Klaus
-
kdtrog
- Junior Coder
- Posts: 43
- Joined: Wed Mar 28, 2007 9:36 am
Post
by kdtrog » Fri Feb 17, 2017 11:33 am
I guess I found the reason. My MS Script is running in an elevated user session but MS is using the clibboard of the original User environment. Powershell is using the elevated environment's clipboard.
A bug or works as designed?
klaus
-
Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
-
Contact:
Post
by Marcus Tettmar » Fri Feb 17, 2017 11:39 am
That's just how Windows works - the whole point is that data can't be shared across execution levels.
However, why is your script running elevated? Macro Scheduler doesn't run elevated by default. It only runs elevated if you choose to run it elevated. If there is a good reason why your script runs elevated you're going to have to either run powershell elevated as well, or find some other way to transfer the data.
-
kdtrog
- Junior Coder
- Posts: 43
- Joined: Wed Mar 28, 2007 9:36 am
Post
by kdtrog » Fri Feb 17, 2017 3:50 pm
Of cause you are right. At the end I found and solved my problem. I worked in the same elevation level but I had an error executing the PS Script because I made a mistake in my LabelToVar statement for the script.
Thanks anyway
klaus