Giter Club home page Giter Club logo

Comments (27)

ChristoferK avatar ChristoferK commented on June 27, 2024 2

@xilopaint @GrimlocK38 Hello, thanks for nudging me. I've been distracted by multiple projects, plus my day job.

[ I'm a medical doctor and the entire year has been swallowed by CoViD, my time hasn't felt like my own. ]

I did write the replacement handler for converting a TIFF to and saving as a PNG. I have, erm, 164 script documents open in CotEditor, so it's in one of these. I've just written a JXA routine to search the open documents and bring the windows to the front, so I'll post some code this weekend.

Unrelated query: On contemplating installing Big Sur this weekend also, from the perspective of the impact the new OS has had on scripting, and any software that either of you might use, has the upgrade been painful at all, and is there anything useful to be aware of in advance ?

Alfred, Keyboard Maestro, Typinator, FastScripts, iTerm, FiSH shell, JXA, AppleScript, Hammerspoon, EventScripts, plus any scriptable applications that notably do less well since upgrading.


Bonjour, merci de m’avoir ecrivent. J’ai été distrait par plusieurs projets, et mon travail de jour (Je suis médecin et toute l’année a été avalée par CoViD, mon temps n’a pas senti comme le mien).

J’ai écrit le subroutine de remplacement pour convertir un TIFF et économiser comme un PNG. J’ai, erm, 164 documents de script ouverts dans CotEditor, donc c’est dans l’un d’eux. Je viens d’écrire une routine JXA pour rechercher les documents ouverts et apporter les fenêtres à l’avant, donc je vais poster du code ce week-end.


Requête sans rapport: Sur la contemplation de l’installation de Big Sur ce week-end aussi, du point de vue de l’impact du nouveau système d’exploitation a eu sur le scripting, et tout logiciel que l’un de vous pourrait utiliser, a la mise à niveau a été douloureux à tous, et y at-il quelque chose d’utile d’être conscient à l’avance?

Alfred, Keyboard Maestro, Typinator, FastScripts, iTerm, FiSH shell, JXA, AppleScript, Hammerspoon, EventScripts, ainsi que toutes les applications scriptables qui font notamment moins bien depuis la mise à niveau.

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024 1

@ChristoferK Thank you for your service, Doc!

from alfred-about-this-mac.

ChristoferK avatar ChristoferK commented on June 27, 2024 1

Here we go, guys. This is the chunk of code that will safely generate the machine icon, saving it as a PNG image file, and returning the path to the file:

use scripting additions
use framework "AppKit"

property this : a reference to the current application
property nil : a reference to missing value
property NSBitmapImageRep : a reference to NSBitmapImageRep of this
property NSWorkspace : a reference to NSWorkspace of this

property filepath : POSIX file "/tmp/machine.png"

tell (TIFFRepresentation of iconForFileType_("'root'") ¬
	in the sharedWorkspace of NSWorkspace) to tell ¬
	representationUsingType_properties_(4, nil) of ¬
	(NSBitmapImageRep's imageRepWithData:it) to if ¬
	writeToURL_atomically_(filepath, yes) then ¬
	return the filepath's POSIX path

Do you want me to upload this as an .applescript file attachment ?

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024 1

Do you want me to upload this as an .applescript file attachment ?

Yes, please. After we test it you can submit a PR if everything is ok.

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024

Hi! I can't reproduce your issue on my side. The machine.png icon is retrieved by the getMacIcon.applescript created by @ChristoferK. I got in touch with him and he will help us in the coming days to debug the issue.

from alfred-about-this-mac.

ITRecords38 avatar ITRecords38 commented on June 27, 2024

Hi! I can't reproduce your issue on my side. The machine.png icon is retrieved by the getMacIcon.applescript created by @ChristoferK. I got in touch with him and he will help us in the coming days to debug the issue.

Hi,

Really nice. Thank you. I'm waiting for your return 😉

from alfred-about-this-mac.

ChristoferK avatar ChristoferK commented on June 27, 2024

@GrimlocK38, sorry for keeping you waiting. To provide more clues as to where the problem might lie, and—just as importantly—where it does not, would you mind running the script below from within Script Editor ? It's a modified, stripped-down version of the script used by the Alfred workflow, containing only the essential lines necessary for generating the image appropriate for the machine.

Upon execution, the script should return either true or false. If it returns true, then you can run it again after removing the following line:

return the result

Removing that line will allow whatever image is generated by this script to open in Preview for you to discern whether or not it's what one would expect (i.e. not simply a blank image).


use framework "Foundation"
use framework "AppKit"

property this : a reference to the current application
property NSWorkspace : a reference to NSWorkspace of this
property sharedWorkspace : a reference to NSWorkspace's sharedWorkspace

property filepath : "/tmp/machine.tiff" as «class furl»

set root to the sharedWorkspace()'s iconForFileType:"'root'"
set tiff to root's TIFFRepresentation()
tell tiff to writeToURL:filepath atomically:yes

return the result


tell application id "com.apple.finder" to open filepath ¬
	using application file id "com.apple.Preview"

from alfred-about-this-mac.

ITRecords38 avatar ITRecords38 commented on June 27, 2024

Hi @ChristoferK

I waited wisely but no problem :)

I just tested and got the right result
screen

I removed the line and got the picture. Am I replacing everything in the script now ?

  1. These 2 pieces of information are reversed

screen

  1. you will update the info in the script for operation

Thanks

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024
  1. These 2 pieces of information are reversed

I take care of this part. Please, post the Terminal output for system_profiler SPHardwareDataType.

from alfred-about-this-mac.

ITRecords38 avatar ITRecords38 commented on June 27, 2024

Ok @xilopaint. Here

Last login: Fri Feb 19 06:48:14 on ttys000
itrecords@MacBook-Pro-M1 ~ % system_profiler SPHardwareDataType
Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro17,1
      Chip: Apple M1
      Total Number of Cores: 8 (4 performance and 4 efficiency)
      Memory: 16 GB
      System Firmware Version: 6723.100.337.121.1
      OS Loader Version: 6723.100.337.121.1
      Serial Number (system): FVFDQ1ZGQ05P
      Hardware UUID: 00A09928-1610-502F-A415-78C10C428972
      Provisioning UDID: 00008103-001C644420C0291E
      Activation Lock Status: Enabled

itrecords@MacBook-Pro-M1 ~ % 

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024

Could you test this build and post here the Alfred UI output image?

It should fix the processor part. I need the Terminal output for system_profiler SPDisplaysDataType to debug the graphics part.

from alfred-about-this-mac.

ITRecords38 avatar ITRecords38 commented on June 27, 2024

@xilopaint,

I test. Thanks and here the processor part.

Last login: Fri Feb 19 08:27:22 on ttys000
itrecords@MacBook-Pro-M1 ~ % system_profiler SPDisplaysDataType
Graphics/Displays:

    Apple M1:

      Chipset Model: Apple M1
      Type: GPU
      Bus: Built-In
      sppci_cores: 8
      Vendor: Apple (0x106b)
      Metal Family: Supported, Metal GPUFamily Apple 7
      Displays:
        Color LCD:
          Resolution: 3360 x 2100
          UI Looks like: 1680 x 1050 @ 60.00Hz
          Main Display: Yes
          Mirror: Off
          Online: Yes
          Automatically Adjust Brightness: No
          Connection Type: Internal

itrecords@MacBook-Pro-M1 ~ %

Result

For image of processor possible logo Apple or not ?

screen

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024

For image of processor possible logo Apple or not ?

I'm looking for an icon for Apple M1. Btw, Apple M1 is the right title for the graphics. What is this icon for the graphics, by the way? Did you put it by yourself? And why the resolution differs from your first image?

from alfred-about-this-mac.

ITRecords38 avatar ITRecords38 commented on June 27, 2024
  1. For icon m1. Ok

  2. for the resolution I did not touch anything. I restarted the script by the editor. it can come from that

  3. By cons "About this Mac“ graphic lost

aboutthismac

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024

3. By cons "About this Mac“ graphic lost

I don't get what you tell here.

from alfred-about-this-mac.

ITRecords38 avatar ITRecords38 commented on June 27, 2024

Sorry @xilopaint

I don't know if it's the script that at modify this part.

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024

Sorry @xilopaint

I don't know if it's the script that at modify this part.

I'm struggling to understand you. Please, use Google Translate, it should do a good job with French. The icon your image shows for the graphic chipset doesn't come from the workflow I distribute. Where did you get it?

from alfred-about-this-mac.

ITRecords38 avatar ITRecords38 commented on June 27, 2024

for icon graphic chipset. i changed here
icon

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024

for icon graphic chipset. i changed here

I'm not asking where you changed but where you got the icon from.

from alfred-about-this-mac.

ITRecords38 avatar ITRecords38 commented on June 27, 2024

@xilopaint, here : https://macosicons.com

from alfred-about-this-mac.

ChristoferK avatar ChristoferK commented on June 27, 2024

I waited wisely but no problem :)

I just tested and got the right result
screen

I removed the line and got the picture. Am I replacing everything in the script now ?

Not just yet. That was checking the core functionality of the script was doing what it was meant to, which means the problem with the original script must be in the conversion of the TIFF data to PNG data. The script achieved this previously using Image Events, which is the part of the process that is most likely to fail from upgrading to Big Sur (although it's strange that it appears to work as before for @xilopaint).

To be safe, I'll rewrite the script to perform the conversion without using Image Events.

On a minor note, the Objective-C method used to create the icon, namely iconForFileType:, is now deprecated as of Big Sur. There's a new method called iconForContentType:, which I will test when I install Big Sur. Since deprecated methods tend to remain functional for at least one major OS version, this isn't crucial right now.

I'll post an updated script this week. Thanks for your patience.

from alfred-about-this-mac.

ITRecords38 avatar ITRecords38 commented on June 27, 2024

Hi @ChristoferK,

Thanks for your return. No problem, I wait wisely. Thanks to you 2 for the follow-up and the update :)

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024

@ChristoferK any news on this?

from alfred-about-this-mac.

ITRecords38 avatar ITRecords38 commented on June 27, 2024

@xilopaint @ChristoferK

Hi, I wait wisely. hoping that chris will be able to give us this update. Thanks again

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024

Do you want me to upload this as an .applescript file attachment ?

@ChristoferK could you upload the file so we can test the new implementation?

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024

@ChristoferK 👋

from alfred-about-this-mac.

xilopaint avatar xilopaint commented on June 27, 2024

Apple Silicon support has been added.

from alfred-about-this-mac.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.