Folder action to run a ruby script
Hi all
I have various AppleScript scripts that deal with PDF files manually, (thanks to the kindness of many on this forum), but I want to convert to a folder rather than ask me sources and destination action script.
This is the current script - it is easy to convert to a folder action so I can just drag files to a hot folder?
=======
_main()
on _main()
o script
aa property : Choose file with command prompt ("choose PDF Files.") Type {"com.adobe.pdf"} ¬
location (path to the Office) by default with multiple selections allowed
the value beginning de choose a folder with prompt ¬ ("Choose Destination folder.") my aa
default location (path to the Office)
game of args for «»
Repeat with an in my aa
Set args to args specified POSIX path form & space
end Repeat
in view of digital channels
if (system information)'s version of the system < "10.9"=""> then
Ruby set to "/ usr/bin/ruby.
on the other
Ruby set to "/ System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby".
end if
end in view of
"ruby shell script &"<'EOF' -="" "="" &="" args="" &="">'EOF'>
require ' osx/cocoa '.
include OSX
require_framework 'PDFKit.
OutDir = ARGV.shift.chomp('/')
ARGV.select {| f | f = ~ \\.pdf$/i} .each | f |
URL = NSURL.fileURLWithPath (f)
doc = PDFDocument.alloc.initWithURL (url)
path = doc.documentURL.path
pcnt = doc.pageCount
(0 .. (pcnt-1)). each | I have |
page = doc.pageAtIndex (i)
page. String.to_s = ~ /VMA_\\S * /.
name = $&
name unless
"puts \"no corresponding to the string in the page #{i + 1} of #{path}------".
# next skip this page
end
Doc1 = doc # PDFDocument.alloc.initWithData (page.dataRepresentation) for this page
less than doc1.writeToFile(\"#{outdir}/#{name}.pdf\") "
"puts \"failed to save the page #{i + 1} of #{path}------".
end
end
end
EXPRESSIONS OF FOLKLORE. "
end script
say o to run
end _main
Hello
You can save the script as a script compiled in applescript
~/Library/Scripts/Folder Action Scripts
and assign it as a folder action script in the hot folder. Specify the destination directory defined in. DESTINATION | property at the top of the script.
* Note that the destination folder cannot be the Hotfolder.
To test the code as a stand-alone script, you can simply run the script in the Script Editor and it will allow you to choose the PDF files by the dialogue.
property |DESTINATION| : ((path to home folder)'s POSIX path & "Desktop/hot") as POSIX file as alias -- alias of destination directory on adding folder items to d after receiving argv if d = |DESTINATION| then display dialog "Folder Action :" & return & ¬ (path to me)'s POSIX path & return & return & ¬ "The destination cannot be the hot folder." with icon stop error number -128 end if _main(argv) end adding folder items to on run -- # for stand-alone test _main({}) end run on _main(argv) (* list argv : list of alias of source PDF files *property |DESTINATION| : alias of destination directory *) script o property aa : argv if (count aa) = 0 then set aa to choose file with prompt ("Choose PDF Files.") of type {"com.adobe.pdf"} ¬ default location (path to desktop) with multiple selections allowed set my aa's beginning to my |DESTINATION| as alias set args to "" repeat with a in my aa set args to args & a's POSIX path's quoted form & space end repeat considering numeric strings if (system info)'s system version < "10.9" then set ruby to "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby" else set ruby to "/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby" end if end considering do shell script ruby & " <<'EOF' - " & args & " require 'osx/cocoa' include OSX require_framework 'PDFKit' outdir = ARGV.shift.chomp('/') ARGV.select {|f| f =~ /\\.pdf$/i }.each do |f| url = NSURL.fileURLWithPath(f) doc = PDFDocument.alloc.initWithURL(url) path = doc.documentURL.path pcnt = doc.pageCount (0 .. (pcnt - 1)).each do |i| page = doc.pageAtIndex(i) page.string.to_s =~ /VMA_\\S*/ name = $& unless name puts \"no matching string in page #{i + 1} of #{path}\" next # ignore this page end doc1 = PDFDocument.alloc.initWithData(page.dataRepresentation) # doc for this page unless doc1.writeToFile(\"#{outdir}/#{name}.pdf\") puts \"failed to save page #{i + 1} of #{path}\" end end end EOF" end script tell o to run end _main
Briefly tested under OS X 10.6.8.
Good luck
H
Tags: Mac OS & System Software
Similar Questions
-
Getting the name of the Action that runs this script
If I create an action in photoshop to run a script named "test script", how can determine within the "test script" what name of the action started to run this script? I am writing a script to resize my images. The scale will be determined by what Action ran this script.
Example of
Action names are 5 x 7, 4 x 6, 8 x 10
Reproduced above action will run the same script, called "scale me."
In "scale me ', the java code will determine that 4 x 6 started running" scale me. "
"Level I" will go to the section in the java code to the scale of the image loaded into Photoshop for a 4 x 6 size.
The reason for writing the code "scale me" in this way, is that I can keep only one script to resize my images.
Any suggestion or help would be appreciated.
Raymond
I don't know of all average direct to determine the name of the action that began a script. You can find the name of the action highlighted / selected with this code.
var ref = new ActionReference(); ref.putEnumerated( charIDToTypeID("Actn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); var desc = executeActionGet(ref); var actionName = desc.getString( charIDToTypeID("Nm ") ); var actionSetName = desc.getString( charIDToTypeID("PrNm") ); alert( 'Current selected action is: '+actionName+'\rin the action set: '+actionSetName );
But it is not infallible.
A better solution would be to set up your script to make it recordable action. The details are in the script as "JavaScript"resource guide. It you have that in place any action that registers the script you will store the values used. When the action is played again once you get these the app.playbackParameters calues. Image and layers of export files are two Adobe scripts that use a javascriptresource section.
-
OSX 10.8.5 operating malfunction affecting folder actions
Mac 2012 tour Pro - Quad Core - 3.2 GHz - OSX 10.8.5
Memory 6 GB - discs: 1 OEM 1 t + 2 - 2T WDCs
Symptoms:
1. periodically, nothing appears when I open a window. I close the window and do force quit the Finder to the stimulus and then open and folders appear. No record appearing also took place when I am in a program and do a save as.
2. all the time, the "?" is on the bar at the top of the window. This occurs on all disks.
3. all the time, the preview icon appears on the taskbar at the top of the window. If clicked, a photo on my computer appears. Always the same photo on all disks.
4. when I try to highlight a folder or document to change the name or something, folder action sent me to the far right. Example: Folder 1 > Folder2 > folder3 > folder4 > content. When I want to add or modify the folder 1, I am obliged to content inside folder4.
5. the number of times a day that I'll have to stop to relaunch Finder increases exponentially.
//
The most likely problem is your installation, not Cougar. I suggest:
Try these in order to test your system after each see if it is back to normal:
1. reset the PRAM and NVRAM on your Mac.
b. Macs with Intel processors: reset of the controller (SMC) system management
2. restart the computer in Safe Modeand then restart again, normally. If this does not help, then:
HD recovery start: restart the computer after the ring, press on and hold the COMMAND and R keys until it appears the Utilities menu screen.
3 fix the hard disk and permissions: at startup, select drive in the Utilities menu utility. Repair hard disk and permissions as follows.
When the recovery menu appears, select disk utility and click on the continue button. After loading disk utility select your hard drive the out-bumpy entry (mfgr. ID and Player size) of the list on the left. In the disk utility status area, you will see an entry for the S.M.A.R.T. status of the hard drive. If it does not say "Verified" then the hard drive is faulty or has failed. (State SMART is not reported on external drives Firewire or USB). If the drive is "verified", then select your OS X volume from the list on the left (indented under the entrance to the road, entrance) usually named Macintosh HD click the first aid tab, and then click the repair disk button. If disk utility reports any errors that have been corrected, then again run repair disc until no errors are reported. If no errors are reported, click repair permissions . Wait until the operation is complete, then quit disk utility and return to the main menu. Select restart from the Apple menu.
4 reinstall Mountain Lion: Reboot of HD recovery Select reinstall OS X in the Utilities menu, then click on the continue button.
Note : You will need an active Internet connection. I suggest to use Ethernet if possible
because it is three times faster than wireless.
5 reinstall Mountain Lion from scratch:
Make sure that you have backed up your files because the following procedure will remove all of the hard drive.
HD recovery start:
Restart the computer after the ring, press in and hold the COMMAND and R keys until the menu screen to appear.
Erase the drive:
1. select in the main menu disk utility and click on the continue button.
2. after disk utility loads select your boot volume (usually Macintosh HD) in the
list on the left. Click on the Erase tab in the main window of THE.
3. set the type of format Mac OS extended (journaled). Click
the clear button and wait until the process is complete.
4 quit disk utility and return to the main menu.
Reinstall OS X: Select reinstall OS X and click on the install button.
Note : You will need an active Internet connection. I suggest to use Ethernet if possible
because it is three times faster than wireless.
This should install the version of Mac OS X that you had installed it.
-
How to close all windows after running the SaveAsPDF script?
I ran into the problem where I adjusted the SaveAsPDF script to backup my PDF files with a preset specific PDF I use. But after executing the script, all newly created PDF files are open in illustrator and I have to close it manually one by one, choose if I want to 'Save' or 'do not save' (even if they are already registered). I would like for them to close right after that the PDF is created.
I've added in the script:
if (myFile.open("w")) { myFile.close(SaveOptions.DONOTSAVECHANGES); }
Who's going to run the script and close the files, but for only 3 of the 10, I opened. The 7 remaining won't be saved or converted to PDF. Is there something wrong in my script or anything else that I can try to solve this problem?
Here is my complete script:
/** Saves every document open in Illustrator as a PDF file in a user specified folder. */ // Main Code [Execution of script begins here] try { // uncomment to suppress Illustrator warning dialogs //app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS; if (app.documents.length > 0 ) { // Get the folder to save the files into var destFolder = null; destFolder = Folder.selectDialog( 'Select folder for PDF files.', '~' ); if (destFolder != null) { var options, i, sourceDoc, targetFile; // Get the PDF options to be used options = this.getOptions(); // You can tune these by changing the code in the getOptions() function. for ( i = 0; i < app.documents.length; i++ ) { sourceDoc = app.documents[i]; // returns the document object // Get the file to save the document as pdf into targetFile = this.getTargetFile(sourceDoc.name, '.pdf', destFolder); // Save as pdf sourceDoc.saveAs( targetFile, options ); sourceDoc.close(); } alert( 'Documents saved as MarkPreset PDF' ); } } else{ throw new Error('There are no document open!'); } } catch(e) { alert( e.message, "Script Alert", true); } /** Returns the options to be used for the generated files. @return PDFSaveOptions object */ function getOptions() {var NamePreset = 'MarkPreset'; // Create the required options object var options = new PDFSaveOptions(); options.pDFPreset=NamePreset; // See PDFSaveOptions in the JavaScript Reference for available options // Set the options you want below: // For example, uncomment to set the compatibility of the generated pdf to Acrobat 7 (PDF 1.6) // options.compatibility = PDFCompatibility.ACROBAT7; // For example, uncomment to view the pdfs in Acrobat after conversion // options.viewAfterSaving = true; return options; } /** Returns the file to save or export the document into. @param docName the name of the document @param ext the extension the file extension to be applied @param destFolder the output folder @return File object */ function getTargetFile(docName, ext, destFolder) { var newName = ""; // if name has no dot (and hence no extension), // just append the extension if (docName.indexOf('.') < 0) { newName = docName + ext; } else { var dot = docName.lastIndexOf('.'); newName += docName.substring(0, dot); newName += ext; } // Create the file object to save to var myFile = new File( destFolder + '/' + newName ); // Preflight access rights if (myFile.open("w")) { myFile.close(SaveOptions.DONOTSAVECHANGES); } else { throw new Error('Access is denied'); } return myFile; }
Try this change
for (i = 0; i< app.documents.length;="" i++="" ) ="">
for (i = app.documents.length; i > 0; i--)
-
Run the Ant script using Java in webcenter Portal
Hi all
I have requirement where I have to run an ant script using java or by any means to the webcenter portal.
Ant script must be run on a triggering action.
Please help me in this direction.
Thank you and best regards,
Shakir
Hey all,.
Here is the solution, I had finally
BuildFile file = new File ("myBuild.xml");
Project p = new Project();
p.setUserProperty ("ant.file", buildFile.getAbsolutePath ());
ConsoleLogger DefaultLogger = new DefaultLogger();
consoleLogger.setErrorPrintStream (System.err);
consoleLogger.setOutputPrintStream (System.out);
consoleLogger.setMessageOutputLevel (Project.MSG_INFO);
p.addBuildListener (consoleLogger);
p.init ();
ProjectHelper helper = ProjectHelper.getProjectHelper ();
p.addReference ("ant.projectHelper", assistance);
Helper.Parse (p, buildFile);
p.executeTarget (p.getDefaultTarget ());
Kind regards
Shakir
-
Allow to run remotely signed scripts
If I run; ": Allow powershell scripts to run powershell Set-ExecutionPolicy RemoteSigned ' scripts will be able to run anywhere? If so, how to do this to allow shell scripts to run from a specific remote location only?
Hello
I suggest you to see link below and check if it helps.
http://TechNet.Microsoft.com/en-us/library/ee176949.aspx
Hope this information is useful.
-
Is it possible to run the command script with user account administrator rights?
Is it possible to run the command script with administrator user account rights means please tell me how to...
I need to run it in windows 7 professional service pack 1.
There are a few myths that won't go away, for example
- You can perform administrative tasks when you are working from a command prompt.
- A script (batch file, VBScript, PowerShell) gives you administrative rights.
There is no substance to a myth. Your account has administrator privileges, or it does not. There is no backdoor.
-
Running the logon script after AnyConnect VPN connection
Is it possible (such as the Launcher on the IPSec client) to run a login script after establishing a VPN connection? When a user connects to the VPN client AnyConnect I need to be able run a login script to map drives. I looked the ASDM, but see anywhere that it seems that this would be configured. I thought I would check to make sure I'm not missing something.
We lack ASA IOS v8.2 (2), ASDM 6.2 (5).
Thank you.
You can learn more about the AnyConnect script capabilities on the link below...
-
Hello
If I run the calc script to aggregate a BSO cube, it blocks and release each block in a few seconds? Or is it keep held locked blocks even after aggregation for this block is over?
For example if I correct sparse dimensions Forecast, FY15, dec. and my accounts dimension is only dense, after calc has my senior level members in the accounts, it it will issue after updating (i.e. in fractions of seconds) or is agg keep it held in a lock?
I ask because I want to run scripts tot., but there is the update of our cube users. I never had a problem to start agg, while users are updating. But maybe I am lucky. If a user updates a closed block, they will receive an error message that I think. They may try to update again after a few seconds, I hope.
Thank you.
Locking behavior for BSO Essbase is described in the database administrator's Guide: http://docs.oracle.com/cd/E57185_01/epm.1112/essbase_db/dstinteg.html
It is certainly theoretically possible that a user can obtain a lock because of a calc, although I can't say I saw him be a problem in real-world applications (perhaps because access uncommitted is the default).
-
CDF to run commands / Shell scripts
Hi friends,
I need help serious here regarding the CDF function.
I created a JAR file to run batch/shell scripts via the calculation script.
I tested the JAR file and it works perfectly well that run without the calculation script, but I get errors including in Calc script, I get the error message.
Initially, the error was: error of Machine virtual Java and later, it is class not found.
Here are the steps to register the CDF:
1. place the JAR file in the location: E:\Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\udf\
2. update the file udf.policy with the following statement:
Grants all permissions to BatEx
give the code "file:${essbase.java.home}/BatEx.jar" {}
permission java.security.AllPermission;
};
3 restart the Essbase services.
4. I am trying to create this function at Global level so no mention is not the name of the Application in the MaxL at registration:
create or replace function '@BatEx' as
"BatEx.
Spec '@BatEx(Complete path in double quotes) '.
Comment "Functions A CDF that runs the batch file in Essbase Server";
5 this is the calc script:
@BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat '; -It gives an error: error: invalid syntax 1012000 - not a command CALC [@BatEx]
I tried another way:
RUNJAVA @BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat '; -Gives an error: problem running [@BatEx 'E:/Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat']: [can't find @BatEx class]
Where I am wrong here? Please help me out here.
Kind regards
RB
Thanks much Amit and Jake! I finally cracked!
Sad thing is that I have found no OTN correct information regarding function Java Custom, rather there was a lot of information about CDFs pre-existing provided by Oracle, so I decided to write a complete solution of CDF, where Java code too was created by the developer of Essbase applications.
The requirement that I had was to trigger the batch file in the calculation script. Here is the detailed requirement:
Update Variable of Substitution by planning web form.
1. the user enters the data in the form of the planning web and saves it.
2. the calc script attached to the web form, extracts data and records the flat file on Essbase server.
3. earlier we were executing the script batch on the web server as the workflow will identify the lots on the web server and not on Essbase server, but after the development of this CDF to run the batch job, the batch files can be run directly Essbase server.
4. the idea is to keep the user limited to the tasks list, so that it does not jump to the to-do list to SubVar web form, workflow and then return to the task list for a simple job to change SubVar.
There were a few challenges that I encountered during the development of this JAVA function, namely:
1 function CDF records do not : I tested JAVA code separately using command line and the executable Jar file will execute the batch, as expected. But I couldn't get why my CDF is not have recorded trace. After a lot of searching on Google and analysis, I found that it was the difference between the Version of JAVA (the JAVA compiler I used to compile and create my JAR file) and JAVA (JVM Essbase) virtual machine. I used JDK 1.7 update 65 to compile and create my POT so that the JVM used in the Essbase Server Update 1.6 is 35. I uninstalled JDK 1.7 of my machine, downloaded Update 1.6 35 archives of the Oracle and recompiled the code. Guess what! My CDF function was recorded first.
So always check the compatibility of the Version of the JDK you used to compile and create the JAR file and JVM on your Essbase server.
You can check the version of the JVM in console EAS-> EssbaseCluster-> right click-> Edit-> properties-> tab environment. There is a line that appears something like:
; JvmModuleLocation $J (EPM_ORACLE_HOME)-...-jdk160_35\jre\bin\server\jvm.dll (the bold is your version of the JVM).
2. "main class not found" error after successful registration of CDF:
I haven't had that one category of Public in my JAVA code and this error took me by surprise. I also checked the "public static void main" section in my code and everything seems to be OK. Please note that JAVA is case sensitive - 'hand' and 'Hand' aren't even in JAVA.
I did some further research and one of John's response to a CDF request, I came to know that I need to include another argument (context) in the main section of my Java code and recompile with classpath "essbase.jar" (I will explain the controls in the next steps). I changed the main section of my JAVA code and included the argument:
Public Shared Sub main (paramContext context, String [] paramArrayOfString)
The following JAVA code to perform the batch in Essbase Server:
import com.hyperion.essbase.calculator.Context;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintStream;
public class BatEx
{
Public Shared Sub main (context, paramContext, String [] paramArrayOfString)
{
Try
{
String str1 = paramArrayOfString [0];
LocalProcess process = Runtime.getRuntime () .exec (str1);
InputStream localInputStream1 = localProcess.getInputStream ();
OutputStream localOutputStream = localProcess.getOutputStream ();
InputStream localInputStream2 = localProcess.getErrorStream ();
BufferedReader in = new BufferedReader (new InputStreamReader (localInputStream1)) localBufferedReader;
String str2;
While ((str2 = localBufferedReader.readLine ())! = null) {}
System.out.println (str2);
}
System.out.println ("package executed successfully.");
}
catch (Exception localException)
{
System.out.println ("error!:" + localException);
localException.printStackTrace ();
}
}
}
Install the (compatible to Essbase JVM) compatible version of the JDK on your machine. Compile the above code by using the following command:
C:\ >javac - classpath essbase.jar BatEx.java - please specify the path to the file "essbase.jar". It generally to the location:
: \Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\ The code should compile without any problem, and a .class file must be created with the same name.
Now is the time to create the JAR file. Use the following command:
C:\ >jar cf BatEx.jar BatEx.class
Now the executable JAR file must also be created.
Place this JAR file:
: \Oracle\Middleware\EPMSystem11R1\products\Essbase\EssbaseServer\java\udf\ Restart the service of Essbase and application (the only Application Restarting should work, but I didn't take any chances to restart both).
Check the log of function CDF recording applications. The application log should be at the location:
: \Oracle\Middleware\user_projects\epmsystem3\diagnostics\logs\essbase\essbase\app\ - The CDF enrollment message should be something like:
External function of [GLOBAL] [@BatEx] saved OK
I used the following MaxL to register my function in Essbase:
create or replace function '@BatEx' as
"BatEx.
Spec '@BatEx (StringArray).
Comment "Functions A CDF that runs the batch file in Essbase Server"
I used the following script to calc to run my CDF (fairly simple however):
ESS_LOCALE English_UnitedStates.Latin1@Binary
RUNJAVA BatEx ""
: / Oracle/Middleware/EPMSystem11R1/common/utilities/Test.bat ";" -Note: please replacewith the name of the physical drive. I went and checked the logs that the Test.bat written and "wallah! The log file had some content and 1 KB in size. I deleted the contents of the log file and checked again, the result was the same.
Hope this answer helps all of us who work on CDF that is clean.
Please like this post if this can help you in some way.
Thanks again to Amit, Jake and John for helping me solve this puzzle.
Kind regards
Amit Kumar Singh
-
Run the PLSQL Script from Batch file
I am trying to run a PL/SQL script in a batch file in sp1 Windows 7 Prof
N ° 1) I wrote a simple PL/SQL script:
--
-The scope of variables
--
DECLARE
v_sal number (7.2): = 50000;
v_comm number (7.2): = v_sal *. 20;
v_message varchar2 (100): = 'eligible for the commission;
BEGIN
declare
v_sal number (7.2): = 50000;
v_comm number (7.2): = 0;
v_total_comp number (7.2): = v_sal + v_comm;
Start
v_message: = "not committed not" | v_message;
dbms_output.put_line (' message of sub-block is ' | v_message);
dbms_output.put_line (' subblock v_comm is ' | v_comm);
end;
v_message: = 'seller '. v_message;
-dbms_output.put_line ('Main block v_total_comp' | v_total_comp); -Error: not visible in the main block
dbms_output.put_line ('Main block v_comm' | v_comm);
dbms_output.put_line (' main block message is ' | v_message);
END;
/
Step 2) then I wrote a simple batch TstBatch.bat file
sqlplus scott/tiger@orcl < PLSqlVarInputTst1.sql > > TstBatch.log
Step 3) in the BACK of cmd, I tried to run TstBatch.bat
C: > TstBatch.bat
The log file tells me that I have connected to Oracle Database 11 g Enterprise Edition Release...
Then a lot of SQL > SQL > SQL >... 26 times
Procedue of PL/SQL completed successfully.
Disconnected from Oracle database
I also tried running the PLSQL script in SQLPlus:
SQL: > @PLSqlVarInputTst1.sql
Tell me the procedure completed successfully.
QUESTION: So, where is the output of the PL/SQL script?
Hello
You must activate the output: Add the following line at the beginning of your PL/SQL script:
SET SERVEROUT ON
...
-
How can I run a VBScript script of in the handler script in Photoshop CS5?
I need to run a VBScript script on each file that is opened in Photoshop. The script event handler allows only to JS. There is no work around for this?
Thanks for any help.
You write a little JavaScript to call VB script.
var myVBscript = File ("pathToYourScript/vbscript.vbs");
myVBscript.execute ();
-
Create jobs that runs a powercli script every day at 20:00
Hi all
I'm looking for a way to add a powercli script to cron or schduler so that it runs every day at 20:00 say... I found average windows wrt link below
Is there better way that this can be done for powercli as well?
Thank you
AFAIK, except if you have a few programming specifialised run SW, Windows Scheduler did a good job.
BTW, Alan has also made a post on this, see running a scheduled task PowerCLI
-
a way to run a powershell script?
Y at - it another way to configure a script to be able to run by either double clicking on it or other means other than having opened powercli and goes the script and it works.
It is not the best way to do it, but to help people not use powercli it will help running. The script that I know is very well to run... we are running win2k8 if it matters
You can create a shortcut and under properties make it a race of PowerShell.exe.
You pass as an argument to the PowerShell script runs.
In the script, you ensure that the pssnapin PowerCLI is loaded.
For example, the target of the shortcut can be
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe-fichier 'MyScript.ps1.
You add in MyScript.ps1
Add-PSSnapin VMware.VimAutomation.Core
before that the script uses a PowerCLI cmdlet.
-
How to run the powershell script of command with several parameters
Is there a way to run a powershell script from the dialog box run with several parameters? In addition, the path to the script contains spaces, for example, c:\powershell scripts\script.ps1.
Take a look at http://www.powershell.nu/2009/12/16/running-scripts-with-arguments-in-powershell/ which explains how to pass arguments to a script.
André
Maybe you are looking for
-
I added an external keyboard and an external monitor to my HP Envy laptop m7-n011dx. Both are recognized by the laptop, if I leave the lid open. When I close the lid, the computer goes into mode 'sleep', and I can't use the laptop with the keyboard
-
5s battery drain due to low signal
My battery was in charge when I went to bed and died at 100% this morning as 0 zero! 60% of the use of the battery was weak signal. I have a connection problem with this phone to the ATT network. My other 4 iPhones work very well so it is not the
-
HP Pavilion p7-1020: upgrade to USB 3.0 (P7-1020)
Hello! I've had my p7-1020 for several years now and I'm very happy with it. However, it has currently only USB 2.0 ports and I would really like to install some ports USB 3.0 for increased efficiency. I have previously updated the video card in my P
-
How can I remove an existing model components?
I have an old drawing is updated. Several items have been removed from the schematic in Multisim, and changes have been annotated with impatience to Ultiboard. The components were still available to Ultiboard PCB (all other programs I've used automat
-
programs in my Start menu disappeared
Hi can someone tell me how to get my programs to display in my Start menu? I got some virus and he did my icons disappear off my Start button so now I can get one of my prgrams. I caught the virus deleted and I was told that the virus hidden my progr