使用AppleScript的重新调整在X code进行窗口 [英] Use applescript to resize a window in Xcode

查看:650
本文介绍了使用AppleScript的重新调整在X code进行窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是在我的生活中使用X code / AppleScript的我第一次一 - 如果非常愚蠢的问题,很抱歉。无论如何,我有我的下档MainMenu.xib一个小测试窗口。我已经设置了每个具有随机测试功能各种(显示对话框,说的东西,请求密码等)选项卡下不同的按钮和事物的标签视图。在一个标签,我想有很多的测试内容,但在另一个选项卡中我只想要一点。是否有可能,当您更改选项卡,把它调整窗口的大小,以指定的尺寸?另外,我做了我的窗口未调整大小(否则格式化所有被调整大小时搞砸),并有可能让这个调整大小,即使你不能用鼠标调整?很抱歉,如果这没有任何意义,我将很乐意澄清应该有人需要它。任何帮助将是AP preciated,我一直在使用Google的相当多。

This is one of my first times using Xcode/AppleScript in my life - so sorry if very stupid question. Anyway, I have a little test window under my MainMenu.xib file. I've set up a tab view with different buttons and things under each tab that have all sorts of random test functions (displaying dialogs, saying things, requesting passwords, etc.). In one tab, I want to have a lot of test content, but in another tab I only want a little. Is it possible, when you change tab, to have it resize the window to specified dimensions? Also, I've made my window un-resizeable (otherwise the formatting gets all messed up when resized), and would it be possible to allow this resizing, even if you can't resize with the mouse? Sorry if this doesn't make any sense, I'll be happy to clarify should anyone need it. Any help would be appreciated, I've been googling for quite a bit.

推荐答案

要在AppleScript的调整窗口大小,你可以使用这个命令:

To resize windows in applescript, you can use this command:

tell current application to set the bounds of the front window to {24, 96, 524, 396}

所以,如果你想激活这样一个剧本,把这个在您的AppDelegate.applescript:

So if you want to activate such a script, put this in your AppDelegate.applescript:

on tabclick1_(aNotification)
    tell current application to set the bounds of the front window to {24, 96, 524, 396}
end tabclick1_

您可以那么这个连接到一个标签按钮,并设置窗口的范围,只要你喜欢。

You can then connect this to a tab button, and set the bounds of the window as you like.

您当然可以复制这一点,但然后更改名称tabclick1_,和边界,然后将其连接到另一个选项卡。
所以每次点击一个标签时,它会激活(例如,tabclick1_),其相应的脚本,而该脚本将更改窗口的范围。

You can, of course copy this, but then change the name "tabclick1_", and the bounds, and then connect it to another tab. So each time you click a tab, it will activate its appropriate script (for example "tabclick1_"), and that script will change the bounds of the window.

但你必须让你的窗口大小可调,并正确地固定你的对象。

But you will have to make your window resizable, and anchor your objects correctly.

重要提示:


  1. 界限的第一个项目是从左侧屏幕到你的窗口左侧的像素之间的距离。

  2. 界限的第二个项目是从屏幕顶部的窗口的顶部以像素为单位的距离。

  3. 界限的第三个项目是在从左侧屏幕到你的窗口右侧像素的距离。

  4. 界限的第四个项目是从屏幕顶部的窗口的底部以像素为单位的距离。

这篇关于使用AppleScript的重新调整在X code进行窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆