in reply to Re: How do I run a perl script with an alternate perl.exe from Padre?
in thread How do I run a perl script with an alternate perl.exe from Padre?
Thanks, I thought that had something to do with the beginner mode mentioned just above it, but you were correct. I have since wrapped my bat file into an exe with this ( http://www.f2ko.de/programs.php?lang=en&pid=b2e ) converter. Nonetheless, I am getting an error about the executable seems to be no executable Perl interpreter, and the system default ( real strawberry Perl ) is being used instead. Any ideas on how I can resolve this? Would it be difficult to add an alternate run button to Padre for my Perl to Text scripts?
Here is the current version of the Powershell script
# perltxt.a4.ps1 Param( $perl_script_name = $NULL, $document_target_directory = [String]::join('', ($HOME, '\Desktop\ +PerlTxt Documents')) ) if($perl_script_name -ne $NULL){ $file_name_array = [System.IO.Path]::GetFileName($perl_script_name +).split('.') $file_location = [System.IO.Path]::GetDirectoryName($perl_script_ +name) if( (test-path $perl_script_name -PathType leaf) -and ($file_name_array[-1] -eq 'pl') ){ if ($file_name_array.length -gt 2){ $file_name = [String]::join('.', $file_name_array[0..($fil +e_name_array.length - 2)]) } else { $file_name = $file_name_array[0] } $time = Get-Date -Format 'yyyy-MM-dd-hh-mm-ss' #$time = 'time' $new_file_location = [String]::join('', ([IO.Path]::GetFullPa +th($document_target_directory), '\', $file_name)) $new_script_name = [String]::join('', ($new_file_location, '\ +', $file_name, '.', $time, '.pl')) $new_document_name = [String]::join('', ($new_file_location, +'\', $file_name, '.', $time, '.txt')) $out = & perl $perl_script_name 2>&1 } } else{ $out = [String]::join([Environment]::NewLine, ( 'No valid .pl (Perl) script specified', '', 'Perl to Text ( perltxt.exe )', '', 'is a hackish and slow tool to run Perl ( .pl ) scripts th +at are passed to it as an argument,', ' save the scripts and the output to timestamped text f +iles in a directory specified as the second argument', ' ( $HOME\Desktop\PerlTxt Documents\[Script name] i +s the default ),', ' and load the output onto the Windows clipboard.', '', + ' A sound is played when the script has finished and th +e clipboard is ready.', '', 'Use:> perltxt [path to your_perl.pl script] [optional pat +h to the target directory for the output files]', '', 'Direct comments and suggestions to horstman.jesse@yahoo.c +om')) } if($out -is [System.Management.Automation.ErrorRecord]) { # email or some other action here #Send-MailMessage -to me@example.com -subject "Error in gpg " -bod +y "Error:`n$out" -from error@example.com -smtpserver smtp.example.com } # Load System.Windows.Forms assembly. $null = [Reflection.Assembly]::LoadWithPartialName("System.Windows.For +ms") # Create a data object. $dataObject = New-Object windows.forms.dataobject # Add generated strings to the data object. $text = $out $dataObject.SetData([Windows.Forms.DataFormats]::UnicodeText, $true, $ +text) # Place the data object in the system clipboard. [Windows.Forms.Clipboard]::SetDataObject($dataObject, $true) $document = $dataObject.GetData([Windows.Forms.DataFormats]::UnicodeTe +xt) if($perl_script_name -ne $NULL){ # if((test-path $document_target_directory -isvalid) -and !(test-pa +th $document_target_directory -pathtype container)){ # new-item $document_target_directory -type directory # } if((test-path $new_file_location -isvalid) -and !(test-path $new_F +ile_location -pathtype container)){ new-item $new_file_location -type directory | Out-Null } #echo "PerlTxt has generated new files in $new_file_location" If(-not(Test-Path -path $new_script_name)) { Copy-Item $perl_script_name $new_script_name } else{ Remove-Item $new_script_name Copy-Item $perl_script_name $new_script_name } If(-not(Test-Path -path $new_document_name)) { New-Item -Path $new_document_name -ItemType file -Value $($doc +ument) -force | Out-Null } else{ $stream = [System.IO.StreamWriter] $new_document_name $stream.Write($document) $stream.close() } } cls echo $document [System.Media.SystemSounds]::Asterisk.Play(); exit
Here is the current version of the batch file that is used to invoke Powershell
REM perltxt.a4.cmd REM horstman.jesse@yahoo.com @echo off powershell.exe -sta .\perltxt.a4.ps1 %*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How do I run a perl script with an alternate perl.exe from Padre?
by Anonymous Monk on Jun 04, 2012 at 09:14 UTC | |
by Je55eah (Novice) on Jun 18, 2012 at 00:33 UTC | |
|
Re^3: How do I run a perl script with an alternate perl.exe from Padre?
by Anonymous Monk on Jun 04, 2012 at 08:01 UTC |