How to get original image paths within iphotos library mac swift - macos

I am trying to get original file path of images from photos library. By using NSOpenPAnel i am able to get the photos library path i.e file:///Users/betteruse/Pictures/Photos%20Library.photoslibrary
I want to traverse the file and retrive the contents in Master folder. I am doing it in swift and stuck at this point. Please help me with this.

don't know what's swift but via finder u can right click on library file and open it as a package , u can make an alias of Masters, orbu can get it via terminal also with simple and usual cmds as cd and ls.

Related

How to make a download button godot

i've been working on a game in godot using gdscript. In this game I will need to download a txt file onto a user's computer at a click of a button so it can keep track of score. but when I make a file download it downloads into the source code what path should I make it.
code:
func _on_save_pressed():
var file = File.new()
file.open("save_data.txt", File.WRITE)
file.store_string(score)
file.close()
I have tried using /desktop and I would like this path to work for mac and windows.
Try file.open("user://save_data.txt", File.WRITE).
Documentation

Automator - Set a variable with the current path of my workflow app

I created this Automator app that creates the folders I need to start a new project, but I need to share it with my team, so instead of telling them to open Automator and set the path (doucments/projects/2020/) by themself. I was thinking that maybe they just can paste it in the 2020 folder, run the app and create the project folders in the same folder.
But I don't know how to set a variable with the current path where my Automator App it's saved. Any ideas? Thanks, guys!
My current workflow
To create a new folder in a specific location of the user's home folder, you can use the the special 'location' variables that automator defines. Click the variables tab button in the upper left corner of the automator window to see the full list of available variables...
So, to create a folder hierarchy like the one shown in the link, but at a standardized location in the documents folder, use a flow like the following:
Since Automator doesn't have a specific variable that gives the location of the created workflow app, if you want a path relative to the app's location you'd use a Run AppleScript action and try to path to me command, but every time I've tried it I've received weird errors which make me think that command doesn't work correctly in Automator. I mean, the following ought to produce the correct result, but it consistently errors out:
Maybe you can make it function...

using shutil.move() I accidentally renamed my desktop folder to cat.jpg

while messing around with shutil and os modules(working on a tutorial exercise). I accidentally moved my desktop folder to an image format type called cat.jpg which doesn't exist anymore, I wasn't trying to move but I was trying to rename the image using shutil.move() when I forgot to type the image's name after its path .I actually managed to fix it after about an hour of googling I recreated a folder and named it desktop then I restored it using previous versions.However, my question is where did the image(cat.jpg) and the original desktop folder go? I searched the whole computer without finding it. here's my code:
shutil.move("c:\\users\\nate\\desktop","cat.jpg")
which output:
'cat.jpg'
I found the desktop folder in the Python folder and its named desktop.jpg but it's still an actual folder containing all the file that I had .However, when I tried to delete it, I got a message saying that the file is shared in the name cat.jpg and asking me to be sure .so anyways just wanted to tell that so anybody facing the same problem will know where to look and what to do .

How to generate a tiff/box file from an image to train Tesseract in Windows

I'm trying to train Tesseract in Windows and for that I need a pair tiff/box file and I'm trying to create it using jTessBoxEditor but it doesn't accept images as input. I've also tried boxFactory but it doesn't run properly. Does anyone know what is the best tool to create the pair from images?
Thanks
If you have jTessBoxEditor, then you have Tesseract bin files. Go to the tesseract-ocr subfolder of jTessBoxEditor and run the following command :
tesseract.exe D:\testocr\TestImage.tif D:\testocr\TestImage batch.nochop makebox
It should generate the file D:\testocr\TestImage.box.
Then in jTessBoxEditor, go to Box Editor tab and open your image. The box file is automatically loaded, you can check if everything is ok and correct possible mistakes.
I had this same kind of problem with being unable to properly open images with jTessBoxEditor in order to work with their boxes. I realized that one essential component is that the name of the .tif image and the name of the .box file must be identical, except for the different extensions. Without this, jTessBoxEditor won't be able to know which box file goes with which image. Thus, using the syntax suggested by darkpotpot above, then making sure the two file names match like indicated, then clicking on the "open" button in the Box Editor tab of jTessBoxEditor should work.

Get path to folder using uigetfile in Matlab

I know that you can create a file browser in Matlab using uigetfile. However, I want the user to be able to select a destination folder. I am currently using the following code:
[filename, pathname] = uigetfile;
Using this, the user has to select a file within the destination folder in order to actually be able to close the file browser. Is there a better way of doing this ? For example, allow the user to select a folder and this closes the file browser whilst returning just the path to the chosen folder. Your help is much appreciated.
UIGETDIR is what you're looking for.

Resources