DanielSoft File Selection Hack
Hello...
Today, I created a little utility: a generic frontend:
SCREENSHOT:
README:
DanielSoft File Selection Hack
REQUIRES:
Tcl/Tk
COMMAND LINE SYNTAX:
dfish [directory] [command] [glob_mask]
USAGE:
Running dfish will give you a menu with all the files in
the specified directory, which satisfy the mask. When you
double-click a file, the specified command will be run.
The "refresh" button reloads the directory contents.
Title of the window is the command, in order not to confuse
more dfish windows running at the same time.
The program is useful for example if you have a commandline-based
program with no suitable front-end: dfish is in fact a generic
front-end for a lot of possible programs.
EXAMPLE:
dfish /home/user/my_backgrounds "fbsetbg -f" '*.jpg'
will display all the JPG images in the directory /home/user/my_backrounds,
double-clicking any image will set it as a desktop background,
because that's what the "fbsetbg" command do.
NOTE:
The glob_mask *must* be in apostrophes, to escape it from the shell,
the command in double quotes in order to specify its parameters: to
know which parameters belong to it and which belong to dfish...
LICENCE:
GNU GPL
AUTHOR:
Daniel Novotny
URL:
http://www.sweb.cz/danielsoft/dfish.tar.gz
WEBUTIL File-directory listing issue (very slow) as listed above.
I implemented this last week and it is giving very good results.
I have written a note that explains how to integrate the JAR file with your form code.
Unfortunately, today is my last day at work and won't be coming back. I will be updating my blog at www.degenio.com (see section Downloads) as soon as I get myself up to speed again :(
Similar Messages
-
Displaying the path of the file selected by a FileChooser in a TextField
I'm just getting started with Swing. I developed a simple dialog box that has two text fields and two buttons. The objective is to open two files using those two buttons. I used FileChooser to select the files. Now, I want to display the path of the selected files in their corresponding TextFields. I use the following code to do that.
final FileChooser fc1 = new FileChooser();
final FileChooser fc2 = new FileChooser();
final TextField tf1 = new TextField();
final TextField tf2 = new TextField();
private void button1ActionPerformed(ActionEvent evt)
int returnVal1 = fc1.showOpenDialog(labelPhpFile);
if (returnVal1 == JFileChooser.APPROVE_OPTION)
File file1 = fc1.getSelectedFile();
String fileName1 = file1.getName();
String filePath1 = file1.getPath();
tf1.setText(filePath1);
private void button2ActionPerformed(ActionEvent evt)
int returnVal2 = fc2.showOpenDialog(labelPhpFile);
if (returnVal2 == JFileChooser.APPROVE_OPTION)
File file2 = fc2.getSelectedFile();
String fileName2 = file2.getName();
String filePath2 = file2.getPath();
tf2.setText(filePath2);
}The above code works fine only for the first file. Mean the path of the file selected using fc1 is getting displayed in the tf1 TextField. But, the file selected using fc2 is not getting displayed tf2 TextField. Please help me.
Thank you :)h1. The Ubiquitous Newbie Tips
* DON'T SHOUT!!!
* Homework dumps will be flamed mercilessly.
* Have a quick scan through the [Forum FAQ's|http://wikis.sun.com/display/SunForums/Forums.sun.com+FAQ].
h5. Ask a good question
* Don't forget to actually ask a question. No, The subject line doesn't count.
* Ask once
- Don't Crosspost!
- Two people answering one question independantly is a waste of there time.
* Don't even talk to me until you've:
(a) [googled it|http://www.google.com.au/] and
(b) looked it up in [Sun's Java Tutorials|http://java.sun.com/docs/books/tutorial/] and
(c) read the relevant section of the [API Docs|http://java.sun.com/javase/6/docs/api/index-files/index-1.html] and maybe even
(d) referred to the JLS (for "advanced" questions).
* [Good questions|http://www.catb.org/~esr/faqs/smart-questions.html#intro] get better Answers. It's a fact. Trust me on this one.
- Lots of regulars on these forums simply don't read badly written questions. It's just too frustrating.
- FFS spare us the SMS and L33t speak! Pull your pants up, and get a hair cut!
- Often you discover your own mistake whilst forming a "Good question".
- Many of the regulars on these forums will bend over backwards to help with a "Good question",
especially to a nuggetty problem, because they're interested in the answer.
* Improve your chances of getting laid tonight by writing an SSCCE
- For you normal people, That's a: Short Self-Contained Compilable Example.
- Short is sweet: No-one wants to wade through 5000 lines to find your syntax errors!
- Often you discover your own mistake whilst writing an SSCCE.
- Solving your own problem yields a sense of accomplishment ;-)
h5. Formatting Matters
* Post your code between a pair of {code} tags
- That is: {code} ... your code goes here ... {code}
- This makes your code easier to read by preserving whitespace and highlighting java syntax.
- Copy&paste your source code directly from your editor. The forum editor basically sucks.
- The forums tabwidth is 8, as per [the java coding conventions|http://java.sun.com/docs/codeconv/].
- Indents will go jagged if your tabwidth!=8 and you've mixed tabs and spaces.
- Lines longer than 80 characters should be wrapped.
- Proper indentation illustrates program logic.
* Post your error messages between a pair of {code} tags:
- That is: {code} ... errors here ... {code}
- To make it easier for us to find, Mark the erroneous line(s) in your source-code. For example:
System.out.println("Your momma!); // <<<< ERROR 1
- Note that error messages are rendered basically useless if the code has been
modified AT ALL since the error message was produced.
- Here's [How to read a stacktrace|http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/].
* The forum editor has a "Preview" pane. Use it.
- If you're new around here you'll probably find the "Rich Text" view is easier to use.
- WARNING: Swapping from "Plain Text" view to "Rich Text" scrambles the markup!
- To see how a posted "special effect" is done, click reply then click the quote button.
If you (the newbie) have covered these bases *you deserve, and can therefore expect, GOOD answers!*
h1. The pledge!
We the New To Java regulars do hereby pledge to refrain from flaming anybody, no matter how gumbyish the question, if the OP has demonstrably tried to cover these bases. The rest are fair game. -
Close excel programmatically after user cancels file selection
Greetings all. I apologize but I incorrectly posted this question on the wrong board originally so am posting it again here. I have a VI that I wrote with some help from this site that reads in as many user selected Flat Data Files as desired into Excel. The VI opens Excel, places each Flat Data File on one row and ends, allowing the user to manipulate the Excel data as desired. I have tested it without problems with up to 100 files at a time. The VI minimizes Excel at startup so that it will not block the Select File(s) dialogue. MY problem is this: If the user cancels the file selection, it returns an error and leaves Excel open. I understand how to handle the error, but have been unable to make Excel close automatically if the action is canceled. I have tried to invoke the Close without saving node with no luck... probably because I don't understand how to apply it. Ideally, I want to take the error number to a case statement, and if it is anything other than zero (0), meaning no error, I want Excel to close down. This will eventually be an executable so I need to make this right. Can anybody help? I have attached a zip file with the VI's and some sample Flat Data Files.
Thanks
Attachments:
RTS Flat File Data.zip 103 KBIf you want anything to run after an error you must clear the error status boolean from the error cluster. To do this use the bundle by name and set the status value to FALSE, take this output cluster into the function you wish to run.
Andrew Alford
Production Test Engineering Technologist
Sustainable Energy Technologies
www.sustainableenergy.com -
Right, so I have a windowsform with lots of Textboxes, where the user can type in Information, and then hit "Save", once its saved it goes into a sortof XML Format
<?xml version="1.0" encoding="utf-8"?>
<!--Database-->
<Case>
<Person>l<Driver></Driver><License-Holder></License-Holder><Address></Address><Phone></Phone><Date-of-Birth></Date-of-Birth><Registration></Registration>
Like that.
Now, on my Startup Form (The main form) there is a Listview that I gave the name Objectlist1. This list displays ANY file located in a specific folder on my computer. This is also where the Saved files appear.
The list also updates every 5th second so after you save it appears quickly.
Now, the Files are saved using the content or Value of the first Textbox:
Dim XmlWrt As XmlWriter = XmlWriter.Create("C:\Users\USER\Desktop\TESTFOLDER\" + Firsttextbox.Text, settings)
So it appears in the folder and on the list with the value inserted in the first Textbox.
My problem comes when I want to load this back (Or reverse the function if you will)
Where I can go to the Objectlist1/Listview, either doubleclick a file or Mark a file, and hit my button "Retrieve"
I want the Form where you could input all the values to show - which it does
And the information from the XML/File saved to appear where it once was typed or inserted.
Here is an example of the code used to save the values from the Textboxes;
Private Sub Savebutton_Click(sender As Object, e As EventArgs) Handles Savebutton.Click
If IO.File.Exists(Pholderbox.Text) = False Then
Dim settings As New XmlWriterSettings()
settings.Indent = True
Dim XmlWrt As XmlWriter = XmlWriter.Create("C:\Users\USER\Desktop\TESTFOLDER\" + Pholderbox.Text, settings)
With XmlWrt
' Write the Xml declaration.
.WriteStartDocument()
' CLIENT
' Write a comment.
.WriteComment("Database")
' Write the root element.
.WriteStartElement("Case")
' Start our first person.
.WriteStartElement("Person")
.WriteString(Textbox1.Text)
' The person nodes.
.WriteStartElement("Driver")
.WriteString(Textbox2.Text)
.WriteEndElement()
I've tried multiple codesamples but they all give either "XML Not found" or such Overloads.
This is the current code I used when trying to make it work
Private Function ReadSettingsXML(ByVal path As String) As MySettings # On Debug It marks here and tells me it wasn't found.
Dim thisSettingsInfo As New MySettings
If My.Computer.FileSystem.FileExists(Objectlist1.SelectedItems.ToString) Then
Dim settingsInfo = XElement.Load(Objectlist1.SelectedItems.ToString)
If settingsInfo IsNot Nothing Then
For Each mainGroup As XElement In settingsInfo.Elements
If mainGroup.Name = "<Database>" AndAlso mainGroup.HasElements Then
For Each subGroup As XElement In mainGroup.Elements
If subGroup.Name = "<Person>" Then
thisSettingsInfo.Textbox1 = subGroup.Value
ElseIf subGroup.Name = "<Driver>" Then
thisSettingsInfo.Textbox2 = subGroup.Value
ElseIf subGroup.Name = "<Address>" Then
thisSettingsInfo.Textbox3 = subGroup.Value
End If
Next
End If
Next
Else
thisSettingsInfo = Nothing
Throw New Exception("The settings XML file is corrupt and cannot be read.")
End If
Else
thisSettingsInfo = Nothing
Throw New Exception("The settings XML file could not be located.")
End If
Return thisSettingsInfo
End Function
Private Sub LoadXML_Click(sender As Object, e As EventArgs) Handles LoadXML.Click
Dim settings As New MySettings
settings = ReadSettingsXML(Objectlist1.SelectedItems.ToString)
If settings IsNot Nothing Then
Dim sb As New System.Text.StringBuilder
With settings
Caseworker.Textbox1.Text = .Person
Caseworker.Textbox2.Text = .Driver
Caseworker.Textbox3.Text = .Address
End With
End If
End Sub
Also, the "Caseworker" is the form where all the textboxes are located.
Been stuck on this for two working days, so any help is highly appreciated
Codesamples are also highly welcome so I can see what the heck you did and find and answer to my problems.I found a code that might be close to what I'm looking, but as of this code used here, it looks for a static document that already exist and is located in the code.
See this one here, checks for the XML file, and since I can't link one program to 1 file, when its gonna have and use 100's of files.
If (IO.File.Exists("MyXML.xml")) Then
Same here with the static document.
Dim document As XmlReader = New XmlTextReader("MyXML.xml")
While (document.Read())
Dim type = document.NodeType
'if node type was element
If (type = XmlNodeType.Element) Then
If (document.Name = "FirstName") Then
TextBox1.Text = document.ReadInnerXml.ToString()
End If
If (document.Name = "LastName") Then
TextBox2.Text = document.ReadInnerXml.ToString()
End If
End If
End While
Am I at least close here, people?
Can anyone help with the now critical issue I got?
I basically need to change these two;
If (IO.File.Exists("MyXML.xml")) Then
Same here with the static document.
Dim document As XmlReader = New XmlTextReader("MyXML.xml")
To whatever value, so they read from the file SELECTED in my Listview
Cos the program saves files according to the info inserted in textboxes, so it can have whatever name you can think of, I need the program to "find and load" that file, once its selected, and then once I hit Retrieve or LOAD or whatever button, it
injects the info from the File to the correct Textboxes.
And I think this will work to get the info in the right boxes;
If (document.Name = "FirstName") Then
TextBox1.Text = document.ReadInnerXml.ToString()
End If
If (document.Name = "LastName") Then
TextBox2.Text = document.ReadInnerXml.ToString()
Any good advise? I'm stranded here. -
The file size of selected file in input file control is shown as 0 for multiple file selection in Safari 5.1. If you select single file, then it is able to return file size correctly. However, if you select multiple files, then the file size of each of the selected file is always returned as 0 from javascript. This works correctly in Safari 4.0 but it does not work in Safari 5.1.
How do I get the correct file size in Safari 5.1 ?If you want to post (or send me) a link to the lrcat file, I'd take a look at it for you, and give you a break-down what's consuming all the bytes. But it might be fun to learn how to do that yourself (e.g. using SQL). I use SQLiteSpy, but other people have their favorites.. (or you can use a command-line client if you prefer..). One way: just run "drop table "{table-name}" on each table then look at filesize (do this to a copy, not the real thing).
Anyway, it's hard to imagine keywords and captions etc. taking much of the space, since even if you had 1000 10-character words of text metadata per photo average that still only adds up to 117MB, which isn't a substantial portion of that 8G you're seeing occupied.
Anyway, if you've painted the heck out of most of them and not cleared dev history, that'll do it - that's where I'd put my money too...
One thing to consider to keep file-size down:
===================================
* After reaching a milestone in your editing, take a snapshot then clear edit history, or the top part of it anyway (e.g. leave the import step), using a preset like:
Clear Edit History.lrtemplate
s = {
id = "E36E8CB3-B52B-41AC-8FA9-1989FAFD5223",
internalName = "No Edit",
title = "Clear Edit History",
type = "Develop",
value = {
settings = {
NoEdit = true,
uuid = "34402820-B470-4D5B-9369-0502F2176B7F",
version = 0,
(that's my most frequently used preset, by far ;-})
PS - I've written a plugin called DevHistoryEditor, which can auto-consolidate steps and reduce catalog size - it's a bit cumbersome to use a.t.m. but in case you're interested...
Rob -
The XML file selected is invalid
I have exported FDM application from FDM 9.3.1. I am trying to import FDM application in 9.3.1.2. I am getting error "3107- The XML file selected is invalid" during import process. Anybody have experience this error?
Thanks,look at this http://forums.adobe.com/thread/433486
-
When I was on Mac OS 10.5... If I had a folder open, and a column of files going down the right side of the desktop... If I opened one of the files (by having the file selected and hitting the keystroke: Command + Down Arrow) - then closed the file, then hit Command + Tab to select the Finder, then hit Down Arrow to select the next file (to open it) - that sequence worked as described.
Now with 10.6 that no longer works - if a folder is open on the desktop. If a folder is open, in the above sequence, after I hit Command Tab to select the (file I just closed in the) Finder, the selection moves to the folder rather than back to the file I just closed.
Which is a giant PITA because I can no longer open and close I column of files in the finder w/o having to reach for the mouse.
Seems like there should be a way to fix that.
beInteresting, never used that method, but will take a look in about 10 hours wgen I have 10.6 available.
-
How do i get the path of the file selected for opening in JFileChooser
hi
I need to get the path of the file selected for opening or saving in the JFileChooser dialog box.Is there any method available.if not how do i get that?
Thanks and Regards
Saminathan.don't know if its the best/only way, but you could use the getSelectedFile() method in JFileChooser which returns a file and then use the getAbsolutePath() file method
-
Opening the file selected by JFileChooser()...
Hi,
can anyone explain how to open a file selected by using JFileChooser()...
Thanx ..
Regards,
Sangeetha..ya..how to open a file given a file name??
am new to java programming & plz dont take otherwise if i have asked a nonsense Q.,
anyways, Thanx for sparing ur time & answering..
regards,
Sangeetha.. -
Default File Selection while Running Data Manager Package
Hi BPC Experts,
What i wanted to know is that is possible to make a file selection as "Default" for running a data manager package.Say for example i wanted to run a simple DMP "Load Transaction data from from BW InfoProvider UI" and the file that i always select is "ZFIGL010" for this is it possible to get "ZFIGL010" file as pre-populated (or pre-selected)instead user going and choosing from long list of files available "Info Provider Selection".
Thanks
RahulRahul,
As Ashish said you cant get rid of the info provider name selection as you are using the /CPMB/LOAD_INFOPROV_UI pkg. But if you use /CPMB/LOAD_INFOPROVIDER package you can follow the below steps to get rid of the selection.
Comment the below prompt statement in the Advance script of the pkg which asks you to select the Info provider.Its the first statement of the script. You can comment by putting a ' before begining of the statement.
PROMPT(TEXT,%InforProvide%,"Please enter InfoProvider to download data",)
Add a INFO statement and pass the same INFO statement to the Task. Please refer to image below.
Regards
Nikhil -
[SOLED] Firefox input type = file selects the wrong file
When I have use a webpage in firefox that has an upload feature, Firefox often selects the wrong file. I can reproduce this problem by simply creating a form with an input tag like this:
<input type="file" />
When I enter the file selection screen and open fileA the input box contains fileA, fileB or fileC. It seems kind of random to me. I use KDE 4.5 btw, if that matters.
Last edited by Wilco (2010-08-07 08:24:35)It seems to be some kind of kde problem. When I delete ~/.kde4/share/config/* it works fine. I tried deleting the all files in share/config starting with a-m and it still didn't work. Then I deleted every file from n-z and it didn't work so it's probably a combination of files that give these problems. I don't feel like setting up KDE all over again so damn, it's back to Icewm, again...
-
In Acrobat Text Fields have an option Field is used for file selection. With this Text Fields it is possible to select a File in the File Browser and to show the URL of the selected File in the Textfile with a script like var ft = this.getField("URL"); ft.browseForFileToSubmit(). Has someone found a similar possibility in Designer?
getField does not work on XFA forms. Please have a look at the following document:
http://www.adobe.com/devnet/livecycle/articles/AcroJS_DesignerJS.pdf -
File Browse "no file selected"
Hi,
Sorry if this has been asked before.
I've created a form, part of that form uploads a file and this works fine but i'm using the same page to edit those details. When the page is opened the all the values apart from the file browse diplay OK, this just says "no file selected".
Is there anyway to display the name of the file that has already been uploaded rather than it saying no file selected.
Thanks AndyHello,
I should have mentioned in the original question that I did exactly that, but it didn't work because apex_application_files view contains a blob as opposed to a clob column. In fact, I created two tables (2 "B" caharcters have been replaced by "C"s):
CREATE TABLE T_BLOB (
C_ID NUMBER PRIMARY KEY, -- Populated by a sequence which is out of scope for this question
C_FILE_NAME VARCHAR2(100),
C_FILE BLOB);
CREATE TABLE T_CLOB (
C_ID NUMBER PRIMARY KEY, -- Populated by a sequence which is out of scope for this question
C_FILE_NAME VARCHAR2(100),
C_FILE CLOB);
And this is the Process that populates them:
begin
if ( :p15_fb is not null ) then
insert into t_blob ( c_id, c_file_name, c_file )
select s_clob.nextval,
filename,
blob_content
from apex_application_files
where name = :p15_fb;
delete from apex_application_files where name = :p15_fb;
end if;
end;
This works like a charm. However, when I replace t_blob with t_clob in line 3, it fails. (See the error message here .)
Any help would be greatly appreciated!
Thanks,
Gabor -
Want to select a file with File Selection and would like to display the contents in TestArea in a JSP file.
Any suggestion OR help?You mean select a file on the client computer and display the contents in a TextArea?
Can not be done efficiently just in JSP/Javascript.
The only component you can use to select files is the <input type="file">
That can only be used to upload the contents of a file.
The only way to get the contents into a textarea would be
1 - Choose via <input type="file">
2 - Upload the file to the server
3 - Download the text from that file to the client in a JSP page.
A better solution would involve signed applets/activex which actually CAN directly read the local computers file system. -
Hello
Is their a way that the SBO SDK UI exposes the file selection like the one use for add bit maps etc? I tried doing this by using writing code but cannot get this to display on the screen it is called from. The code is:
Public Function Open_FileView()
Dim OpenFileDialog1 As New OpenFileDialog
OpenFileDialog1.InitialDirectory = "C:\"
OpenFileDialog1.Filter = "txt files (.txt)|.txt|All Files (.)|."
OpenFileDialog1.FilterIndex = 2
OpenFileDialog1.RestoreDirectory = True
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
Dim sr As New System.IO.StreamReader(OpenFileDialog1.FileName)
MessageBox.Show(sr.ReadToEnd)
sr.Close()
End If
End Function
Thanks
JohnTry something like this:
System.Windows.Forms.Form winForm = new System.Windows.Forms.Form();
winForm.TopMost = true;
System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
sfd.Filter = "XML (*.xml)|*.xml";
if(sfd.ShowDialog(winForm)==System.Windows.Forms.DialogResult.OK) {
//Do stuff
This work for me (Save dialog, but openfiledialog works the same way)
Maybe you are looking for
-
I got a new iphone 4 today. I have updated my itunes to the latest update but my itunes won't sync with my iphone. Does anybody know why this might be?
-
How to find non selling products in a departmental store
hi experts, for example: how to find non selling products in a departmental store at end of the month in reporting. is it possible to find, if it is, pl give me the procedure. thanks & regards sairam
-
I'm about to purchase an iPad for an upcoming vacation and wonder if I can download RAW images? And if I can do so, what applications do you suggest to process RAW? Thanks in advance.
-
Any other mozaic-themed photo galleries?
Hello all.. apologies if this query has been raised earlier. I was considering purchasing the iPhoto app primarily for the Photo Journal feature.I have 2 queries around this- 1. Is there any prerequisite (like any purchase of iCloud space) to use thi
-
Hi, I am using af:showPopupBehavior to show a popup. I have specified alignid but popup is not align to my component. It is shown at left corner at the top of my browser. I also retried removing alignid and take default setting. No luck. Here is my c