Updating properties file with values containing characters like slash (/)
Hi,
I am writing a java class that would create/update properties file. I am passing a string that contains colons. e.g. a path like
http://xyz.com
I am using the java.util.Properties.setProperty(String arg0, String arg1) method to set the key value and the java.util.Properties.store(OutputStream arg0, String arg1) to create/update the properties file.
The resulting property file contains the value as http\://xyz.com
A slash preappended to the colon.
I do not want this slash to be preappended.
How can I achieve that?
If you don't want this escaping to happend, then you don't want to be using java.util.Properties. Those define the file format in a certain way that includes escaping those characters.
If you don't want this, you'll have to write them using normal Writers (and read them using Readers) with your own parsing/storing logic added.
Similar Messages
-
Update jar file with modified class files
hi all,
I'm developing a jar utility for updating a jar file with modified class files as of now i have reached a point where in i can browse files and set it to required location
i.e i have developed a swings GUI application using JfileChooser and browse the files ..now my requirement is to update the jar files with modified class file
GUI looks like below
....enter the modified class file ----> d:\c.class
....enter the jar file path ---> d:\a.jar
update button now i have the requirement as
1> when i click on the update button ,my jar file (a.jar) should get updated with the latest class file (c.class)
can u help me to achieve this requirement.???
im stuck with this,,,if u can provide me wit the code for updating jar file with latest class file...it will really be helpful
if u can help me with the code on click on update button it will be really helpful
Thanks and expecting a faster response from u all java experts....Please find my query in bolds...i have written the partial code now,i need some help now
hope u guys can help me out...
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.File;
public class FileExplorer extends JDialog implements ActionListener
JTextField txtLocation_class;
JButton btnBrowse_class;
JLabel label_class;
JTextField txtLocation_jar;
JButton btnBrowse_jar;
JLabel label_jar;
JButton updatebutton;
public FileExplorer()
setSize(600,300);
//for class files
label_class = new JLabel("Please select Modified Class File");
txtLocation_class= new JTextField(20);
btnBrowse_class = new JButton("Browse");
btnBrowse_class.addActionListener(this);
//for jar files
label_jar = new JLabel(" Please select the Jar file");
txtLocation_jar= new JTextField(20);
btnBrowse_jar = new JButton("Browse");
btnBrowse_jar.addActionListener(this);
ActionListener updateListener = new ActionListener(){
public void actionPerformed(ActionEvent ae){
if(ae.getActionCommand().equalsIgnoreCase("Update")){
System.out.println("ae.getActionCommand() :: "+ae.getActionCommand());
System.out.println("Update Button is pressed");
*//Query :how do i access FilePath and FilePath1 here which*
* // has been set in public void actionPerformed(ActionEvent ae)*
* //method below*
* // FilePath ---??*
* // FilePath1 ---??*
* // how do i access the above 2 parameters*
* //Query :on click of update button i have to pass*
* //two parameters FilePath and FilePath1 to*
* //perform some functionality. please help me*
* //to achieve this..how do i access Filepath and Filepath1*
* //here which has been set below.*
} // end of if
} // end of actionPerformed
};// end of ActionListener
updatebutton = new JButton("Update");
updatebutton.addActionListener(updateListener);
//adding to the panel
JPanel pnl = new JPanel();
pnl.add(label_class);
pnl.add(txtLocation_class);
pnl.add(btnBrowse_class);
pnl.add(label_jar);
pnl.add(txtLocation_jar);
pnl.add(btnBrowse_jar);
pnl.add(updatebutton);
getContentPane().add(pnl);
public void actionPerformed(ActionEvent ae)
Object obj=ae.getSource();
if(obj==btnBrowse_class)
final JFileChooser fcstudent = new JFileChooser();
int rtrnval = fcstudent.showOpenDialog(this);
if(rtrnval==JFileChooser.APPROVE_OPTION)
try
File file=fcstudent.getSelectedFile();
String path = file.getPath();
System.out.println("This is Path:"+path);
txtLocation_class.setText(""+path);
String FilePath=txtLocation_class.getText();
System.out.println("FilePath is ::"+FilePath);
catch(Exception ex)
ex.printStackTrace();
}else if(obj==btnBrowse_jar){
final JFileChooser fcstudent = new JFileChooser();
int rtrnval = fcstudent.showOpenDialog(this);
if(rtrnval==JFileChooser.APPROVE_OPTION)
try
File file=fcstudent.getSelectedFile();
String path1 = file.getPath();
System.out.println("This is Path:"+path1);
txtLocation_jar.setText(""+path1);
String FilePath1=txtLocation_jar.getText();
System.out.println("FilePath is ::"+FilePath1);
catch(Exception ex)
ex.printStackTrace();
public static void main(String arg[]){
FileExplorer Exm= new FileExplorer();
Exm.setVisible(true);
} -
<blockquote>Locking duplicate thread.<br>
Please continue here: [/questions/815207]</blockquote><br>
if i try to download a file with any special characters in file name (e.g. File_Name.pdf), it doesn't reconvert them from the "sanitize url" process and download the file an incorrect name (e.g. File%5FName.pdf).
This is really annoying.
Thank you for your patientStart Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
* Don't make any changes on the Safe mode start window.
* https://support.mozilla.com/kb/Safe+Mode
* [[Troubleshooting extensions and themes]] -
Cannot rename file with non-ASCII characters when using the
My application moves files from one directory to another by calling File[] srcFiles = srcDir.listFiles() to get a list of files in the source directory, and then calling srcFiles.renameTo(destFile) to rename each file.
This does not work (renameTo returns false and the file is not moved) under the following circumstances:
- the file's leaf name contains non-ASCII characters, for example "�"
- the OS is Solaris 9
- the LANG and LC_* environment variables are unset, i.e. the C locale is being used
If I set the LANG environment variable to, for example, en_GB.UTF-8 then the rename succeeds.
I have tried calling srcFiles[index].getName().getBytes("UTF-8") and the non-ASCII characters are being replaced with ? (0x3f) characters when LANG is unset.
Is this a bug in the JRE? I would argue that since my code does not actually manipulate the filename (I just use the File object that File.listFiles() gives me) then the rename should succeed. Of course I would not expect the file name to be displayed correctly if I printed it out.
I have reproduced this behaviour with JDK 1.4.2_05 and 1.5.0_04 on Solaris 9.
FrancisThanks for the info Alan.
I considered setting the locale in the environment (this sounds like the "correct" fix to me and we might implement it later), but this application shares a WebLogic server with many other applications so we would have to do a huge amount of testing to make sure that the locale change wouldn't break the other apps. In the end I worked around the problem by making the code that generates the filenames in the first place strip out any non-ASCII characters (the names of the files are not critically important).
Looking forward to JSR-203, in the meantime perhaps a note about this behaviour in the java.io.File javadoc would be useful. -
Files with accented / special characters dissapear / not visable
I did everything which was suggested in threath http://discussions.apple.com/thread.jspa?threadID=875688&threadrate=2&messageid= 4170111#4170111 but have another problem which maybe new:
All the files appeared when I first used the USB HD on my Airport Extreme but a few weeks ago I tried to play a song via my Itunes and suddenly all my files containing special characters or accented characters where not recognized anymore. For example "josé gonzales - heartbeat.mp3" was gone...! Also in Finder.
I connected my harddrive to directlly to my mac and all the files we visable again! I did the account trick with password and moved all the files in the sharedfolder but still alle the files with accented characters where not visable??? I can't seem to find a solution? Does anyone got the same problem?
QrynActually, The inso filters do not even work for me for PDF file versions 1.2+. Is anyone else experiencing the same difficulties ? How often does Oracle update the INSO filters to keep up with vendors (Adobe/Microsoft) coming out with newer versions of their document products ?
null -
How to read a file with value of RAW data type? Please help
Hi Experts,
I have a file with RAW data like DE864E48833BFFF1B805001CC4EF4BFA
I am using GUI_UPLOAD.
But this FM is throwing error.
I tried by giving FILETYPE as ASC. The output internal table for this FM contains a field of type c size 32.
Now it is able to read the file but I want to assign this value to a RAW data type variable.
This it is unable to do. How to convert the char value to RAW data type?
Please help!
Thanks
GopalHi,
The documentation for the function module contains an example for RAW upload.
begin of itab,
raw(255) type x,
end of itab occurs 0.
CALL FUNCTION 'GUI_UPLOAD'
exporting
filetype = 'BIN'
filename = 'C:\DOWNLOAD.BIN'
tables
data_tab = itab. -
Create xml file with values from context
Hi experts!
I am trying to implement a WD application that will have some input fields, the value of those input fields will be used to create an xml file with a certain format and then sent to a certain application.
Apart from this i want to read an xml file back from the application and then fill some other context nodes with values from the xml file.
Is there any standard used code to do this??
If not how can i do this???
Thanx in advance!!!
P.S. Points will be rewarded to all usefull answers.
Edited by: Armin Reichert on Jun 30, 2008 6:12 PM
Please stop this P.S. nonsense!Hi,
you need to create three util class for that:-
XMLHandler
XMLParser
XMLBuilder
for example in my XML two tag item will be there e.g. Title and Organizer,and from ur WebDynpro view you need to pass value for the XML tag.
And u need to call buildXML()function of builder class to generate XML, in that i have passed bean object to get the values of tags. you need to set the value in bean from the view ui context.
Code for XMLBuilder:-
Created on Apr 4, 2006
Author-Anish
This class is to created for having function for to build XML
and to get EncodedXML
and to get formated date
package com.idb.events.util;
import java.text.SimpleDateFormat;
import java.util.Date;
import com.idb.events.Event;
public class XMLBuilder {
This attribute represents the XML version
private static final double VERSION_NUMBER = 1.0;
This attribute represents the encoding
private static final String ENCODING_TYPE = "UTF-16";
/*Begin of Function to buildXML
return: String
input: Event
public String buildXML(Event event) {
StringBuffer xmlBuilder = new StringBuffer("<?xml version=\"");
xmlBuilder.append(VERSION_NUMBER);
xmlBuilder.append("\" encoding=\"");
xmlBuilder.append(ENCODING_TYPE);
xmlBuilder.append("\" ?>");
xmlBuilder.append("<event>");
xmlBuilder.append(getEncodedXML(event.getTitle(), "title"));
xmlBuilder.append(getEncodedXML(event.getOrganizer(), "organizer"));
xmlBuilder.append("</event>");
return xmlBuilder.toString();
/End of Function to buildXML/
/*Begin of Function to get EncodedXML
return: String
input: String,String
public String getEncodedXML(String xmlString, String tag) {
StringBuffer begin = new StringBuffer("");
if ((tag != null) || (!tag.equalsIgnoreCase("null"))) {
begin.append("<").append(tag).append(">");
begin.append("<![CDATA[");
begin.append(xmlString).append("]]>").append("</").append(
tag).append(
">");
return begin.toString();
/End of Function to get EncodedXML/
/*Begin of Function to get formated date
return: String
input: Date
private final String formatDate(Date inputDateStr) {
String date;
try {
SimpleDateFormat simpleDateFormat =
new SimpleDateFormat("yyyy-MM-dd");
date = simpleDateFormat.format(inputDateStr);
} catch (Exception e) {
return "";
return date;
/End of Function to get formated date/
Code for XMLParser:-
Created on Apr 12, 2006
Author-Anish
This is a parser class
package com.idb.events.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import com.idb.events.Event;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
public class XMLParser {
Enables namespace functionality in parser
private final boolean isNameSpaceAware = true;
Enables validation in parser
private final boolean isValidating = true;
The SAX parser used to parse the xml
private SAXParser parser;
The XML reader used by the SAX parser
private XMLReader reader;
This method creates the parser to parse the user details xml.
private void createParser()
throws SAXException, ParserConfigurationException {
// Create a JAXP SAXParserFactory and configure it
SAXParserFactory saxFactory = SAXParserFactory.newInstance();
saxFactory.setNamespaceAware(isNameSpaceAware);
saxFactory.setValidating(isValidating);
// Create a JAXP SAXParser
parser = saxFactory.newSAXParser();
// Get the encapsulated SAX XMLReader
reader = parser.getXMLReader();
// Set the ErrorHandler
This method is used to collect the user details.
public Event getEvent(
String newsXML,
XMLHandler xmlHandler,
IWDMessageManager mgr)
throws SAXException, ParserConfigurationException, IOException {
//create the parser, if not already done
if (parser == null) {
this.createParser();
//set the parser handler to extract the
reader.setErrorHandler(xmlHandler);
reader.setContentHandler(xmlHandler);
InputSource source =
new InputSource(new ByteArrayInputStream(newsXML.getBytes()));
reader.parse(source);
//return the results of the parse
return xmlHandler.getEvent(mgr);
Code for XMLHandler:-
Created on Apr 12, 2006
Author-Anish
This is a parser class
package com.idb.events.util;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import com.idb.events.Event;
Created on Apr 12, 2006
Author-Anish
*This handler class is created to have constant value for variables and function for get events,
character values for bean variable,
parsing thr date ......etc
package com.idb.events.util;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.helpers.DefaultHandler;
import java.util.*;
import com.idb.events.Event;
import com.sap.tc.webdynpro.progmodel.api.IWDMessageManager;
public class XMLHandler extends DefaultHandler {
private static final String TITLE = "title";
private static final String ORGANIZER = "organizer";
IWDMessageManager manager;
private Event events;
private String tagName;
public void setManager(IWDMessageManager mgr) {
manager = mgr;
This function is created to get events
public Event getEvent(IWDMessageManager mgr) {
manager = mgr;
return this.events;
This function is created to get character for setting values through event's bean setter method
public void characters(char[] charArray, int startVal, int length)
throws SAXException {
String tagValue = new String(charArray, startVal, length);
if (TITLE.equals(this.tagName)) {
this.events.setTitle(tagValue);
if (ORGANIZER.equals(this.tagName)) {
String orgName = tagValue;
try {
orgName = getOrgName(orgName);
} catch (Exception ex) {
this.events.setOrganizer(orgName);
This function is created to parse boolean.
private final boolean parseBoolean(String inputBooleanStr) {
boolean b;
if (inputBooleanStr.equals("true")) {
b = true;
} else {
b = false;
return b;
This function is used to call the super constructor.
public void endElement(String uri, String localName, String qName)
throws SAXException {
super.endElement(uri, localName, qName);
/* (non-Javadoc)
@see org.xml.sax.ErrorHandler#fatalError(org.xml.sax.SAXParseException)
This function is used to call the super constructor.
public void fatalError(SAXParseException e) throws SAXException {
super.fatalError(e);
This function is created to set the elements base on the tag name.
public void startElement(
String uri,
String localName,
String qName,
Attributes attributes)
throws SAXException {
this.tagName = localName;
if (ROOT.equals(tagName)) {
this.events = new Event();
public static void main(String a[]) {
String cntry = "Nigeria";
XMLHandler xml = new XMLHandler();
ArrayList engList = new ArrayList();
engList = xml.getCountries();
ArrayList arList = xml.getArabicCountries();
int engIndex = engList.indexOf(cntry);
System.out.println("engIndex :: " + engIndex);
String arCntryName = (String) arList.get(engIndex);
System.out.println(
">>>>>>>>>>>>>>>>>>>>" + xml.getArabicCountryName(cntry));
Hope that may help you.
If need any help , you are most welcome.
Regards,
Deepak -
How to read properties file(key-value) in OSB?
Hi
I have a scenario in which I have to read some properties(key-value) from a file. Earlier whole code was developed in java and its easy to read properties file in java.
But now need to implement this in OSB and performance is very critical in this project.
I followed DVM approached defined in
http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html and http://blogs.oracle.com/christomkins/2010/02/domain_value_maps_in_oracle_se.html
But it did not work. I have hundreds of properties(key-value pairs) to read and need pass them to the business service along with input of proxy service.
What is the best approach for this (Can not go for db call as performance is very critical)?
Thanks
Vibhor$DVM= <dvm name="InterfaceProperties" xmlns:ns1="http://xmlns.oracle.com/dvm" xmlns="http://xmlns.oracle.com/dvm">
<columns>
<column name="PROPERTY_KEY" qualifier="false" order="1"/>
<column name="PROPERTY_VALUE" qualifier="false" order="1"/>
</columns>
<rows>
<row>
<cell>dealer.locate.default.buypower.link</cell>
<cell>http://www.xyz.com</cell>
</row>
<row>
<cell>dealer.locate.default.unitOfMeasure</cell>
<cell>MILES</cell>
</row>
<row>
<cell>dealer.locate.brand.identifier.nu</cell>
<cell>Nurun</cell>
</row>
<row>
<cell>dealer.locate.brand.identifier.bu</cell>
<cell>Buick</cell>
</row>
<row>
<cell>dealer.locate.brand.identifier.ca</cell>
<cell>Cadillac</cell>
</row>
</rows>
</dvm>
XPATH is- ns1:dvm/ns1:rows[1]/ns1:row[1]/ns1:cell[1]/text()
If I run this xpath in Jdeveloper,its giving me proper output.
Please this as CQuery resource and try to run this xpath on OSB console.
Thanks
Vibhor
Edited by: Vibhor Rastogi on Sep 21, 2010 4:59 AM -
Upload text files with non-english characters
I use an Apex page to upload text files. Then i retrieve the contents of files from wwv_flow_files.blob_content and convert them to varchar2 with utl_raw.cast_to_varchar2, but characters like ò, à, ù become garbage.
What could be the problem? Are characters lost when files are stored in wwv_flow_files or when i do the conversion?
Some other info:
* I see wwv_flow_files.DAD_CHARSET is set to "ascii", wwv_flow_files.FILE_CHARSET is null.
* Trying utl_raw.cast_to_varchar2( utl_raw.cast_to_raw('àòèù') ) returns 'àòèù' correctly;
* NLS_CHARACTERSET parameter is AL32UTF8 (not just english ASCII)Hi
Have a look at csv upload -- suggestion needed with non-English character in csv file it might help you.
Thanks,
Manish -
Robohelp 9 .properties file inserting non-printable characters @ export
I have a mapped help file that I am generating for integration to an online application. When we export the .properties file from the Project Set-up pod, the mapped files appear to be fine, if viewed in Notepad (see below).
However, when this is viewed in a different text editor, you can see that RoboHelp added additional non-printable characters to the .properties file (see below).
We've tried generating this from different computers, exporting it to different locations, retyping the initial entry, and haven't found a solution to this issue.
Does anyone know if there is a fix available? Are we doing something wrong?
Thanks!!
KellyAsk your developers if they think these characters could be what are known as BOM (byte order marks).
That is something can be seen in some files using the default encoding. There it can be changed by changing the encoding in the SSL dialog.
Maybe that explains it and if that is the cause, I don't know how you would prevent it here in Rh. I think you will have to live with your own solution.
See www.grainge.org for RoboHelp and Authoring tips
@petergrainge -
Properties-file with a relative path...
Hello everybody,
my question is as follows:
I have a directory-structure like below:
root_dir
|
-- source
|
-- classes
|
-- libs
|
-- xmlfiles
|
myproperties.propsIn words: my root_dir (is actually a subdirectory in my fs) contains folders like source (java-files), classes (class-files)... and a properties-file myproperties.props. The source-dir has subdirs like com/xyz/bla/Mainclass.java...
I want to load the properties-file from the main-class, but without using the absolute path. That's the way I do it at the moment:
Properties props = new Properties();
props.load(new FileInputStream("d:\\foo\\something\\root_dir\\myproperties.props"));But I don't want to write the whole path, because of portability (forget the \\ :) )!
How can I obtain the root_dir?
Thanx for helping!
Regards, Robert4Well I was already working on a replacer for /../ stuff before I was pointed to the File class. Not the best code I've written, but works fine. Perhaps it could be of use to you.
public void setCoordinatesFileURL(String coordFileURL)
coordinatesFileURL=coordFileURL;
//replace .. to get canonical path
StringTokenizer st = new StringTokenizer(coordinatesFileURL,"/");
String[] stringURL= new String[st.countTokens()];
int teller=0;
while(st.hasMoreTokens())
String token=st.nextToken();
if(!token.equals(".."))
stringURL[teller]=token;
teller++;
else
teller--;
coordinatesFileURL="";
for(int i=0; i<teller-1;i++)
coordinatesFileURL+=stringURL[i]+"/";
coordinatesFileURL+=stringURL[teller-1];
} -
Updating a file with new input
Hi. How would I be able to read in a file, and than update that same file with input from the user? Example: I have a file named 'Num' with the numbers '1','2', and '3' in it. How could I read those three numbers in, and than update it the file with something the user puts in, like '4'? Thanks.
import java.io.*;
public class ReadAndUpdateFile
public static void main(String args())
throws Exception
new ReadAndUpdateFile(args(0));
} // main
public ReadAndUpdateFile(String file)
throws FileNotFoundException, IOException
String line = null;
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file)));
while ((line = br.readLine()) != null)
System.out.println(line); // dump each line
br.close();
System.out.println("Enter your number:");
br = new BufferedReader(new InputStreamReader(System.in));
line = br.readLine(); // Get User Input
boolean append = true; // True means that it will append to the file
// if it exists and create it if it doesn't
// set to false it will overwrite it with a new file
FileOutputStream fos = new FileOutputStream(file, append);
fos.write(line.getBytes());
fos.flush();
fos.close();
} // ReadAndUpdateFile
} // ReadAndUpdateFileOK... this gives you a VERY good idea... read the javadocs to understand it
PS I didn't compile it... so it may not compile.. but it is VERY close... -
Hi,
I would like to know if its possible to insert or update
existing data of a XML file with flash?
And how can I do it?This code have two procedures or functions the createXML is
called first this one asks for the variable send using get called
fileName (Append this variable to the page request). The function
called writeToFile opens the file and writes to it.
Form flash you need to create the xmlfile and call the
sendAndLoad method. -
Properties files with Tomcat 4.0.1
I'm having trouble finding properties files using Class.getResourceAsStream
Properties props = new Properties();
try {
props.load(Class.class.getResourceAsStream("/Database.properties"));
catch (IOException e) {
//error reading from stream
}The above code works fine on several web server (including Tomcat 3.2.3), but fails on Tomcat 4.0.1 - the server takes around 50 seconds to return a response, then throws a StackOverflowError. The properties file is in WEB-INF/classes.
Has anybody else had the same problem?Thanks for the reply Guido.
However, I can't use the ServletContext to load the files I'm after, because the code is part of the data tier and should not be dependent upon the controller (in fact I have no reference to the ServletContext).
If I can't use Class.getResourceAsStream in Tomcat 4, does that mean that any third party APIs that rely on it will fail? - seems a little strange to me!
The Tomcat 4.0 documentation says:
"All unpacked classes and resources in the /WEB-INF/classes directory of your web application archive, plus classes and resources in JAR files under the /WEB-INF/lib directory of your web application archive, are made visible to the containing web application, but to no others."
I would expect "All unpacked classes and resources" to include all unpacked resources (such as properties files)
I've now managed to load the properties file using this code:
props.load(new FileInputStream(getClass().getResource("/Database.properties").getFile()));(don't know why getResource should work when getResourceAsStream doesn't, but that's what appears to be happening).
Now I have a new problem - loading a JDBC driver. I get:
java.lang.NoClassDefFoundError: oracle/jdbc/pool/OracleDataSource
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:120)
when I call
new OracleConnectionCacheImpl()
but the class does exist, in a zip file (OracleThinClientJDBCDriver_901.zip) in WEB-INF/lib. It looks to me like the oracle code in the lib directory has been found by the ClassLoader, but that Class.forName does not work...eh?!? -
Edit/update config file with Applescript??
am trying to read the file and then trying to change the values of the same with permissions, pls suggest how to write the same file with permissions.
The below script gives me the values as shown below, i need to change those values like aaaaa to 1, pls suggest.
set fileContents to {}
set x to ""
set filepath to POSIX path of "Macintosh HD:Library:Application Support:Macromedia:abc.cfg"
try
open for access filepath
set fileContents to (read filepath)
close access the filepath
on error
return false
end try
fileContents
output :
"aaaaa=0
bbbbbbb=0If you want to write to the file you need to open it with write permissions
open for access filepath with write permission
Ideally you should store the result of that command as a reference to the opened file:
set myFile to open for access filepath with write permission
now you can read the data:
set fileData to read myFile
You can erase the file by setting the EOF to 0:
set eof myFile to 0
(otherwise writing to the file appends data, rather thatn overwriting it)
You can write data to the file:
write "blah blah blah" to myFile
and close it when you're done:
close access myFile
Maybe you are looking for
-
Photo shows up on site, but not in iWeb
I have a little issue! I've created this site : http://people.stfx.ca/asandnes/Site2/Homepage_of_Dr._AdelaSandness.html But at the bottom of each page is a photo of trees that shouldn't be there. When I try to find this mysterious photo in iWeb- it i
-
IP: create 0AC_DOC_NO if no entry in Input Query
Hello Gurus, If in my Input Query no Entry in the Objct 0AC_DOC_NR, then create a new one. How can i solve this Problem, wich are the steps for it ? Thanks BKY
-
Set an ip unnumbered from radius
Hi all, I was reading a lot documentation and testing a lot of scenarios but i can not set template configuration from RADIUS⦠This it my configuration, aaa new-model aaa authentication login admin local aaa authentication ppp default local group r
-
Having issues installing Laserjet 2250n on Windows XP
Hi, I am having issues installing my HP Laserjet 2250n on my computer running Windows XP. I have downloaded a number of drivers from the HP site (listed below) and each time i try to install through windows new hardware wizard, it gives me a message
-
3D no se abre en mi photoshop cc
por favor haber si alguien me puede dar una solucion a este (fallo) o algo estoy haciendo mal.