首页 > 编程语言 >PHP写UltraEdit插件脚本实现方法

PHP写UltraEdit插件脚本实现方法

时间:2023-03-02 21:24:46浏览次数:31  
标签:脚本 插件 PHP ret UltraEdit php

UltraEdit可以扩展许多函数来减少我们编写的体力劳动,这个功能的调用是比较实用的,下面是给大家带来的PHP写UltraEdit插件脚本实现方法,一起进入下文了解一下吧!

需求:
1 svn上的代码在本地(编辑器UltraEdit)有一套,在开发机(centos)上有一套,需要本地的代码修改以后上传到开发机上

2 不直接在开发机上修改和使用,原因是有多个人都使用同一个开发机,为了保留本地备份

思路:

1 写一个脚本作为UltraEdit的插件,使得代码修改后按下制定按键就能直接将代码本地保存后上传到centos上

2 本地是windows,远程是linux,文件上传工具可以使用pscp.exe,脚本语言使用PHP或者Python

3 本地必须安装PHP,不需要安装数据库和apache

4 在PHP中起一个进程调用pscp.exe, 解析路径等逻辑放在php.html" target="_blank">php中


步骤:

1 UltaEdit中在工具配置中设定好脚本

php "C:\Users\nickyjf\Desktop\mesh\Tools\syncFile\sync142.php" %p%n%e

后面的%p%n%e是当前编辑文件的绝对路径,作为参数传入synv142.php中

?

?

image

2 sync142.php代码

?

?

复制代码 代码如下:

?


<?php
//插件,将windwos文件同步到linux上
//php "rsync142.php" %p%n%e
//valid argv
//testCode
/*
$argv = array(
"rsync142.php",
"E:\\SVN\\test\\www\\include\\ggg\\test\\DTest.php",
);
*/
if(count($argv) == 2)
{
$sFilePath = $argv[1];
$sServerName = "192.168.10.142";
$sServerUserName = "name";
$sServerPassword = "password";
$sServerPath = sGetServerPath($sFilePath);
$realPath = sprintf("%s@%s:/%s", $sServerUserName, $sServerName, $sServerPath);
try
{
$cmd = sprintf("pscp.exe -pw %s %s %s", $sServerPassword, $sFilePath, $realPath);
echo $cmd."\n";
system($cmd);
}
catch(Exception $e)
{
print_r($e);exit;
}
}
function sGetServerPath($sWindowsPath)
{
$ret = "";
$paths = explode("\\", $sWindowsPath);
if($startKey = array_search("www", $paths))
{
$ret = "test/";
for($i=$startKey+1; $i<count($paths); $i++)
{
$ret .= $paths[$i] . "/";
}
$ret = trim($ret, "/");
}
return $ret;
}
?>

?

 

?

3 将pscp.exe放在sync142同级目录下 image ? 4 将按键Ctrl + 1 映射到这个脚本 于是在编写程序的时候只要按下Ctrl + 1就可以将当前脚本替换远程脚本 ?

标签:脚本,插件,PHP,ret,UltraEdit,php
From: https://www.cnblogs.com/maihaolink/p/17173567.html

相关文章

  • linux php8.x 编译安装
    安装各种依赖yum-yinstallwgetvimpcrepcre-developensslopenssl-devellibicu-develgccgcc-c++autoconflibjpeglibjpeg-devellibpnglibpng-develfreetype......
  • vue3自动引入插件
    unplugin-auto-import/vite配置完成之后使用refreactivewatch等无须import导入可以直接使用installnpmi-Dunplugin-auto-import vite配置//vite.confi......
  • 项目插件记录
    效果类:无缝滚动 vue-seamless-scroll安装后局部引入,做列表无缝滚动<script>importvueSeamlessScrollfrom'vue-seamless-scroll'exportdefault{co......
  • sublime 3 离线安装xml、json格式化插件
    sublime3离线安装xml、json格式化插件插件地址: https://shanle.lanzout.com/iVwrZ0p1pqdg下载后:preference--browsePackage-丢到弹出的文件夹里使用:slection-f......
  • PHP: PhpStorm单元测试报错:PHPUnit Cannot open file
    问题描述版本:PhpStorm2019.3.4PhpStorm单元测试报错PHPUnitCannotopenfile问题分析PhpStorm2019.3.3不支持PHPUnit9、需要使用PHPUnit8.*问题解决compose......
  • 2009-08-自己刷简历收到PHP面试邀请
     转眼已经是答辩后的第二个月了,这期间刘文轩又收到过几次面试邀请。但最终都没能收到Offer。从上次陪女朋友去面试发现老师没有安排自己面试后,刘文轩索性自己主动出击,开......
  • php对接飞书机器人报警接口
    <?phpfunctionrequest_by_curl($remote_server,$post_string){$ch=curl_init();curl_setopt($ch,CURLOPT_URL,$remote_server);curl_setopt($c......
  • lodop打印插件
    日前做一个批打卡片和批打条码的功能模块,在网上搜索了好久,发现有一款插件lodop很是好用,很好的完成了功能实现,而且使用方便,在此做下笔记望以后有所帮助。Lodop支持IE系列、IE......
  • 如何在linux下手动构建PHP项目运行环境(lnmrp)
    引用https://www.cnblogs.com/studyandstudy/p/16190139.html前言我之前在构建PHP项目运行环境,直接采用宝塔或者PHPstduy等一键集成安装工具,虽然操作简单,运营维护起来......
  • php对接钉钉机器人报警接口
              <?phpfunctionrequest_by_curl($remote_server,$post_string){$ch=curl_init();curl_setopt($ch,CURLOPT_URL,......