Friday, May 29, 2020

#1 2020-04-06 02:21:42 am

Danjuan
Member
Registered: 2020-04-02
Posts: 14

Can Quoted Form and Text Returned be combined?

As per the title,

Can these two lines be combined?

Applescript:


set ProjectDestinationName to text returned of (display dialog "Type your Project Name" default answer "")
set ProjectTemplateFolder2 to quoted form of POSIX path of (ProjectDestinationName) -- ADDED


Filed under: applescript

Offline

 

#2 2020-04-06 03:02:39 am

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

Re: Can Quoted Form and Text Returned be combined?

You may use:

Applescript:

set ProjectTemplateFolder2 to quoted form of POSIX path of (text returned of (display dialog "Type your Project PathName" default answer "")) -- ADDED

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 6 avril 2020  11:02:34

Offline

 

#3 2020-04-06 04:13:45 am

KniazidisR
Member
Registered: 2019-03-03
Posts: 1259

Re: Can Quoted Form and Text Returned be combined?

Only here Posix path no need at all.
Because if you provide Posix path in the dialog, you already have Posix path, and should not ask for the Posix path of Posix path sad

Applescript:


set ProjectTemplateFolder2 to quoted form of (text returned of (display dialog "Type your Project PathName" default answer ""))

You need Posix path only when you provide in the dialog HFS path. But why provide HFS path and not provide directly Posix path, which need less typing...

Applescript:


"Macintosh HD:Users:Robert:Working:Test Project:" -- HFS path
"/Users/Robert/Working/Test Project" -- Posix path

So, makes sense to do your prompt clear:

Applescript:


set ProjectTemplateFolder2 to quoted form of (text returned of (display dialog "Type your Project's Posix path" default answer ""))

Last edited by KniazidisR (2020-04-06 04:36:20 am)


Model: MacBook Pro
OS X: Catalina 10.15.4
Web Browser: Safari 13.1
Ram: 4 GB

Offline

 

#4 2020-04-06 07:38:59 am

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

Re: Can Quoted Form and Text Returned be combined?

Maybe the asker paste an Hfs path copied from some source.
I do that quite often.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 6 avril 2020  15:38:50

Offline

 

#5 2020-04-06 11:21:15 am

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

Re: Can Quoted Form and Text Returned be combined?

We don't know why the OP use this protocol.
I just assume that he has some reason.

Choosing to use Display dialog may make sense if he wish to be able to type from time to time and to paste most of the time.

When I search for the files containing a given localized string, I get a text file containing several Hfs paths.
I study the list then when I have decided which one will be used, I select it, copy it and call a script which will grab the path from the clipboard to open it with BBEdit.

Using a display dialog in which I would be able to paste would not be ridiculous which woul give the ability to edit the path before validate it.
In such case, choose file would not help.

Remember that when somebody ask here, what he write is a kind of iceberg.
1/10 of the infos are available but there are 9/10 of  am not a sooth sayer.

Of course we may propose different versions but there is no need to tell the OP that what he does is bad when we don't know why he behave this way.

From my point of view, doing that is more rude than writing some statements for which I was blamed.
We helpers are supposed to have a meaningful level of knowledge, askers aren't.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 6 avril 2020  19:21:03

Last edited by Yvan Koenig (2020-04-06 11:21:47 am)

Offline

 

#6 2020-04-06 02:25:29 pm

KniazidisR
Member
Registered: 2019-03-03
Posts: 1259

Re: Can Quoted Form and Text Returned be combined?

Yvan Koenig wrote:

We don't know why the OP use this protocol.


I guess, the main problem of the OP is not in the combination of these 2 code lines, but that the OP wants to create a reference to the project, specifying only the name of the project, without specifying the parent folder of the project. And this is impossible.

But, let the OP answer itself. Now I have to go to work.

Last edited by KniazidisR (2020-04-06 02:26:37 pm)


Model: MacBook Pro
OS X: Catalina 10.15.4
Web Browser: Safari 13.1
Ram: 4 GB

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)