Saturday, July 4, 2020

#1 2020-04-28 02:10:26 pm

LookToWindward
Member
Registered: 2020-04-28
Posts: 14

GUI and File Libraries??

Hi,

I'm have a task it write a Utility in AppleScript, the Utility had to do a of File and Folder operations (copy file to folder, copy folder (and contents) to folder, delete file/folder, get all items of a folder, etc.). It needs to use POSIX paths wherever possible, since I will be processing list of POSIX paths (already in existence). Is there a library available to help with this?

Also, I'd like to give the App a Simple GUI (just a window with buttons, text boxes, menus, Scrolling Lists) is there a library available that does this? If this is not possible, then I'll need to make a number of scripts to handle the main functions of the Utility, but I'd rather just have one script with a GUI if possible.

Thanks in Advance
All the Best
Dave

Model: MacBook Are.
Browser: Safari 13.0.2
Operating System: macOS 10.14

Offline

 

#2 2020-04-28 02:34:48 pm

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4532

Re: GUI and File Libraries??

Such library is : FileManagerLib.scptd by Shane Stanley
I was accustomed to download it from :
https://www.macosxautomation.com/apples … _Libs.html

but, at this time and for several days, this link is broken (error 404).

Here is a new link : https://latenightsw.com/support/freeware/.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 28 avril 2020 22:33:52

Last edited by Yvan Koenig (2020-04-28 02:39:04 pm)

Offline

 

#3 2020-04-28 06:40:18 pm

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6395

Re: GUI and File Libraries??

LookToWindward wrote:

I'd like to give the App a Simple GUI



Have a look at Dialog Toolkit Plus on the same page that Yvan pointed you to:

https://latenightsw.com/support/freeware/

It won't do everything you list, but it should be a start.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Online

 

#4 2020-04-29 12:52:31 am

LookToWindward
Member
Registered: 2020-04-28
Posts: 14

Re: GUI and File Libraries??

Hi,

Thanks a lot, I've downloaded it, I'm checking out how it works now. Once thing does the library HAVE to be installed in Scripting Additions or can I just have a copy local to my script?

It will hopefully save me a lot of re-inventing!

All the Best
Dave

Offline

 

#5 2020-04-29 01:48:19 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4532

Re: GUI and File Libraries??

LookToWindward wrote:

Hi,

Thanks a lot, I've downloaded it, I'm checking out how it works now. Once thing does the library HAVE to be installed in Scripting Additions or can I just have a copy local to my script?

It will hopefully save me a lot of re-inventing!

All the Best
Dave




The library must be installed in " ~/Library/Script Libraries" or in "/Library/Script Libraries"

If my memory is right, you may also install them in your script, assuming that it's a package or an application, in the folder
"myScript:Contents:Resources:Library:"

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 29 avril 2020 09:48:06

Offline

 

#6 2020-04-29 01:55:13 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6395

Re: GUI and File Libraries??

Yvan Koenig wrote:

If my memory is right, you may also install them in your script, assuming that it's a package or an application, in the folder
"myScript:Contents:Resources:Library:"



Make that in the bundle's /Contents/Resources/Script Libraries/.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Online

 

#7 2020-04-29 02:24:17 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4532

Re: GUI and File Libraries??

Thank you Shane.
I was not sure that my memory was OK. It wasn't.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 29 avril 2020 10:24:05

Offline

 

#8 2020-04-29 04:25:19 am

LookToWindward
Member
Registered: 2020-04-28
Posts: 14

Re: GUI and File Libraries??

When I added the line:

use script "FileManagerLib" version "2.3.4"

To my script, I get an error elsewhere in the script "Expect end of line but found identifier".

I installed it to /Users/Dave/Library/Script Libraries/, "Script Libraries" didn't exist so I created it.

Is this the correct location? Any ideas how to fix?

Offline

 

#9 2020-04-29 04:34:42 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4532

Re: GUI and File Libraries??

The Script Libraries folder doesn't exists by default so it was correct to create it.

On my side I choose:
"SSD 1000:Library:Script Libraries:FileManagerLib.scptd:"

I guess that you missed one of the required instructions:

Applescript:

use AppleScript version "2.5"
use framework "Foundation"
use scripting additions
use script "FileManagerLib" version "2.3.4"

probably : use scripting additions

which is required to be able to work with scripting additions.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 29 avril 2020 12:34:35

Offline

 

#10 2020-04-29 04:55:23 am

LookToWindward
Member
Registered: 2020-04-28
Posts: 14

Re: GUI and File Libraries??

Thanks a lot, it was the Script Editor that threw me, I'd forgotten how bad it is at reporting errors sometime......

Working now, thanks again
Dave

Offline

 

#11 2020-04-29 05:33:45 am

LookToWindward
Member
Registered: 2020-04-28
Posts: 14

Re: GUI and File Libraries??

I'm looking at:

on objects of aFileOrPath searching subfolders recurseFlag : false include invisible items incInvis : false include folders incFolders : true include files incFiles : true result type resType : paths list

What is the syntax for using it? I've tried all manner of combo's but can't seem to get it right!

Offline

 

#12 2020-04-29 06:10:04 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4532

Re: GUI and File Libraries??

I'm not really surprised because it's not really self-explanatory.

Applescript:

use AppleScript version "2.5"
use framework "Foundation"
use scripting additions
use script "FileManagerLib" version "2.3.4"

set aFileOrPath to choose folder
-- search in subfolders returning only the folders
objects of aFileOrPath result type paths list with searching subfolders without include files and include invisible items
-- or
objects of aFileOrPath result type paths list with searching subfolders and include folders without include invisible items

-- search in subfolders returning only the files
objects of aFileOrPath result type paths list with searching subfolders without include folders and include invisible items
--or
objects of aFileOrPath result type paths list with searching subfolders and include files without include invisible items

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 29 avril 2020 14:09:23

Offline

 

#13 2020-04-29 06:34:47 am

LookToWindward
Member
Registered: 2020-04-28
Posts: 14

Re: GUI and File Libraries??

Thanks a lot got it now!

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)