Context Menu to Execute a powershell script within selected directory.
Hi,
I'm trying to run a powershell script from a context menu, I've been able to create a context menu, however, when I attempt to run the script it will only run at the default location. What I'd like to do is right-click a folder then click "Do Script"
and have it run the script with the location set to the directory I right clicked.
So for clarities sake, if I right click C:\example then when the script runs it should recognize .\ as C:\example
This is what I currently have in my registry entry. However it's shouting about how there is no parameter for Set-Location that matches -File, I can see that it's taking the Set-Location command, then it's trying to see if -File will is a perameter for it,
but I' trying to use -File for the powershell command. Anyone have any ideas for that?
PowerShell -Command "Set-Location -LiteralPath '%V'" -File C:\script\Test.ps1
Any ideas? I'm wondering if there is something in Powershell like how Bash has something like this to do commands inline
$ > Command -parameter <arg> && Command -parameter <arg>
To setup a script to launch in a men from within a context menu you must create a the following.
Create the following keys:
HKEY_CLASSES_ROOT\Directory\Shell\<Script Name>
HKEY_CLASSES_ROOT\Directory\Shell\<Script Name>\command
Within <Script Name> change the (Default) value to the words you want to have as a context menu example, "Launch Script Here".
Within the command Key change the (Default) value to
PowerShell.exe -File "C:\Script_location\script_name.ps1" "%v"
PowerShell.exe is executed with the -File flag followed by the scripts exact location and "%v " is a variable pointing to the location that was selected.
Similar Messages
-
An unknown error occurred while executing the PowerShell script:
Hello all,
Not the most descriptive title, granted. I'm hoping this may prompt the next version toprovide additional valuable content.
Kindly requesting any help on this problem. I'm running VMM 2012 R2 version 3.2.7668
When I try to look at properties of an existing Private Cloud, I get this error, only if I "look" at certain attributes. If I stay away from the specific attributes, everything is hunky dory. For reasons unknown, after I get this error, I have
to exit and go back into VMM in order to get anything else to run.
The text in the error dialogue box is not entirely applicable because I was connected to the VMM server and will connect again, when I exit/relaunch.
An unknown error occurred while executing the PowerShell script:
The connection to the VMM management server scvmm2.mmmmmm.com was lost.
Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager service is started
on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
Try the operation again. If the issue persists, contact Microsoft Help and Support.
ID: 27235
This is what I get in Events
Warning 4/9/2015 3:27:04 PM PowerShell (Microsoft-Windows-PowerShell) 4100 Executing Pipeline
Log Name: Microsoft-Windows-PowerShell/Operational
Source: Microsoft-Windows-PowerShell
Date: 4/9/2015 3:27:04 PM
Event ID: 4100
Task Category: Executing Pipeline
Level: Warning
Keywords: None
User: mmmmmm\paufra
Computer: tools-francis.mmmmmm.com
Description:
Error Message = The connection to the VMM management server scvmm2.mmmmmm.com was lost. (Error ID: 1610)
Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager service is started
on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
Fully Qualified Error ID = 1610,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.GetSCReplicationGroupCmdlet
Recommended Action = Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager
service is started on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
Context:
Severity = Warning
Host Name = Default Host
Host Version = 4.0
Host ID = 94963cd4-5979-4786-9da2-c8814de8c7c3
Host Application = C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\Bin\VmmAdminUI.exe
Engine Version = 4.0
Runspace ID = 359d7a46-3752-4929-8c09-0de4152d10e4
Pipeline ID = 16
Command Name = Get-SCReplicationGroup
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 91
User = mmmmmm\paufra
Shell ID = Microsoft.PowerShell
User Data:
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft-Windows-PowerShell" Guid="{A0C1853B-5C40-4B15-8766-3CF1C58F985A}" />
<EventID>4100</EventID>
<Version>1</Version>
<Level>3</Level>
<Task>106</Task>
<Opcode>19</Opcode>
<Keywords>0x0</Keywords>
<TimeCreated SystemTime="2015-04-09T22:27:04.993655700Z" />
<EventRecordID>285</EventRecordID>
<Correlation ActivityID="{48059811-1A63-41E1-9057-7498D0E4FC20}" />
<Execution ProcessID="2344" ThreadID="4076" />
<Channel>Microsoft-Windows-PowerShell/Operational</Channel>
<Computer>tools-francis.mmmmmm.com</Computer>
<Security UserID="S-1-5-21-4008432563-1984933819-4238309236-2721" />
</System>
<EventData>
<Data Name="ContextInfo"> Severity = Warning
Host Name = Default Host
Host Version = 4.0
Host ID = 94963cd4-5979-4786-9da2-c8814de8c7c3
Host Application = C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\Bin\VmmAdminUI.exe
Engine Version = 4.0
Runspace ID = 359d7a46-3752-4929-8c09-0de4152d10e4
Pipeline ID = 16
Command Name = Get-SCReplicationGroup
Command Type = Cmdlet
Script Name =
Command Path =
Sequence Number = 91
User = mmmmmm\paufra
Shell ID = Microsoft.PowerShell
</Data>
<Data Name="UserData">
</Data>
<Data Name="Payload">Error Message = The connection to the VMM management server scvmm2.mmmmmm.com was lost. (Error ID: 1610)
Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager service is started
on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
Fully Qualified Error ID = 1610,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.GetSCReplicationGroupCmdlet
Recommended Action = Ensure that scvmm2.mmmmmm.com is online and that you can access the server remotely from your computer. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. Or, you can ensure that the Virtual Machine Manager
service is started on scvmm2.mmmmmm.com. Then connect to scvmm2.mmmmmm.com and try the command again using the new connection. If the command fails again because of a connection failure, restart the Virtual Manager service and then try the operation again.
</Data>
</EventData>
</Event>Hi Sir,
First , please try to run the VMM configuration analyzer on that computer :
http://www.microsoft.com/en-us/download/details.aspx?id=41555
In addition , please try to use "VMMTrace" mentioned in following article to collect trace log and find some useful information :
http://blogs.technet.com/b/jonjor/archive/2011/01/07/vmmtrace-simplified-scvmm-tracing.aspx
Best Regards,
Elton Ji
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] . -
Can we execute a Powershell script from the Javascript?
Hi,
I have a certain requirement to add a Custom ribbon button in document library and there was a powershell script to be run for the selected item in the library.
I have struck with executing a Powershell script from the javascript function.
Can anyone please suggest me if this was achievable
Thanks, Swaroop VuppalaHi Swaroop,
To execute server side code in a custom ribbon button script, using application page is a common way to do this, besides, you can also use a page dialog, which is similar with application page but display as model dialog, another way is javascript
_dopostback and delegate control, the following article contains detailed information about this, please refer to it for more information:
Invoke server side code on SharePoint ribbon click:
http://sharepointnadeem.blogspot.in/2012/07/invoke-server-side-code-on-sharepoint.html
Thanks,
Qiao Wei
TechNet Community Support -
Hi,
I have a text file in which some SamAccountNames are present.I need to check the file while creating a new users through ADUC console.If a username that is going to create through ADUC console is present in the file, then it should prompt a message
that the user is already present in the text file.
Is there any possibility of contacting the powershell script from the ADUC console.If so, then while creating a new user through ADUC console, what is the proceedure for executing that powershell script.
please provide me the approriate solutions.
Thanks
Prasanthi kRun the below Powershell Script for users are exist or not in AD. Later you can create the users.
#Find Users exist in AD or Not?
#Biswajit Biswas
$users = get-content c:\users.txt
foreach ($user in $users) {
$User = Get-ADUser -Filter {(samaccountname -eq $user)}
If ($user -eq $Null) {"User does not exist in AD ($user)" }
Else {"User found in AD ($user)"}
Active Directory Users attributes-Powershell
http://gallery.technet.microsoft.com/scriptcenter/Getting-Users-ALL-7417b71d
Regards~Biswajit
Disclaimer: This posting is provided & with no warranties or guarantees and confers no rights.
MCP 2003,MCSA 2003, MCSA:M 2003, CCNA, MCTS, Enterprise Admin
MY BLOG
Domain Controllers inventory-Quest Powershell
Generate Report for Bulk Servers-LastBootUpTime,SerialNumber,InstallDate
Generate a Report for installed Hotfix for Bulk Servers -
Executing SCVMM PowerShell scripts via C# conditionally works depending on application type
I suspect that this is the wrong forum but I could not find one that was appropriate.
The environment is SCVMM 2012 R2. I have a series of PowerShell scripts that are executed via C# code from a variety of applications -- MVC, WCF, console, unit tests. It seems that successful connection to the VMM server is dependent on the type of application
being used. For example, console apps and WCF apps can connect successfully but the
same code running in a unit test or standard MVC app throw the following exception:
{You cannot access VMM management server SC-01. (Error ID: 1604)
Contact the Virtual Machine Manager administrator to verify that your account is a member of a valid user role and then try the operation again.}
CategoryInfo: {ReadError: (:) [Get-SCVirtualMachine], CarmineException}
ErrorDetails: {You cannot access VMM management server SC-01. (Error ID: 1604)
Contact the Virtual Machine Manager administrator to verify that your account is a member of a valid user role and then try the operation again.}
Exception: {"You cannot access VMM management server SC-01.\r\nContact the Virtual Machine Manager administrator to verify that your account is a member of a valid user role and then try the operation again."}
FullyQualifiedErrorId: "1604,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.GetVMCmdlet"
InvocationInfo: Command = {Get-SCVirtualMachine}
PipelineIterationInfo: Count = 0
ScriptStackTrace: "at <ScriptBlock>, <No file>: line 1"
TargetObject: null
I suspect that somehow, each app is running under different credentials but I cannot see how that is possible. Each app exhibits the stated behavior whether running within Visual Studio (w/ IIS Express) [running under my own account] or published to the
server running under a specific specified account that definitely has permissions to the VMM environment.
This behavior is easily reproducible with the following code
-- PS Script as embedded resource
Get-SCVirtualMachine -VMMServer "SC-01"
-- C# code to load and execute script
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Management.Automation;
namespace LabManagement {
public class HyperVVirtualMachineManager {
public IEnumerable<Models.VirtualMachine> GetVirtualMachines() {
var vms = new List<Models.VirtualMachine>();
try {
using (var rs = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace()) {
rs.Open();
using (var ps = PowerShell.Create()) {
ps.Runspace = rs;
var assembly = System.Reflection.Assembly.GetExecutingAssembly();
var scriptName = "LabManagement.Scripts.GetAllVirtualMachines.ps1";
using (var s = assembly.GetManifestResourceStream(scriptName)) {
using (var reader = new System.IO.StreamReader(s)) {
var script = reader.ReadToEnd();
ps.AddScript(script);
var output = ps.Invoke();
if (ps.Streams.Error.Count > 0) {
foreach (var item in ps.Streams.Error) {
// do something
if (output.Count > 0) {
foreach (var o in output) {
// do something
rs.Close();
catch (RuntimeException ex) {
// do something
return vms;
-- Console app (Success)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace VirtualLabManagement.ConsoleTests {
class Program {
static void Main(string[] args) {
// Arrange
var svc = new LabManagement.HyperVVirtualMachineManager();
// Act
var hosts = svc.GetVirtualMachines();
// Assert
-- Unit Test (Fails)
[TestMethod]
public void TestMethod1() {
// Arrange
var svc = new LabManagement.HyperVVirtualMachineManager();
// Act
var hosts = svc.GetVirtualMachines();
// Assert
Assert.IsNull(hosts);
As you can see, the code is exactly the same between the different executions but the ability to connect differs.Hi Sir,
I would like to check the following items:
1. "a variety of applications -- MVC, WCF, console, unit tests." they are all installed on same computer?
2. VMM server still installed on same computer as these app resides in ?
(if it is possible please detail the topology of the environment )
If they are running at same account on same computer , I would suggest you to post this issue into Code UI forum for further assistance :
https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vstest
Best Regards,
Elton JI
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected] . -
Execute a powershell script from a windows store apps
Hello Everybody !
I'd like to launch a powershell script from a windows store apps.
In fact the purpose is install a windows store apps from an other windows store apps.
Any ideas?
ThanksIf it's a sideloaded LOB application, you can do this using a brokered component:
http://blogs.msdn.com/b/wsdevsol/archive/2014/04/14/cheat-sheet-for-using-brokered-windows-runtime-components-for-side-loaded-windows-store-apps.aspx
Matt Small - Microsoft Escalation Engineer - Forum Moderator
If my reply answers your question, please mark this post as answered.
NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
objects and unknown namespaces. -
Our network was hit recently with virus previously unknown, O97M.Crigent. It is a nasty Macro virus that targets Microsoft Office Documents & Spreadsheets and uses a combination of Macros and Scripts via Powershell.
How do I disable PowerShell scripting via Group Policy?
Will this raise any issues such as random application or network failures or other issues?
Can I apply it to the entire domain or should I be selective and only apply it to the workstations?
Network Summary: Windows 2008 Active Directoy Server, 75% Windows 7, 25% Windows XP workstations.
DouglasOfSanMarcosDisabling Windows PowerShell can be done with GPO:
Computer Configuration | Administrative Templates | Windows Components | Windows PowerShell
From GPO Description: "This setting exists under both "Computer Configuration" and "User Configuration" in the group policy editor. The "Computer Configuration" has precedence over "User Configuration."
By default this option is restricted any way on computers.
I would be very selective when apply it at all:
Workstations - I would apply to test group of workstations first, just to see that there are no side effects before applying to all computers.
Server - I wouldn't apply it at all. I have seen too many issues when setting this policy on Exchange and other systems.
If you are using a Group Policy to define a PowerShell logon, logoff or computer script, that script will disregard any execution policy set locally or through a GPO.
http://4sysops.com/archives/set-powershell-execution-policy-with-group-policy/
http://technet.microsoft.com/en-us/library/hh849812.aspx
Please take a moment to Vote as Helpful and/or Mark as Answer where applicable. Thanks. -
Office 2010 Context menu displaying English even though French MUI selected
Office 2010 32-bit on Windows 7 64-bit OS
When right-clicking on an Office document from Explorer with the French Language Pack selected via Regional Settings, part of the menu is displayed in English as follows:
This only occurs for extensions associated to Office 2010 i.e. right-clicking on a txt file displays all French items.
Ideas as why this is happening?Hi,
It seems the issue is more related to the language version of operation system. The Office MUI packs are used to change the Display and Help language when you use Office programs. They wouldn’t be used to change the context menu in Windows Explorer. I would
suggest you test installing the Office suite on a French version system.
Sincerely
Rex Zhang
Rex Zhang
TechNet Community Support -
Recovery Task - SCOM, execute large Powershell scripts
Hi,
As a standard we use powershell for scripting. Now we want to do this in SCOM to.
But on a recovery task i can only add one sentence of powershell commandline, or a VBscript. This is really strange for a monitoring tool, that has got so much powershell cmdlets.
As a workaround i can execute powershell in the VBS code. But then i need to place my script on the server where the alert came from to resolve it.
Now we want to send an SMS as a recovery task, so that the engineer knows there is an issue after working time.The problem is with the workaround is that i now need to give all application servers an 'accept' on the firewall to our SMS provider. Instead
of 3 management servers.
Has anybody got a good solution to start a powershell taks as a recovery on your management server for a application server to solve an issue or to send an SMS.
Kind regards,
AndréHi
I have two question:
1- Which module did you use for your recovery task? because you said that you can only add one sentence of power-shell command-line,
or a Vb-script. if you used regular recovery task module you can run a long script of power-shell or vb-script.
2- Do you want to run that recovery task script on RMS or agents? Because if you want to run script on RMS it's so easy and you have to just create
a normal vb-script recovery task module and call your SMS provider in it. Or in vb-script you have to call a power-shell script that located on RMS.
Another way is creating power-shell recovery task module and call your SMS provider in it.
If you answer these questions I can help you better and more.
regards
Alireza -
Term is not recognized when executing PowerShell Script through SQL Agent using CMDEXEC
I am trying to simply execute a PowerShell script that is stored in a file on a network drive through SQL Agent as a job. The script is a basic copy from one directory to another. I have run and successfully executed this from a command prompt outside
of SQL Agent. When I execute this through SQL Agent as a Operating System (CmdExec) command I am getting an error that the term is not recognized as the name of a cmdleet, function, script file or operable program. I have executed many different ways
put found an article to use double quotes in the network path which I have done with no success.
I am executing the following command as a job in SQL Agent:
PowerShell H:\"\PowerShell""\PS_Scripts\"\batchcopyFFLWithProgress.ps1 through SQL Agent job
I get the following error message:
04/21/2015 10:01:09,Copy FFL Files,Error,1,NY11266-LTW7E\JPLAPTOPSQL,Copy FFL Files,Copy FFL files,,Executed as user: NT Service\SQLAgent$JPLAPTOPSQL. H:\PowerShell\PS_Scripts\batchcopyFFLWithProgress.ps1 : The term 'H:\PowerShell\PS_Scripts\batchcopyFFLWithProgress.ps1'
is not recognized as the name of a cmdlet<c/> function<c/> script file<c/> or operable program. Check the spelling of the name<c/> or if a path was included<c/> verify that the path is correct and try again.
At line:1 char:1 + H:"\PowerShell\PS_Scripts"\batchcopyFFLWithProgress.ps1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound:
(H:\PowerShell\P...ithProgress.p s1:String) []<c/> CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException. Process Exit Code 1. The step failed.,00:00:03,0,0,,,,0
Content of batchcopyFFLWithProgress.ps1 which has the PowerShell script:
$source=ls H:\SQLTest\Script\TestData\*.*
$i=1
$source| %{
[int]$percent = $i / $source.count * 100
Write-Progress -Activity "Copying ... ($percent %)" -status $_ -PercentComplete $percent -verbose
copy $_.fullName -Destination H:\test -Recurse
$i++
I have searched the internet and have not found any resolution to my error. If someone has experienced this error and found the resolution I would greatly appreciate your help.I have change the service account for SQL Agent to be my domain account as I have local admin rights to my laptop. I stopped and started the services for SQL Agent and than started the job to run which is copying locally to minimize any network drive
issues. I am still getting the same error message as it is showing that I am executing the job under my domain account? Any thoughts what it could be?
ErrorMsg
04/23/2015 11:21:06,Copy FFL Files,Error,1,ServerName\InstanceName,Copy FFL Files,Copy FFL files,,Executed as user: Domain\DomainAccount. \\ServerName\Test\PS_Script\batchcopyFFLWithProgress.ps1 : The term '\\ServerName\Test\PS_Script\batchcopyFFLWithProgress.ps1'
is not recognized as the name of a cmdlet<c/> function<c/> script file<c/> or operable program. Check the spelling of the name<c/> or if a path was included<c/> verify that the path is correct and try again. At
line:1 char:1 + \\ServerName\Test\PS_Script\batchcopyFFLWithProgress.ps1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (\\ServerName...ithProgress.ps1:String)
[]<c/> CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException. Process Exit Code 1. The step failed.,00:00:02,0,0,,,,0
Script
$source=ls "\\ServerName\Test\TestData\*.*"
$i=1
$source| %{
[int]$percent = $i / $source.count * 100
Write-Progress -Activity "Copying ... ($percent %)" -status $_ -PercentComplete $percent -verbose
copy $_.fullName -Destination "\\ServerName\Test\test" -Recurse
$i++ -
List of conditions in the context menu
Hello,
If I define conditions in the query designer I had these conditions available in the context menu while executing a query both in excel and in web within BW 3.5.
Within NW04s I miss the conditions in the context menu. The only way I know how to make conditions available during the execution of a query is to build in a list of queries item on the work sheet itself by using the design tool.
Is this really the only way? The context menu was rather convenient either.
Thank you.
Ingo PeterHi Ingo,
Please refer the link below
http://help.sap.com/saphelp_nw2004s/helpdata/en/5b/8c3842bb58f83ae10000000a1550b0/frameset.htm
Regards
Sajeed -
is it possible to add search options to the files context
menu ?
like start dw search with selected folder ?
i know how to edit dw menus ...
thanks
piJongware -- it's not the sort of get around you could use for scripts meant for the public. But for private use, it's perfect.
I don't use style groups. Don't know about CS4, but with CS3, if you cut and paste something from another doc in the same book (something I need to do a lot) or import more text from Word, the new styles won't match up with the existing ones in the groups: they'd be duplicated as single styles in no group. So it made the feature useless, for me, because of the fuss required to delete them and replace them with their twins.
I really like your work around. The character styles thing doesn't matter. I just did a try {} catch to see if the style was para or char.
The script I wrote is a simple one. It just copies the style to the find dialog box settings, then zooms to the first instance of it. Not much in itself, but great when you first import Word text that has 40 styles and you need to get an idea of how each style is used without scrolling painfully through the long list in the find dialog.
... so thanks for your help. -
How to create a Context Menu submenu?
I am trying to create a submenu which lists scripts in the content window - Does anyone know how to do this?
This works:
if (MenuElement.find ('Thumbnail/tscript') == null) var ah_ScriptsContext = new MenuElement( "command", "Scripts", "at the end of Thumbnail", "tscript");
But the submenu does not work:
var ah_runScriptImRnContext = new MenuElement("menu","AH Image Rename","at the end of Thumbnail/tscript");
I've tried various combinations of 'menu' / 'command' and everything else I can think of, so far no go.
AndrewHere ya go, Andrew:
Bob
Adobe WAS Scripting
#target bridge
ContextDemo = {};
ContextDemo.handler = function( menu ) {
alert( menu.text );
try {
MenuElement.create( "menu", "Menu", "at the end of Thumbnail", "cMenu" );
ContextDemo.m1 = MenuElement.create( "command", "Command 1", "at the end of cMenu", "cMenu/sub1" );
ContextDemo.m1.onSelect = ContextDemo.handler;
ContextDemo.m2 = MenuElement.create( "command", "Command 2", "at the end of cMenu", "cMenu/sub2" );
ContextDemo.m2.onSelect = ContextDemo.handler;
} catch ( e ) {
// now let's get tricky
// disabling a script generated context menu makes it disappear from the context menu
SelectExample = {}
SelectExample.menuSelected = function() {
alert( "You selected " + app.document.selections[ 0 ].name );
SelectExample.menu = undefined;
SelectExample.onSelectHandler = function( event ) {
if ( event.object.constructor.name == "Thumbnail" ) {
if ( event.type == "select" ) {
// event.object is the Thumbnail object that was selected
if ( event.object.isFileType( "jpg,jpeg,psd,tif,tiff" ) ) { // enable the menu for these files with these extensions only
try {
if ( !isValidReference( SelectExample.menu ) ) {
SelectExample.menu = MenuElement.create( "command", "MyCommand", "at the end of Thumbnail", "myMenuID" );
SelectExample.menu.onSelect = SelectExample.menuSelected;
} else {
SelectExample.menu.enabled = true;
} catch ( e ) {
} else {
try {
SelectExample.menu.enabled = false;
} catch ( e ) {
return { handled:true }; // tells Bridge event was handled
return { handled:false }; // tells Bridge event wasn't handled and
//to continue through the handler array
app.eventHandlers.push( { handler: SelectExample.onSelectHandler } ); -
Is it possible to catch a PowerShell script output when an exit code is setted?
Hi,
i'm using TEO 2.1.2 with the hotfixes from 1 to 12 already installed and i have a problem using the "Execute Windows PowerShell Script" in reading the output of a PowerShell script if an exit code is expressly setted . For example if i try to execute a script like:
the output given by the activity is only 0 (like the exit code).
This is a problem if i use a script with multiple exit codes corrisponding to different kind of situations and different outputs like the following:
if($flag -eq "0")
Write-output "Hello"
exit 0
elseif ($flag -eq "1")
Write-output "Error 1"
exit 1
else
Write-output "Error 2"
exit 2
or if i call an executable which exit codes i want to identify by a readable description.
Anyone knows a way to solve this issue?
Thanks a lot,
bye.
GiulioThanks Shaun,
i was already looking toward this kind of approch, but i was also curious if there was a different way of doing this.
Anyway just a little annotation about your line of code, in Tidal 2.1.2 at least, Write-host doesn't work right, echo or Write-Output are fine but Write-host seems to be ignored. To the following script:
the output is
Maybe i'm missing something. Regarding an upgrade, as a devoloper i'd really like to try the improvement of the new version but this is not a decision I can make.
Thank you,
bye.
Giulio -
Portal context menu change translation
Hello,
I want to change some portal context menu (when executing wad template) text in french. The translation is not very good some times.
I think it is possible to change it in a par file. But I don't how to find the par file to change.
Is it possible to do that ? And what the name of the par file to modify ?
Thank'sHi Thierry,
I am really not sure which PAR file would solve your problem.
But you will have the required PAR files in your Portal in the below navigation,
Go to System administration -> Then Support Tab -> Portal Runtime -> Browse Deployment ->
Follow the Path ROOT/WEB-INF/deployment/temp
OR ROOT/WEB-INF/deployment/pcd .
Good Luck!!!
Biroj Patro.
Edited by: Biroj Patro on Aug 23, 2010 10:07 AM
Maybe you are looking for
-
Pointer disappears when changing displays
Often when I have been working on my PB at the office, then put it to sleep and take it home and plug it into my 20" display and wake it up, there is no mouse pointer visible on the screen. The windows I was working on will have transferred to the bi
-
IPod Nano - what is "other" and how can I get rid of it
I have a 2gb iPod Nano and only have 1.19gb worth of audio on it right now. I can't put anything else on it because there is 602mb worth of "other" taking up room on the iPod. I don't have any pictures or podcasts on it, i've disable album artwork, a
-
And my activation date of this month is oct.2. But...
I bought 400 minuits 3 months 2 month ago. And my activation date of this month is oct.2. But it doesn't work yet. It is oct.3. What can I do for it?
-
Am having billing problem in my id
Am problem in billing I purchased a app in iTunes and I gave my Visa card details and it's accepted after a week I try to download an app it's show an message previous purchase billing problem. Then I tried to gave all my details it's shows your l
-
Hello Gurus, My client is having a unique requirement. He has got 1000 raw materials in a BOM. Whenever he runs MRP he gets 1000 PR's for 1000 materials. His requirement is to have a single PR with 1000 line items. The reason behind this is the relea