用这个脚本:

on write_to_file(this_data, target_file, append_data)
try
set the target_file to the target_file as string
set the open_target_file to open for access file target_file with write permission
if append_data is false then set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file on alfred_script(q) -- Write the command to run to a file. This is done because Applescript quoting is impossible to get right, esp. for backslashes.
set tmp_dir to path to temporary items as string from user domain
set applescript_alfred_file to tmp_dir & "alfredscript"
set alfred_file to POSIX path of applescript_alfred_file
write_to_file(q & return, applescript_alfred_file, false) -- Create this file, which prevents iTerm2 from restoring a saved window arrangement.
do shell script "touch ~/Library/Application' Support/iTerm/quiet'" -- Test cases:
-- 1. iTerm2 running, has windows open. Should open a new window for Alfred command.
-- 2. iTerm2 running, no windows open. Should open a new window for Alfred command.
-- 3. iTerm2 not running, set to restores arrangement. Should not restore arrangement but open a new window for the Afred command.
-- 4. iTerm2 not running. No windows to restore. Should open a single window for the Alfred command.
-- 5. iTerm2 not running. Has windows to restore. Restores windows and then opens a new window for the Alfred command. -- Compose a script. This is necessary because compiling in a 'tell application' command causes the app to be launched, which would happen prior to the creation of the quiet file.
set theScript to "tell application \"iTerm.app\"
if (exists current window) then
tell current window to create tab with default profile
tell current session of current window
write contents of file \"" & alfred_file & "\"
end tell
else
create window with default profile
tell current session of current window
write contents of file \"" & alfred_file & "\"
end tell
end if
activate
end tell" -- Invoke the script.
run script theScript -- Clean up
-- do shell script "rm -f ~/Library/Application' Support/iTerm/quiet' /tmp/alfredscript"
end alfred_script

参考:

http://time-track.cn/change-terminal-to-iterm-in-alfred.html

Alfred修改内置Terminal为iTerm的更多相关文章

  1. Ionic4.x Theming(主题) 增加内置主题 颜色 修改内置组件默认样式 修改底部 Tabs 背景颜色以及按钮颜色

    1.Ionic4.x Theming(主题) Ionic4.x 修改主题颜色的话需要在 src/theme/variables.scss 文件中修改. https://ionicframework.c ...

  2. Spring Boot修改内置Tomcat端口号 (zhuan)

    http://blog.csdn.net/argel_lj/article/details/49851625 ********************************************* ...

  3. Spring Boot修改内置Tomcat端口号

    spring Boot 内置Tomcat默认端口号为8080,在开发多个应用调试时很不方便,本文介绍了修改 Spring Boot内置Tomcat端口号的方法. 一.EmbeddedServletCo ...

  4. (一)Spring Boot修改内置Tomcat端口号--解决tomcat端口被占用的问题

    Spring Boot 内置Tomcat默认端口号为8080,在开发多个应用调试时很不方便,本文介绍了修改 Spring Boot内置Tomcat端口号的方法. 一.EmbeddedServletCo ...

  5. spring boot修改内置容器tomcat的服务端口

    方式一 在spring boot的web 工程中,可以使用内置的web container.有时需要修改服务端口,可以通过配置类和@Configuration注解来完成. // MyConfigura ...

  6. XAF-如何修改内置的编辑器(Property Editor)

    本示例演示在web/win中给 日期选择控制显示出一个时钟及修改时间的控件.效果如下: 如果你装了XAF在这个路径中已经有了这个示例: %PUBLIC%\Documents\DevExpress De ...

  7. springboot之修改内置tomcat配置项

    1.spring boot默认端口号是8080,如果要修改端口的话,只需要修改application.properties文件,在其中加入 例如: server.port=8081 2.在正常的项目中 ...

  8. Spring-Boot 内置静态资源文件地址修改

    Spring-Boot 内置MVC静态文件地址修改 Why:1.Spring-Boot修改内置SpringMVC静态资源路径,提高项目目录结构的安全性.2.配置拦截路径时可以剔除静态文件拦截How:1 ...

  9. springboot(八)内置SpringMvc静态文件地址修改

    参考:作者:恒宇少年链接:https://www.jianshu.com/p/c6ab1081fd5f   介绍: SpringMVC大家都不陌生,而被SpringBoot集成的SpringMVC除了 ...

随机推荐

  1. windows server2012部署apache项目访问后台管理系统时tomcat就停了是怎么回事

    是由于环境变量没有配好的原因,找不到jre目录 tomcat的运行需要JRE,一般启动闪退都是因为找不到JRE,也就是说环境安装JDK时环境变量没有配置好. 我们首先打开”命令提示符“窗口,输入jav ...

  2. JSP中的一个树型结构

    看方力勋的javaWeb,采用左右值来表示树型结构(就是俺门的多级分类)表结构 页面代码 <%@ page language="java" import="java ...

  3. linux安装mysql后root无法登录

    [root@localhost mysql]# mysql -u root -pEnter password: ERROR 1045 (28000): Access denied for user ' ...

  4. UVaLive 3126 Taxi Cab Scheme (最小路径覆盖)

    题意:有 n 个客人,要从 si 到 ti,每个人有一个出发时间,现在让你安排最少和出租车去接,在接客人时至少要提前一分钟到达客人的出发地点. 析:把每个客人看成一个结点,然后如果用同一个出租车接的话 ...

  5. [leetcode] 11. Same Tree

    因为我刷题是难度不是按发布日期,所以就有可能遇到这种情况,比如这个... Given two binary trees, write a function to check if they are e ...

  6. [leetcode] 8. Maximum Depth of Binary Tree

    可能是因为我是按难度顺序刷的原因,这个其实在之前的几道题里面已经写过了.题目如下: Given a binary tree, find its maximum depth. The maximum d ...

  7. 配置IIS Express,支持JSON

    方法有2种: 1. 命令行 a. cd "iis express的安装目录"  例如:cd C:\Program Files (x86)\IIS Express b. appcmd ...

  8. mono+jexus 部署Asp.Net Mvc5之CompilationException2

    好不容易在ubuntu上搭建了mono+jexus,欣喜若狂的部署上发布的网站,急忙打开,成功运行. 但是别高兴的太早,当我打开WebApi帮助页时出现了CompilationException. 一 ...

  9. tinymce与prism代码高亮实现及汉化的配置

    简单介绍:TinyMCE是一个轻量级的基于浏览器的所见即所得编辑器,由JavaScript写成.它对IE6+和Firefox1.5+都有着非常良好的支持.功能方强大,并且功能配置灵活简单.另一特点是加 ...

  10. .net core 2.1-----Sql Server数据库初体验

    刚开始接触asp.net core,在学习的过程中遇到了一些小问题,在这里记录一下! 在我们项目的开发过程中,肯定会和数据库打交道,所以我尝试了一下用asp.net core链接数据库,并读取表中的数 ...