<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Add document name to windows window title, for timetracking in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/add-document-name-to-windows-window-title-for-timetracking/m-p/12401071#M2410</link>
    <description>&lt;P&gt;I am using time tracking software, it captures the program title name. But unfortunately it cannot differentiate on which document/part I was working on inside fusion360.&lt;/P&gt;&lt;P&gt;Is there a way to enable the option to show the document name in the title property of windows?&lt;/P&gt;&lt;P&gt;Now it is showing 'Autodesk Fusion 360' would be nice to be able to cutomize it like for example:&lt;/P&gt;&lt;P&gt;'Fusion360 - partIamworkingon'&amp;nbsp; or (maybe) even better: 'Fusion360 - activeproject'&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone build a plugin for this for autocad, so I guess it should be possible for fusion360 also right?&lt;/P&gt;</description>
    <pubDate>Sun, 26 Nov 2023 14:40:49 GMT</pubDate>
    <dc:creator>productbakery</dc:creator>
    <dc:date>2023-11-26T14:40:49Z</dc:date>
    <item>
      <title>Add document name to windows window title, for timetracking</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/add-document-name-to-windows-window-title-for-timetracking/m-p/12401071#M2410</link>
      <description>&lt;P&gt;I am using time tracking software, it captures the program title name. But unfortunately it cannot differentiate on which document/part I was working on inside fusion360.&lt;/P&gt;&lt;P&gt;Is there a way to enable the option to show the document name in the title property of windows?&lt;/P&gt;&lt;P&gt;Now it is showing 'Autodesk Fusion 360' would be nice to be able to cutomize it like for example:&lt;/P&gt;&lt;P&gt;'Fusion360 - partIamworkingon'&amp;nbsp; or (maybe) even better: 'Fusion360 - activeproject'&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone build a plugin for this for autocad, so I guess it should be possible for fusion360 also right?&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2023 14:40:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/add-document-name-to-windows-window-title-for-timetracking/m-p/12401071#M2410</guid>
      <dc:creator>productbakery</dc:creator>
      <dc:date>2023-11-26T14:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Add document name to windows window title, for timetracking</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/add-document-name-to-windows-window-title-for-timetracking/m-p/12404558#M2411</link>
      <description>&lt;P&gt;I did a quick Google search and it shows some examples of using the Windows API from Python. There are Windows API functions to get the Hwnd of a window given the name of the window (FindWindow or FindWindowEx) and another to set the name of the windows (SetWindowText). I tried it for a few minutes because it looked like it might be easy, but I couldn't get it to work. It's probably something simple I'm doing wrong but I don't have more time to play with it. You can also listen to the documentActivated event and set the window text based on the currently active document.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Nov 2023 04:27:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/add-document-name-to-windows-window-title-for-timetracking/m-p/12404558#M2411</guid>
      <dc:creator>BrianEkins</dc:creator>
      <dc:date>2023-11-28T04:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Add document name to windows window title, for timetracking</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/add-document-name-to-windows-window-title-for-timetracking/m-p/12413445#M2412</link>
      <description>&lt;P&gt;Thank you Brain for this usefull tip. I have been experimenting with this and am close to a working solution.&lt;BR /&gt;Amazing that such thing is even possible with python &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the code I use for finding and changing the window title.&lt;/P&gt;&lt;P&gt;Funny thing is that it keeps on renaming the found window about 10 times because it finds the window over and over again.&lt;/P&gt;&lt;P&gt;I tried to add a flag so it only does it once, but then, for some strange reason the window title does not get changed.&lt;/P&gt;&lt;P&gt;It seems it need to do it at least 5 times to get it right... So I just keep the code as is now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import ctypes

# Define the callback function to enumerate windows
def enum_windows_callback(hwnd, lParam):
    class_name = ctypes.create_string_buffer(256)
    title = ctypes.create_string_buffer(256)

    # Get the window class name
    ctypes.windll.user32.GetClassNameA(hwnd, class_name, 256)

    # Get the window title
    ctypes.windll.user32.GetWindowTextA(hwnd, title, 256)

    # Check if the window title contains the keyword "Fusion" or "F360"
    if b"F360" in title.value or b"Fusion" in title.value:
        # Change the window title to "F360 - projectname"
        ctypes.windll.user32.SetWindowTextA(hwnd, b"F360 - projectname")
        print("Window title changed successfully.")

    return True

# Enumerate all top-level windows and call the callback function
ctypes.windll.user32.EnumWindows(ctypes.WINFUNCTYPE(ctypes.c_bool, ctypes.c_int, ctypes.c_int)(enum_windows_callback), 0)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Dec 2023 15:22:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/add-document-name-to-windows-window-title-for-timetracking/m-p/12413445#M2412</guid>
      <dc:creator>productbakery</dc:creator>
      <dc:date>2023-12-01T15:22:55Z</dc:date>
    </item>
  </channel>
</rss>

