How to set the Initial path in the FILE name field of a JFilechooser?
as title
thx...
try this....
File file =null;
JFileChooser fileDemo=new JFileChooser();
fileDemo.setCurrentDirectory(new File("e:\\test"));
instead of "e:\\test" you can specify your path.
Similar Messages
-
How to set the file path dynamically based on sytem, username, and date
Hi All,
My requirement is upload the data into one structure like xyz that is related to t.code MCSZ.
file will be in UNIx SERVER .
PATH IS: /sapif
file name is xy789 load .txt
I have to write code in one user-exit
how can i set the file path for this.
shall i put hard code file path?
because i have to writecode in user-exit.
plz tell me how to set the file path based ons syetem, username, date
Thanks in advance
Ram.AConcatenate the field SY-SYSID, SY-UNAME and SY-DATUM for the file path
-
How to put the file name in notepad file
dear frank,
how to put the file name in notepad file via power shell. I mean i want to put the file name in that notepad file
for example,
my file name is ABL and in this file data is
02/06/2015,180.00,182.00,176.01,180.50,1575500
02/06/2015,4.20,4.20,4.20,4.20,500
02/06/2015,113.50,113.70,112.91,113.09,157800
02/06/2015,682.01,695.90,682.00,683.19,4250
02/06/2015,213.98,215.00,213.00,214.87,326200
02/06/2015,21.52,21.65,21.52,21.60,4000
02/06/2015,111.00,111.25,108.25,108.91,17100
02/06/2015,52.00,52.00,52.00,52.00,500
and i want to data in this form
ABL,02/06/2015,180.00,182.00,176.01,180.50,1575500
ABL,02/06/2015,4.20,4.20,4.20,4.20,500
ABL,02/06/2015,113.50,113.70,112.91,113.09,157800
ABL,02/06/2015,682.01,695.90,682.00,683.19,4250
ABL,02/06/2015,213.98,215.00,213.00,214.87,326200
ABL,02/06/2015,21.52,21.65,21.52,21.60,4000
ABL,02/06/2015,111.00,111.25,108.25,108.91,17100
ABL,02/06/2015,52.00,52.00,52.00,52.00,500
There are many file like this that i want to be edit
plese tell me how can i do it, i think it is possible via windows power shell.
thanks in advance.Hi
Just for completeness, what version of VB.NET are you using?
Here is a complete project to copy all the files with the added "ABL," at the start of each line. You need to start a new Project with a BLANK default Form1, and replace all of Form1 code with the code below. When you run this project, you
need to use the 2 buttons to set up the ORIGINAL file folder and a folder to place the copies. You need to check if the file EXTENSION is correct (I assumed txt), and check the text to add to each line is correct. Once all is set up you should have a
big red button to start the operation.
NOTE: it is important that you try this out on a copy of some of the files to verify accuracy BEFORE trying on original files. Make sure you have a good back up of the original files before doing anything else.
' new project with default BLANK Form1
' replace all Form1 code with this code
' WARNING: make sure you have a backup of
' any files you use this application to
' operate on.
Option Strict On
Option Infer Off
Option Explicit On
Public Class Form1
Dim OrigFileFolderPath As String = Nothing
Dim CopyToFolderPath As String = Nothing
Dim lab1, lab2, lab3 As New Label
Dim tb1, tb2, tb3 As New TextBox
Dim b1, b2, b3, b4 As New Button
Dim fb As New FolderBrowserDialog
Dim bgw As New System.ComponentModel.BackgroundWorker
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Me.Size = New Size(731, 300)
With lab1
.Text = "Original Files Folder Path"
.Location = New Point(15, 5)
End With
With tb1
.Width = 560
.Location = New Point(10, 30)
.BackColor = Color.Khaki
.ForeColor = Color.Maroon
.Font = New Font(Me.Font.FontFamily, 12)
.BorderStyle = BorderStyle.FixedSingle
.Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right
End With
With lab2
.Text = "Copy Files to Folder Path"
.Location = New Point(15, 125)
End With
With tb2
.Width = 665
.Location = New Point(10, 150)
.BackColor = Color.Khaki
.ForeColor = Color.Maroon
.Font = New Font(Me.Font.FontFamily, 12)
.BorderStyle = BorderStyle.FixedSingle
.Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right
End With
With lab3
.Text = "File Ext"
.Location = New Point(600, 5)
.Anchor = AnchorStyles.Top Or AnchorStyles.Right
End With
With tb3
.Text = ".txt"
.Width = 80
.Location = New Point(590, 30)
.BackColor = Color.Khaki
.ForeColor = Color.Maroon
.TextAlign = HorizontalAlignment.Center
.Font = New Font(Me.Font.FontFamily, 12)
.BorderStyle = BorderStyle.FixedSingle
.Anchor = AnchorStyles.Top Or AnchorStyles.Right
End With
With b1
.Text = "Choose Original Files Folder Path"
.AutoSize = True
.Location = New Point(10, 65)
End With
With b2
.Text = "Choose Copy Files to Folder Path"
.AutoSize = True
.Location = New Point(10, 185)
End With
With b3
.Text = "DO THE COPY"
.AutoSize = False
.Size = New Size(240, 50)
.BackColor = Color.Red
.ForeColor = Color.White
.Font = New Font(Me.Font.FontFamily, 20, FontStyle.Bold)
.Location = New Point(420, 80)
.Anchor = AnchorStyles.Top Or AnchorStyles.Right
.Visible = False
End With
With b4
.Text = "CANCEL JOB"
.AutoSize = False
.Size = New Size(240, 50)
.BackColor = Color.Red
.ForeColor = Color.White
.Font = New Font(Me.Font.FontFamily, 20, FontStyle.Bold)
.Location = New Point(420, 80)
.Anchor = AnchorStyles.Top Or AnchorStyles.Right
.Visible = False
End With
Me.Controls.AddRange({lab1, lab2, lab3, tb1, tb2, tb3, b1, b2, b3, b4})
With bgw
.WorkerReportsProgress = True
.WorkerSupportsCancellation = True
End With
AddHandler bgw.DoWork, AddressOf bgw_DoWork
AddHandler bgw.RunWorkerCompleted, AddressOf bgw_Completed
AddHandler b1.Click, AddressOf b1_Click
AddHandler b2.Click, AddressOf b2_Click
AddHandler b3.Click, AddressOf b3_Click
AddHandler b4.Click, AddressOf b4_Click
End Sub
Private Sub b1_Click(sender As Object, e As EventArgs)
fb.SelectedPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments
fb.ShowNewFolderButton = False
Dim r As DialogResult = fb.ShowDialog
If r = Windows.Forms.DialogResult.OK Then
tb1.Text = fb.SelectedPath
If IO.Directory.Exists(tb1.Text) AndAlso IO.Directory.Exists(tb2.Text) AndAlso Not (tb1.Text = tb2.Text) Then
If tb3.Text = Nothing Then
redo: tb3.Text = InputBox("Enter the file extension that you want to copy/change", "FILE EXTENSION")
If tb3.Text = Nothing Then GoTo redo
End If
b3.Visible = True
Else
b3.Visible = False
End If
End If
End Sub
Private Sub b2_Click(sender As Object, e As EventArgs)
fb.SelectedPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments
fb.ShowNewFolderButton = True
Dim r As DialogResult = fb.ShowDialog
If r = Windows.Forms.DialogResult.OK Then
tb2.Text = fb.SelectedPath
If IO.Directory.Exists(tb1.Text) AndAlso IO.Directory.Exists(tb2.Text) AndAlso Not (tb1.Text = tb2.Text) Then
If tb3.Text = Nothing Then
redo: tb3.Text = InputBox("Enter the file extension that you want to copy/change", "FILE EXTENSION")
If tb3.Text = Nothing Then GoTo redo
End If
b3.Visible = True
Else
b3.Visible = False
End If
End If
End Sub
Private Sub b3_Click(sender As Object, e As EventArgs)
b3.Visible = False
b4.Visible = True
If Not tb3.Text.StartsWith(".") Then tb3.Text = "." & tb3.Text
bgw.RunWorkerAsync()
End Sub
Private Sub b4_Click(sender As Object, e As EventArgs)
bgw.CancelAsync()
End Sub
Private Sub ReadPWFile(fn As String)
Dim filename As String = My.Computer.FileSystem.GetName(fn)
Dim barename As String = IO.Path.GetFileNameWithoutExtension(fn)
Dim copyto As String = tb2.Text & "\" & filename
Dim line As String = Nothing
Dim lines As New List(Of String)
Using sr As IO.StreamReader = New IO.StreamReader(fn)
Do
line = sr.ReadLine()
If Not line = Nothing Then
lines.Add(barename & "," & line)
End If
Loop Until line = Nothing
End Using
Using sw As IO.StreamWriter = New IO.StreamWriter(copyto)
For Each s As String In lines
sw.WriteLine(s)
Next
End Using
End Sub
Private Sub bgw_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs)
Dim ftc As Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(tb1.Text)
For Each f As String In ftc
If bgw.CancellationPending Then
e.Cancel = True
Exit For
End If
Dim ex As String = My.Computer.FileSystem.GetFileInfo(f).Extension.ToLower
If My.Computer.FileSystem.GetFileInfo(f).Extension.ToLower = tb3.Text.ToLower Then
ReadPWFile(f)
End If
Next
End Sub
Public Sub bgw_Completed(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs)
tb1.Text = Nothing
tb2.Text = Nothing
b3.Visible = False
b4.Visible = False
MessageBox.Show("Finished copying files", "Job Completed")
End Sub
End Class
Regards Les, Livingston, Scotland -
How to Capture the File Names of any extension using ssis
Hello,
Can you please let me know on how to Capture the File Names of any extension(EG : xls,text,.csv etc) at a time and stores in excel file using SSIS?
Any help would be appreciated.
Thanks,
Vinay sIf you need to act differently on each file type separately or if not all types of files are wanted, i.e. the Filespecifier cannot be *.* in the Foreach loop:
In the ssis package
make 3 variables:
to store the file extension, e.g. User::CurrentExtension of type string
to store the filename found in the directory: @CurrentFilename
to store the name of the directory where the files reside e.g. User::CurrentDirectory
make a foreach loop of type Foreach Item enumerator:
in the items list you add each file extension that you need
txt
csv
xls
xlsx
As Variable mappings map the CurrentExtension to Index 0
Inside this foreach loop add another foreach loop of type Foreach File enumerator, in the collection Expressions
add Expression Directory , set to @[User::CurrentDirecotry]
add Expression FileSpec, set to "*." + @[User::CurrentFileExtension]
In the Variable mappings, map Variable user::CurrentFilename to Index 0
Inside this loop use Execute SQL Task to insert the filename in a Excel connection.
Jan D'Hondt - SQL server BI development -
How to print the file name in sap
Hi All,
I have requirment like,
there is a folder in my local system, inside that folder there are 10 Excel file like file1.xls,file2.xls..............file10.xls
how to print the file name of all these file in SAp like
file1.xls
file2.xls
file3.xls
file4.xls
file10.xls
Appropriate points will be rewarded.
Thanks in Advance
Arun kumarHi,
Still you are facing any problem with this code expalin the problem with details , otherwise close this thread.
Use Method <b>cl_gui_frontend_services=>directory_list_files</b> to read file names for a given directory
after reading the files then Use FM : <b>RSPO_SX_OUTPUT_TEXTDATA</b> to create spool from internal table data and print the data.
<b>sample code :</b>
data: desktop_dir type string.
data: ifiles type table of string.
data: xfiles type string.
data: count type i.
data: filepath type string.
call method cl_gui_frontend_services=>get_desktop_directory
changing
desktop_directory = desktop_dir .
call method cl_gui_cfw=>flush.
call method cl_gui_frontend_services=>directory_list_files
exporting
directory = desktop_dir
* filter = '*.xls'
files_only = 'X'
* DIRECTORIES_ONLY =
changing
file_table = ifiles
count = count.
DATA : x_name LIKE tsp03d-name,
x_dest LIKE tsp03d-padest VALUE 'LOCL',
x_rows LIKE sxpcklsti1-body_num VALUE 0,
x_startrow LIKE sxpcklsti1-body_start VALUE 1,
x_pages LIKE rspotype-pages VALUE 1,
x_pages_1 TYPE p DECIMALS 2,
x_rqtitle LIKE sxpcklsti1-obj_descr,
x_rqcopies TYPE i VALUE 1,
x_rqowner LIKE trdyse01cm-username,
x_immediate LIKE pri_params-primm VALUE ' ',
x_rqid LIKE tsp01-rqident,
i_contents LIKE solisti1 OCCURS 0 WITH HEADER LINE,
x_pages = 1.
x_rqowner = sy-uname.
x_dest = 'LOCL'.
x_startrow = 1.
x_rqcopies = 1.
x_immediate = 'X' .
CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'
EXPORTING
* name = x_name
dest = x_dest
rows = x_rows
startrow = x_startrow
pages = x_pages
rqtitle = x_rqtitle
rqcopies = x_rqcopies
rqowner = x_rqowner
immediately = x_immediate
IMPORTING
rqid = x_rqid
TABLES
text_data = i_contents
EXCEPTIONS
name_missing = 1
name_twice = 2
not_found = 3
illegal_layout = 4
internal_error = 5
size_mismatch = 6
OTHERS = 7.
IF sy-subrc <> 0.
** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
** WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Appana
*Reward Points for helpful answers
Message was edited by: L Appana -
Export Indd to EPS/JPG and set the file name for EPS/JPG file
Hi,
When I export the INDD to JPG/EPS, I want to set the file name with pageNumber for JPG/EPS files using javascript.
For Example
If I set the file name as EPSFile.eps, after exporting the indd(with 2 pages) to eps
,files are generating in the following name EPSFile_1.eps, EPSFile_2.eps.
but I want to set the file name as EPSFile_001.eps and EPSFile_002.eps using javascript.
anyone knows please reply for this.
Regards,
MubeenHi,
I tried the following code.
var JPGe = new File("Applications/PDF/JPG/file.jp");
app.activeDocument.exportFile(ExportFormat.jpg, );
when I use this code ,exported jpg file names are
file.jpg, file1.jpg,file3.jpg.
but ,I want the output file names as file_001,file_002,file_003,
Thanks,
Mubeen -
how to hide the file name (the bizarre number assigned by the camera) when exporting an image version in aperture from an album. Pl understand I want to keep the file name in the project library version.
Within Aperture you have Images, which are constructed on-the-fly from two files (the Master and the Version). You get an image-format file _only_ when you export an Image. You select the file name (usually a scheme) when you create an image-format file (that is, when you export). Look under "Aperture→Presets→File Naming" for built-in Presets. You can, of course, create your own or customize any provided.
The Preset is applied to only the file newly created by your "export" command. It is not applied to the Image in Aperture (unless you rename your Versions or your Masters). -
How Does The Browser Know The "File Name" field in the "Save As" dialog
Hi!
I have a servlet called co.com.SomeStaff who reads a binary file from the server an sends it to the breowser.
The Browser opens the "Save As" Dialog whith the value "co.com.SomeStaff" in the File name field, but and I need the name "SomeBinariFile.exe" instead.
How can I change that value?
Thanks All.Use <%
response.setHeader("Content-Disposition", "attachment; filename=filename.2save");
%> -
How to find the File name using the FTP Adapter
hi all,
how to find the File name using the FTP Adapter with BPEL.
RegardsFound the solution for this.
First In the mediator's routing rule use assign property $in.property.jca.file.FileName to $out.property.jca.file.FileName
In the BPEL's receive activity go to the properties tab and get the property to a BPEL variable. That should do it.
Thanks for the posts -
How to include the file name as an XML field
Hi,
I'm using a file adapter for process a flat file and convert it into an XML. Does anybody knows how to include the file name into an XML field.
Ex.
I process the file named <b>XXIMN21022007.txt</b> and I need an XML like:
<MT_FILE>
<field1></field1>
<field2></field2>
<field3></field3>
<filename><b>XXIMN21022007.txt</b></filename>
</MT_FILE>
Regards
GonzaloJust go for dynamic configuration.
Check the sender file adapter to write the filename in the header (as explained in Michal's blog) and then read that header in some mapping.
U can use that even in simple message mappings.
http://help.sap.com/saphelp_nw2004s/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm
Your code for the filename tag would be something like:
<i>DynamicConfiguration conf = (DynamicConfiguration) container
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/File,
FileName);
return conf.get(key);</i>
Regards,
Henrique. -
How to insert the file name to column
When user upload the file, in order to avoid the double file name conflict, so I need to change the file name to something else, but I still need save the former file name to some column to download the file with correct file name, I know how to rename and upload file, but I don't know how to catch the file name and save it to some column when using addt insert transaction?
Hi,
As I said earlier, you have to maintain the list of filename's "itemdescr" in different temp file and load it an and when required table instead of checking for round robin functionality. If you are looking forward that oracle sqlldr can able to access the filename as one of the parameter then - it might not possible AFAIK.
else perform the direct insert on the table from sqlclient.
- Pavan Kumar N -
How to see the Table Names & Field Names by other than F1 help
Hi Experts
How to see the Table Names & Field Names by other than F1 help, & How to see the List of MM Table Names.
RgdsThe only option to see the active table/ field name is through F1 --> Technical Information. Apart from this, you can use any 3rd part application like GUIex (INbuilt in SAP ECC 6.0 ... can be activated by clicking on the tri-color button on the top right), but you need technical knowledge to understand the information. As far consolidated list of MM tables is concerned, SAP don;t provide you the same at one place, it experience and knowledge which help you in this regard. For your immediate reference MM tables are as under :
EBAN - Purchase Requisition
EBKN - Purchase Requisition Account Assignment
EBUB - Index for Stock Transport Requisitions for Materi
EINA - Purchasing Info Record: General Data
EINE - Purchasing Info Record: Purchasing Organization D
EIPA - Order Price History: Info Record
EKAB - Release Documentation
EKAN - Vendor Address: Purchasing Document
EKBE - History per Purchasing Document
EKBEH - Removed PO History Records
EKBZ - History per Purchasing Document: Delivery Costs
EKBZH - History per Purchasing Document: Delivery Costs
EKEH - Scheduling Agreement Release Documentation
EKEK - Header Data for Scheduling Agreement Releases
EKES - Vendor Confirmations
EKET - Scheduling Agreement Schedule Lines
EKETH - Scheduling Agreement Schedules: History Tables
EKKI - Purchasing Condition Index
EKKN - Account Assignment in Purchasing Document
EKKO - Purchasing Document Header
EKPA - Partner Roles in Purchasing
EKPB - "Material Provided" Item in Purchasing Document
EKPO - Purchasing Document Item
EKPV - Shipping-Specific Data on Stock Tfr. for Purch. D
EKRS - ERS Procedure: Goods (Merchandise) Movements to b
EKUB - Index for Stock Transport Orders for Material
EORD - Purchasing Source List
EQUK - Quota File: Header -
How OSB archive the file name?
I have used JCA adapter to archive file while reading in OSB and OSB does archive the file with different name.
But OSB is creating the file with name as understandable form. Is it possible to give my own defined name while archiving the file(s).
Please help me !
-ThanksI dont think it is possible to change the names of the archive files once OSB processes the file. I haven't found any references of the same in the JCA adapter documentation as well.
You can check with Oracle support if this is feasible.
Thanks,
Patrick. -
MessageFileUpload how to retrive the file name?
Hi there guys,
maybe it's a stupid question but i cannot find the answer :_( any of you knows how to retrive the file name i am going to upload from the messageFIleUpload item?
Thank You, Pier Paolo.
Edit: Found in another post!! eeheh LAZY ME!! :_)
Message was edited by:
PandreoLNice to know that you found the solution. You could have as well used the javadoc for the same.
--Shiv -
LabVIEW 2011 file selection fails to fill in the file name into the "File name:" field
In LV2011 I am selecting a text file while my code is running. The "file name:" field is not populated with the selected file name.
This is inconvenient, especially if I want to modify a file name by one or some few characters.
How do i make LV 2011 behave like the previous versions?
Scientia est potentia!
Attachments:
File name is not filled in.PNG 72 KBThank you fot your reply it causd me to find the problem.
I figured it out while I was trying to extract the applicable section of my code to send it to you.
I had an asterisc wired to the "default name" input of the "File dialog" VI.
Now I am not wiring anything to the "default name" input of the "File dialog" VI and it works just fine.
I am sorry for your lost time.
Scientia est potentia!
Attachments:
Corrected code.PNG 10 KB
Maybe you are looking for
-
No matter which CD I play on my computer (using Windows Media Player), the title shows "Unknown Album", and each track is listed a s Track 1, 2, etc. instead of showing the song title. When I click on "Find album info", a message pops up saying "You
-
My new macbook pro has gone black on me three days in a row. is this a chronic problem? The only way to get it back is a hard reset or let the battery die and then plug in the charger. The brightness is up and the power stays on while screen is bla
-
CS5 No sound playback with HD422 clips
Hi, I installed CS5 Master parallel to my CS4 Master installation on a Windows 7 (64-bit) system. I opened a new HD422 project and imported HD422 1080i50 footage. If I play back the clips on the timeline or through the monitor I can't hear any sound.
-
i have a new ipad 2. can someone tell me how can i activate this. i have an wifi connection but when i try to activate i get the msg. "your ipad could not be activate because the activation server is temporarily unavailable" can some one helpme with
-
How to to connect 5.1 digtal speak
i get ?CREATIVE Audigy 2 Value?(oem) and i get a 5. digtal speaker but i get a problem to to connect tham the cable the come with the speaker(yamaha tss) dount match the card what cable shold i buy