Having trouble accessing a folder path from a text file in Photoshop using JavaScript (JSX)

main();
function main(){
    var listFile = File("~/Desktop/Testpath.txt"); 
    if(listFile == null) return;
    listFile.open('r') ; 
    var listString = listFile.read(); 
    listFile.close(); 
    fileList = listString;
    // "selectedPSD" Shuld Open "listString" Folder
    var selectedPSD =  File.openDialog("Select a PSD file to open" );

if (selectedPSD!=undefined) app.open(selectedPSD);
};

When using Defold, it automatically navigates to the last opened folder. However, I want to navigate to the path specified in my txt document. The path inside the txt document is:

/c/Program%20Files/Common%20Files

This will give me the folder fileList.

Answer №1

To utilize the .openDlg() method from a Folder object, follow this approach:

var directory = new Folder("/d/Users/User/Documents");
var selectedFile = directory.openDlg(); // <--
alert(selectedFile);

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Checking for an active listening instance of `http.Server` in a Node application

Having an http server and a piece of code that needs to run only when the server is actively listening, I have bound it to the event "listening" as follows : server.on('listening', doSomething) The issue arises when the server is already listen ...

The JSX element 'body' appears to be missing its closing tag

I'm currently in the process of developing a landing page using react.js. This particular page is designed for users who are not yet signed up to create an account if they wish to do so. Unfortunately, I'm encountering some errors, one of which p ...

Guide to adding and showing records without the need to refresh the webpage using CodeIgniter

Hey there! I've got a code snippet here for inserting and displaying records without refreshing the web page using AJAX and plain PHP. However, I'm not sure how to set this up using CodeIgniter. Can someone please lend a hand? Here's what I ...

tips for recognizing the selected element

seeking assistance in resolving the issue with the script. once the user selects an item .menu_button, a function called initForm() is invoked. This function is expected to output only console.log(N) but instead, it outputs 3: console.log(1) console.l ...

Using SWR in React to conditionally fetch data and making Axios calls within an array map

With my project, I am working with two different API endpoints to retrieve data. The second endpoint requires a query parameter that is obtained from the response of the first endpoint. To handle this scenario, I have created a custom hook using the useSW ...

Using Bootstrap, jQuery, and PHP to dynamically load input fields in a modal window

I am looking to dynamically load input fields in a modal window using PHP. While researching, I came across suggestions to utilize AJAX for this purpose. However, I have limited knowledge about AJAX. The plan is as follows: 1) When the user clicks on the ...

The slider thumb is not showing up properly on Microsoft Edge

Hey there! I'm experiencing an issue with the range slider's thumb display in Microsoft Edge. It appears to be positioned inside the track rather than outside as intended. Take a look at this snapshot for clarification: https://i.stack.imgur.co ...

Transform Python list into a JavaScript array

Seeking quick assistance from experts as I face an intriguing challenge that has me stumped. In a Python .psp file, I have a list mylist[] that is populated at runtime and a JavaScript function that requires a list to dynamically create a form object. The ...

Invisible ReCaptcha by Google not living up to its invisible name

I am having trouble getting Google's Invisible ReCaptcha to function correctly after submitting a form. Despite setting my site-key for an invisible ReCaptcha, the "old" style ReCaptcha keeps appearing. I am unsure why this is happening and would appr ...

Struggling to modify CSS properties for :before and :after pseudo-elements?

My current styling looks like this: section.tipos .content > div:before { background: none repeat scroll 0 0 #DDDDDD; content: " "; height: 10px; left: 32%; position: absolute; top: -10px; width: 10px; } It's working p ...

JQuery cannot target content that is dynamically inserted through an Ajax request

When I use an ajax call to pass dynamically generated html, such as in the example below: var loadContent = function(){ $.ajax({ url: '/url', method: 'GET' }).success(function (html) { $('.con ...

Shine a spotlight on elements that match with jQuery using live() or on()

Check out my jsFiddle demonstration where I have created a button that adds elements and provides links to delete these elements. Instead of actually deleting the elements in this example, I want to make it so that hovering over the (remove) link, which is ...

Sending a JSON stringified JavaScript object to a server: A step-by-step guide

I am currently working with VB.Net and MVC 5. In my project, I have an object that I created using javaScript: var myEdits = { listOfIDs: [], listOfValues : [] }; My goal is to send this object to the controller an ...

Why is my timer function speeding past too swiftly?

My vue.js countdown function is updating too quickly. Displayed below is the data section data() { return { selected: [], countdown: timerLimit } Here is the countdown method countdownTimer() { this.count ...

Create a custom URL based on the text provided

I have a task of creating a new URL based on user input text Name: <input type="text" id="myText" > <button onclick="myFunction()">check tracking</button> When using DHL service, it requires adding a specific code to the URL like this: ...

Why are my AngularJs elements not appearing in the print dialog window?

Whenever I try to open the print Dialogue on a specific page, all I'm seeing is a blank screen. The majority of the content on this page consists of AngularJS elements. To trigger the print dialogue, I use the following code: <a href=""onclick="wi ...

Converting MySQL DateTime to seconds in JavaScript from PHP

In my JavaScript code, I have implemented a countdown timer that relies on two variables. The first variable, currentDate, is converted to milliseconds and then has 10 minutes worth of milliseconds added to it. The second variable, d, stores the current da ...

What is the correct way to access an element with spaces in handlebars while working with node.js?

I have an object containing values with spaces in strings. For example: object = { "group of people": [ { (...) } ], "another group of people": [ { (...) } ] } Now, I want to use this object with the handlebars helper block in my view ( ...

Blurring images with a combination of jQuery Backstretch and Blurjs

I have a background image displayed using Backstretch and want to apply Blur.js to blur elements on top of it. However, when I try to use Blur.js on the backstretched image, it doesn't work. I believe this is happening because Blur.js uses the CSS pro ...

Assign the value from JavaScript to the element with the "ng required" attribute, without resetting frm.$error.required to false

My situation involves using a button with ng-style that relies on frm.mybtn.$error.required as follows: ng-style="frm.mybtn.$error.required?{'border-color':'#a94442'}:''" I am updating the value of the button from JavaScript ...