Setting position of desktop window

Hello,
I'm probably dreaming, but seems to me I've done this before; no success now.
This works:
Tell app "Finder"
open startup disk
set position of container window of startup disk to {50,50}
end tell
This doesn't:
Tell app "Finder"
open file "PT.rtf" of startup disk --this opens properly
set position of (?) to {50,50} --*
end tell
* The goal is to position the window of "PT.rtf"; have tried several things for ?, including a window ID approach, but always get error
An unrelated (I think) TextEdit question:
I've created a formatted TextEdit file with AS, setting font characteristics, bounds, etc. -- and then saved it to be called by another script at another time (that works). Is there any way to edit the properties of that file without editing and rerunning the script that originally created it? For example, just changing the bounds? If there is, I haven't found it.
Thanks

> The primary question had to do with setting the POSITION (not the bounds) of a TextEdit window on the desktop. This seems to me to be a Finder task
Why do you think the Finder has anything to do with what another application does with its windows? It sounds like you're confusing desktop with screen. The Finder manages the desktop (disk icons, files on the desktop, etc.), but has no control over what any other application does with its windows.
If you want to control ApplicationX's windows then you need to tell ApplicationX what to do with them, not the Finder.
If I dissect your script:
Tell app "Finder"
now we're talking to the Finder
open file "PT.rtf" of startup disk
This opens the file, as you expect. The Finder uses the system directory to work out which application should handle .rtf files.
set position of container window of file "PT.rtf" of startup disk to {50,50}
'container' is a Finder object that relates to the item (folder, disk, etc.) that the target file is in. In this case the 'container' of the PT.rtf file is 'startup disk'
--or of "window 1 of app "TextEdit"
This is getting closer, but the Finder can't manipulate other application's objects
Kel's earlier suggestion is the right approach - once you've opened the document (which, incidentally, doesn't need the Finder at all), you tell TextEdit to set the window position as required. However, the kicker is that you didn't look at TextEdit's dictionary - if you did you'd notice that there isn't any position property for a window in TextEdit - you have to use bounds:
<pre class=command>tell application "Finder"
open file "PT.rtf" of startup disk
end tell
tell application "TextEdit"
set {l, t, r, b} to bounds of window 1
set bounds of window 1 to {50, 50, 50 + (r - l), 50 + (b - t)}
end tell</pre>
To explain, 'bounds' represents the four corners of the window - left, top, right, bottom. To reposition the window you provide four new coordinates. In my example, I set the top and left coordinates to 50 and calculate new bottom/right coordinates by adding 50 to the current window height (b-t) and width (r-l).
Incidentally, this is why I recommend not using the Finder to open the document. While it may be true that on your machine, today, TextEdit is the default application for .rtf files, it might not be true tomorrow, or on someone else's machine - you could change to SuperDuperText.app as your preferred .rtf application, so now you're asking the Finder to open the document (which will use SuperDuperText.app), then telling TextEdit to set the window bounds, even though it has no idea that you've just opened a document in some other application.
A better approach is to do it all in one tell block, targetting the specific application you want:
<pre class=command>tell application "TextEdit"
open file (path to startup disk as text) & "PT.rtf"
set {l, t, r, b} to bounds of window 1
set bounds of window 1 to {50, 50, 50 + (r - l), 50 + (b - t)}
end tell</pre>
>When the script which created the TextEdit document is run, the window position does get set properly, but in accordance with the bounds. When the document is saved and then opened, however, the positioning appears random (although the bounds remain correct).
This may be the crux of the problem - TextEdit documents do not save any position information. Because plain text and .rtf documents are expected to be portable (cross-platform), they don't store any position information since it may not be relevant to the target application. In this case, TextEdit is using its own algoritm to work out where to open the window, typically based on some offset from the last opened window.
In short there just isn't any way to store a window position in a plain text document.

Similar Messages

  • How to set position of iChat window

    Every time I begin a chat, the chat window opens in the middle of the screen and I move it to the corner where I like to put it so I can have others windows open and not block each other. How can I get the iChat program to remember the position of the chat window so that when I open it each time it goes to my preferred position on the screen? Thanks.

    Hi
    You need Chax http://www.macupdate.com/info.php/id/20056
    Tony

  • HELP!! How to get the position of active windows in the desktop

    How to get the position of active windows in the desktop

    You mean, active windows other than the program you're running, or windows the program puts there? And a real desktop (like where MyComputer is), or a desktop pane?

  • Can i set up remote desktop with my Mac Air and Windows 7 HP desktop?

    I am wanting to set up remote desktop with my Mac Air and HP windows 7 home edition desktop.  Is this possible and how do I begin setting this up?
    Thanks for the help!

    There is an app in the Mac App Store to use Microsoft Remote Desktop with a Mac: https://itunes.apple.com/us/app/microsoft-remote-desktop/id715768417?mt=12
    But according to their support site it requires Pro, Enterprise, or Ultimate in the Windows 7 side. http://technet.microsoft.com/en-us/library/dn473006.aspx
    If it was me, I would first look into Teamviewer to see if it will do what you need. It does work between Mac and Windows and it is free for non-commercial use. http://www.teamviewer.com/en/index.aspx

  • No longer able to drag remote desktop window

    I used to be able to grab the "Connection Bar" that's pinned to the top of a maximized remote desktop window, and drag the window away from the edge, over to another monitor, then push it against the top edge to have it become maximized on the
    other monitor.
    But now, when I grab the Connection Bar and try to drag, the bar will only slide left and right. I can't unmaximize the window by dragging the bar away from the edge. I can only change the position of the bar along the top edge.
    Of course, I can click the "Restore" icon on the bar and un-maximize it, then drag and dock the window in another monitor. But the point is, I used to be able to do it in one single fluid stroke, now I have to explicitly unmaximize. It used to
    be the case that just dragging the window away from the edge caused the window to unmaximize, but not now.
    Is there a setting that controls this "drag-to-restore-down" that I'm talking about? Or has this been intentially changed by some update?

    Hi,
    This is weird, I can drag it as my mind without any obstruction.
    I suspect this is interfered by some software conflict, please test in Clean Boot mode to see if this issue persists.
    How to perform a clean boot in Windows
    http://support.microsoft.com/kb/929135
    Alex Zhao
    TechNet Community Support

  • Setting up Remote Desktop Apps for access from a Mac with 2FA

    Hi
    Setting up Remote Desktop Apps for access from a Mac with 2FA.
    I have a server 2012 remote access gateway, with remote apps published(which uses single signon), behind a 2FA connection (web based) and want to know if its possible to allow macs to connect to the remote Apps behind it. i cannot permanently remove any
    of the above setup as it is a requirement.
    When i connect from a mac i can login to both the 2FA and remote access web pages and see all the apps but when i click on any app it downloads it to the mac and when i try to run it using Remote Desktop App for MAC i get an error :
    "httpendpointexception: 4, The non-proxy http connection failed to connect with the message: 500 internal Server Error."
    I have tried with 2fa turned off for testing and get the same result.Does it support 2012 TSGW server? does it support Remote desktop apps? as i cant find a definitive answer on either.
    Thanks in advance for any advice.

    Hi,
    Thank you for posting in Windows Server Forum.
    From Error description it seems to be a communication issue between your Mac and your RD gateway server. If you connect from extranet, you may need Remote Desktop Gateway or a VPN/Direct Access connection to your intranet, or forward port 3389 on your router.
    500 Internal Server Error seems to be a HTTP related error. 
    The HTTP status code in IIS 7.0, IIS 7.5, and IIS 8.0
    Also, please double check the settings if you have a RD gateway implemented in you intranet.
    http://redmondmag.com/articles/2013/12/24/rd-gateway-in-windows-server.aspx
    In Windows Server 2012 R2 RD Gateway pluggable authentication is also introduced. This allows custom authentication routines to be used with RD Gateway. For example building a two-factor solution on top of RD Gateway is now possible which allows doing token-authentication
    to the RD Gateway which works seamlessly with RD Web Access or RDP file launching.
    Please check below article for more information.
    Windows Server 2012 R2 is coming what does this add to RDS – VDI
    In addition, please provide the log file from the client for further research.
    Microsoft Remote Desktop -> About Microsoft Remote Desktop -> Send log via email
    Hope it helps!
    Thanks.
    Dharmesh Solanki
    TechNet Community Support

  • Desktop Windows Composition and Windows 8.1 Pro x64 [SOLVED]

    Hi, I'm Jenn, also new to these forums.
    I stumbled upon a problem when switching from Windows 7 x64 to Windows 8.1 Pro x64.
    I have the EXACT same setup, same laptop, same hardware, same programs, same configuration, everything.
    Windows 7 never did anything like the problem I now have in Win 8.1. Here's the problem;
    Whenever I run more than 1 3D application, after 1-5 minutes the screen blinks, and hangs the graphics of one, some or all the programs (randomly). It doesn't hang the actual program (or game), it just stops rendering the graphics -- I can still hear the software's
    sound and if I click around, I can hear myself interacting with it.
    I have ALL the latest drivers for the computer, motherboard, ALL devices including graphics cards etc. Also ALL Windows Updates installed, nothing more to install.
    All of the programs I use is specifically set to use only the nVidia adapter, forcibly through the nVidia Control Panel, so it's not a switching graphics problem because it's a laptop. Also, never was a problem in Windows 7 either.
    Here's what I gathered from event viewer right when it happened;
    A logon was attempted using explicit credentials.
    Subject:
    Security ID: SYSTEM
    Account Name: PIXIELIGHT$
    Account Domain: HYPERUNKNOWN
    Logon ID: 0x3E7
    Logon GUID: {00000000-0000-0000-0000-000000000000}
    Account Whose Credentials Were Used:
    Account Name: DWM-1
    Account Domain: Window Manager
    Logon GUID: {00000000-0000-0000-0000-000000000000}
    An account was successfully logged on.
    Subject:
    Security ID: SYSTEM
    Account Name: PIXIELIGHT$
    Account Domain: HYPERUNKNOWN
    Logon ID: 0x3E7
    Logon Type: 2
    Impersonation Level: Impersonation
    New Logon:
    Security ID: Window Manager\DWM-1
    Account Name: DWM-1
    Account Domain: Window Manager
    Logon ID: 0x412659B
    Logon GUID: {00000000-0000-0000-0000-000000000000}
    Process Information:
    Process ID: 0x304
    Process Name: C:\Windows\System32\winlogon.exe
    Special privileges assigned to new logon.
    Subject:
    Security ID: Window Manager\DWM-1
    Account Name: DWM-1
    Account Domain: Window Manager
    Logon ID: 0x412659B
    Privileges: SeAssignPrimaryTokenPrivilege
    SeAuditPrivilege
    SeImpersonatePrivilege
    An account was logged off.
    Subject:
    Security ID: Window Manager\DWM-1
    Account Name: DWM-1
    Account Domain: Window Manager
    Logon ID: 0x3E3290A
    Logon Type: 2
    So as you can see, DWM is logging in and out some account that can be all the way up to DWM-7 from what I've seen so far. It just logs in, sets some parameters and the directly logs out.
    This is a ONE-user system, Only my user account is on it, and remote login has been disabled.
    In Windows 7, at least DWM could be disabled - not that I ever had to, because it worked with all my stuff, but seeing as DWM is screwing up totally in Win8, I thought I'd just disable the server, but it's nowhere to be found.
    Also, it seems Microsoft changed how it works, the system has been redesigned to generate an OK even if it's still on, like this example below:
    DwmEnableComposition( DWM_EC_DISABLECOMPOSITION ) does not work on Windows 8, even though it returns S_OK.  Confirmation is by calling DwmIsCompositionEnabled(), which shows the former function had no effect.
    There's only 1 dwm.exe running.
    There's only 1 user logged in (me).
    There's only 1 user in the userlist (except for the Administrator account).
    Running only 1 of the softwares at a time is not an option for me, either for work or for home use, so how can I fix this?
    // Jenn

    Hi Jenn,
    Please take a look at the following article.
    http://msdn.microsoft.com/en-us/library/windows/desktop/hh848042(v=vs.85).aspx
    In Windows 8, Desktop Window Manager (DWM) is always ON and cannot be disabled by end users and apps.
    I suggest you to download and install the graphic driver from the manufacturer and check if this issue still exist.
    As you may have two graphic cards, we could temporally disable one and check if there are compatibility issues.
    Best regards,
    Fangzhou CHEN
    Fangzhou CHEN
    TechNet Community Support

  • Zooming image from mouse position(like in  windows vista photo gallery)

    hello all;
    here's my situation, hope someone can help..
    i wanna Zoom an image, which zoom from my mouse position
    like in windows photo gallery in windows vista
    so i do this..
    g2.translate(iMoux,iMouy);       
            g2.scale(zoom, zoom);       
            g2.translate(-iMoux,-iMouy);       
            g.drawImage(icon.getImage(), iSposx, iSposx, d.width/2-iValue, d.height-iBawah, null);
            g.drawImage(icon2.getImage(), d.width/2, iSposy, d.width/2-iValue, d.height-iBawah, null);the problem come when i move my mouse to the different location (like from top right to bottom left)
    the zoom image displayed in the screen like jump from latest location to new location
    anybody can help me...a clue how to do that?
    thx appreciate your help guys
    mao
    Edited by: KingMao on 31 Mei 08 14:27

    Hi Frank.
    Thanks for the response.
    Agreed, the pertinent question is why can't my colleague edit the JPG exported by Aperture. It's probably also worth pointing out, the same problem occurs with JPGs exported from iPhoto.
    The Windows software usually plays nicely with JPGs by all acounts, just not the ones I send - which I do via eMail or my public space on Mobile Me incidently.
    So, another key question is: all settings being equal (color profile, quality, etc.) are the JPGs as produced by iPhoto and Aperture indistinguishable from those produced by other apps on other platforms - i.e. does the use of JPG enforce a common standard?
    If that is the case, I suspect ours might be a permissions issue.
    According to the Microsoft support page on editing in Windows Live Photo Gallery, the inability to edit a picture is commonly caused by unsupported file type, or read-only attribute set on the file.
    Unfortunately, he and I are not in the same place, and he's not particularly au-fait with this type of problem solving. Hence, before involving him, I'd like to know:
    1. it's possible (i.e. someone else does it), and,
    2. what's involved (at my end and/or his).
    Thanks again,
    PB

  • I synced my Iphone 3G to my desktop Windows computer - now I own a Macpro and want to use that as my phones synced comp.  How do I switch?

    I synced my Iphone3G to my desktop windows computer.  I now own a MacPro and want to swap my phone sync to this laptop instead. Any ideas how?

    Try this way:
    set up your iTunes account, disable autosync in iTunes, connect your phone to your new Mac and right click on it in the device list and choose backup.iTunes will backup your phone without syncing.
    Transfer your purchases the same way, choosing "transfer purchases" this time.
    When you connect your phone for the first time, all media content will be erased. But you can restore your settings and app data from your manual backup afterwards.
    Don't forget to set up at least one contact and event on your new computer to be able to merge calendars and contacts when you sync the phone for the first time.
    About backups and what's saved:http://support.apple.com/kb/HT1766
    How to back up and restore:http://support.apple.com/kb/HT1414
    How to download apps for free again:http://support.apple.com/kb/HT2519
    How to save other data: How to back up your data and set up as a new device
    How to backup iTunes. How to back up your media in iTunes

  • I can't set shortcut for „Application windows"

    System Preferences → Exposé & Spaces → Exposé
    I can’t set shortcut for „Application windows” — first column with Fn key is OK, but the second column with mouse button doesn’t work. If I set „secondary mouse button” for „application windows”, it doesn’t work. But if I set „secondary mouse button” to „All windows”, it works! All mouse shortcuts for „All windows” or „Show desktop” work, but no mouse shortcut for „Application windows” work . The same with „Mouse button 3” and other buttons.
    Can you help me, please?

    Do you see the iTunes Library icon in the window? Click on it and the use the scroll bar to get to the tracks you want.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.≤br>
    Note: There now an Automator backup application for iPhoto 5 that will work with Tiger or Leopard.

  • I have an unexpected error setting up iCloud desktop with my Outlook Celandar

    Setting up iCloud desktop on my Windows 7 computer, I encounter an "unexpected error" when trying to set up the Outlook Calandar & Contacts. I don't see any indication on how to fix this issue.

    Done. Same result. Tried re-installing the iCloud Desktop as well. Same result.

  • How to retrieve all outputed graphic(jpg,bmp,icon) rect position in a window form?

    Is there a way to retrieve all outputed graphic(jpg,bmp,icon) rect position in a window form?
     Thx

    No. I don't think there will be such API to do so. Hooks may help do something related stuff.
    https://msdn.microsoft.com/en-us/library/windows/desktop/ms644959(v=vs.85).aspx

  • Positioning the Calendar Window under a button

    Hello,
    I wanna show that calendar under the button i've pressed. something like here (so like LOVS, they are opened under the button pressed)
    i tried with this code, in KEY-LISTVAL trigger for that text item
    declare
         pozx number:=get_item_property('btn_data',x_pos)+15;
         pozy number:=get_item_property('btn_data',y_pos)+15;
    begin
         --message(get_item_property('btn_data',x_pos));
    date_lov.get_date('01-jan-1980',         -- initial date
                      'angajati.data_nasterii',  -- return block.item
                      pozx,              -- window x position
                      pozy,              -- window y position
                      'Data nasterii',    -- window title
                      'OK',            -- ok button label
                      'Cancel',        -- cancel button label
                      TRUE,            -- highlight weekend days
                      FALSE,           -- autoconfirm selection
                      FALSE);          -- autoskip after selection
    end;     so i get the xpos and ypos of the button, and i add 15 because it's a square button of 15 px.
    however, my calendar window it's wrong displayed.. what i'm doing wrong?
    Thanks
    Edited by: Roger22 on 28.07.2009 17:57

    Hi!
    The get_item_property ( 'item', x_pos and y-Pos ) gives you the x_pos / y_pos of the position on the canvas.
    The set_window_property ( 'window', x_pos and y_pos ) sets the position on the screen.
    That is is a big difference.

  • Setting FIPS compliance on Windows 2008 R2 RDP

    We have 2 diffent GPO for setting FIPS.
    We add Group Policy (under Computer Configuration\Windows Settings\Security Settings\LocalPolicies\Security Options) or through the "FIPS Compliant" setting in Remote Desktop
    Session Host Configuration. 
    This works for RDP in a TEST OU.
    FIPS compliance can be configured through the "System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing" setting in Group Policy (under Computer
    Configuration\Windows Settings\Security Settings\Local Policies\Security Options) or through the "FIPS Compliant" setting in Remote Desktop Session Host Configuration. The FIPS Compliant setting encrypts and decrypts data sent from the client to
    the server and from the server to the client, with the Federal Information Processing Standard (FIPS) 140-1 encryption algorithms, using Microsoft cryptographic modules. Use this encryption level when communications between clients and RD Session Host servers
    require the highest level of encryption. If FIPS compliance is already enabled through the Group Policy "System cryptography: Use FIPS compliant algorithms for encryption, hashing, and signing" setting, that setting overrides the encryption
    level specified in this Group Policy setting or in the Remote Desktop Session Host Configuration tool.
    But, we have legacy GPO that sets the RDP to HIGH encryption.  It overwrites the FIPS Compliant for RDP. and RDP is only HIGH encryption.

    Install nmap then, Go to this link:
    http://nmap.org/svn/scripts/rdp-enum-encryption.nse
    copy the script and run from dos
    example:
    nmap -p 3389 --script rdp-enum-encryption <ip>replace <ip> with your server IP or DNS name. Script will display the encrption level.Example of script output:PORT     STATE SERVICE3389/tcp open  ms-wbt-server| rdp-enum-encryption:|   Security layer|     CredSSP: SUCCESS|     Native RDP: SUCCESS|     SSL: SUCCESS|   RDP Encryption level: High|     128-bit RC4: SUCCESS|_    FIPS 140-1: SUCCESS
    Thanks,
    MikeV
    MCSE 2012

  • Setting up Private Browsing window to open up when Safari icon is clicked on first.

    Setting up Private Browsing window to open up when only Safari icon is clicked on first, and remains after shut down.

    Hi css,
    Welcome to the Apple Support Communities!
    I understand that you would like to click on Safari in your Dock and have it open a new Safari Window. As you said in your post, clicking on Safari in the Dock brings the Safari window forward. There are a couple of possibilities to help resolve this situation. You can control-click (right click if enabled) on Safari in your Dock which will give you the option to open a new window. You can also click and hold on Safari, otherwise known as Press, to display these same options.
    Mac OS X: Additional features of the Dock - Apple Support
    Mouse clicks and key combinations for the Dock
    Control-click
    Reveals contextual menu for item. Menu choices vary per application or file. When used on Dock separator, it reveals Dock preferences. There you can turn magnification and hiding on or off, change the position of the Dock on screen, and change the minimization effect. Choose Dock Preferences to see more options.
    Press
    Reveals contextual menu for item. Menu choices vary per application or file.
    Cheers,
    Joe

Maybe you are looking for

  • BI Publisher Report Layout Get Distorted when viewed in different format

    Hi Experts, I am facing issue while running BI Publisher Report. The Report Layout work fine in one output format (PDF). But when the same report is generated in different format it get distorted (HTML,EXCEL). Could any one please let me know how to

  • Stock restricted to unrestricted

    Hello, I've got some stock in restricted-used in MMBE. Here are some complemnetary informations : - I've located the stock in wm in LS26 : I've succeed to make an inventory in WM to empty this stock - when I make a movement 322 : I see a line with my

  • Other tools/option to achieve Health check

    Hi guys, I saw that there are a lot threads open regarding health check. I`m searching for an open source tool/commercial tool, manually created scripts that can check all oracle prerequisite (system information, oracle kernel parameters, packages) a

  • How to change output header of v_v2 transaction

    I have to change the output header of v_v2 transaction . it is Log:backorder processing by material. I have to change this to Log:backorder processing Please any one can help me

  • Duplicata facture

    Bonjour, Depuis une heure je cherche une solution simple à mon problème ... Je cherche à obtenir un duplicata d'une facture de mon IPhone ayant égaré l'original. Mon IPhone a été changé suite à un bouton défectueux mais je ne trouve ni cette commande