用这个脚本:

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. zz如何让你的婚姻天长地久?

    如果天长地久意味着一列永不出轨的火车,下面有关婚姻生活的战略就像制定一张准确的运行时刻表.因为成功的婚姻并非源于机运,所谓的七年之痒也不是空穴来风.对那些已婚男人来说,他们需要计划——为了一年比一年过 ...

  2. redhat6.7在线安装postgresql9

    原文:http://wandejun1012.iteye.com/blog/2015777 1.安装postgresql9.0 yum 仓库 rpm -i http://yum.postgresql. ...

  3. 前端福利之盘飞那个 "阿里矢量图" (转)

    一.准备工作 1.首先,进入阿里的矢量图标库,在这个图标库里面可以找到很多图片资源,当然了需要登录才能下载或者使用,用GitHub账号或者新浪微博账号登录都可以 2.登录以后,可以搜索自己需要的资源, ...

  4. How To Make A DFF Read Only Through Form Personalisations? (文档 ID 1289789.1)

    In this Document   Goal   Solution   References APPLIES TO: Oracle Application Object Library - Vers ...

  5. [转载]灵动思绪EF(Entity FrameWork)

    很久之前就想写这篇文章了,但是由于种种原因,没有将自己学习的EF知识整理成一片文章.今天我就用CodeFirst和ModelFirst两种方式的简单案例将自己学习的EF知识做个总结. 在讲解EF之前, ...

  6. TSQL--标示列、GUID 、序列

    --1. IDENTIY 列不能为空,不能设默认值,创建后不能使用ALTER TABLE TableName ALTER COLUMN修改,每张表只能有一个自增列--2. 查看当前值:SELECT I ...

  7. zookeeper的主要应用

    master选举 数据发布和订阅 负载均衡

  8. H - Birthday Paradox (生日悖论)

    点击打开链接 Sometimes some mathematical results are hard to believe. One of the common problems is the bi ...

  9. 【timeisprecious】【JavaScript 】JavaScript RegExp 对象

    JavaScript>RegExp正则表达式 1 .From Runnob JavaScript RegExp 对象(概览) JavaScript RegExp 对象(教程) RegExp 对象 ...

  10. django_jquery中使用ajax发送post请求变成get请求

    今天在进行js开发的过程中出现了一个奇怪的问题,就是使用ajax向后端发送post请求时,在浏览器network中查看response时,显示400 bad request 并且请求方式变成get,因 ...