This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Renaming a file with a timestamp extension
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 22, 2006
11:07 AM
Renaming a file with a timestamp extension
Hi,
I want to rename a file on a subsequent install with a timestamp at the end. Is there a variable in ISMP that I can use or will i need to write a custom bean that will do that?
I know java.util.Date will get me the timestamp but i wanted to know if I could use the Move file Action and rename the file to Filename_[Some timestamp property].
Thanks,
-mkapasi
I want to rename a file on a subsequent install with a timestamp at the end. Is there a variable in ISMP that I can use or will i need to write a custom bean that will do that?
I know java.util.Date will get me the timestamp but i wanted to know if I could use the Move file Action and rename the file to Filename_[Some timestamp property].
Thanks,
-mkapasi
(10) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 22, 2006
11:27 AM
I haven't tried it, but perhaps in your custom bean make up a Java system property that contains the date (using System.setProperty("TIMESTAMP", timestring)), and then use $J(TIMESTAMP) as part of the target file name?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 27, 2006
11:41 AM
I tried that but $P will not get me a java system property right? Is there a way to create and set a global variable from my product action which i can later access via $V resolver? I could not find the api to do that. Is there a link available to the javadocs for installshield classes?
Please help.
Thanks,
-mkapasi
Please help.
Thanks,
-mkapasi
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 27, 2006
12:39 PM
Sorry, I mean $J to get a Java system property, and not $P.
(In any case, the APIs command under the Help menu gives you access to the API documentation.)
(In any case, the APIs command under the Help menu gives you access to the API documentation.)
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 27, 2006
01:41 PM
But $J also does not get all the system properties does it? It only gets user.home, user.dir etc. I don't think it can get any system property...atleast not by the syntax $J(TIMESTAMP).
I tried that but that did not resolve.
Anything else i can try?
I tried that but that did not resolve.
Anything else i can try?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 27, 2006
01:51 PM
Yes, you should be able to use $J with a custom property that you've defined; is the issue that the value is blank, or that it still reads $J(propname)? If it still includes $J, then the field doesn't resolve any string-resolution expressions, and therefore $V, etc., wouldn't help...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 27, 2006
02:34 PM
The problem is that the value is blank.
I am setting it in my custom bean as System.setProperty("TIMESTAMP",mytimestring)
and then in my MoveFile product action (which comes after my custom bean) I set the target file to $N($P(absoluteinstalllocation)/mylogfile_$J(TIMESTAMP).log)
-Mkapasi
I am setting it in my custom bean as System.setProperty("TIMESTAMP",mytimestring)
and then in my MoveFile product action (which comes after my custom bean) I set the target file to $N($P(absoluteinstalllocation)/mylogfile_$J(TIMESTAMP).log)
-Mkapasi
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 27, 2006
03:08 PM
That's strange; if you place $J(TIMESTAMP) on (say) a dialog box that appears after your custom bean, does the value appear?
And how are you setting "mytimestring"?
And how are you setting "mytimestring"?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 27, 2006
04:26 PM
I did not try it on the dialog box but I was trying to set this property from withing a product action. As soon as I changed the code to extend a wizardaction instead it started working.
Is there no way to set a property from within a product action such that it can be used later by another product action?
Do you always need to use wizard actions to set some temporary properties?
My problem is solved but I would like to know the answers to these questions if you have them
Is there no way to set a property from within a product action such that it can be used later by another product action?
Do you always need to use wizard actions to set some temporary properties?
My problem is solved but I would like to know the answers to these questions if you have them
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 27, 2006
05:21 PM
As long as the action that sets the custom Java property occurs earlier in the product tree than the action that uses the value, it seems it should work...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 05, 2006
09:58 AM
Nothing for Nothing but why wouldn't you just use variables for your Source and Target in your Move Files action and set them in a CA or the Property Manager!
SOURCE = $V(OLD)
TARGET = $V(NEW)
You can set OLD and NEW vars in the properties manager and only set the Extenstion or the timestamp in a Custom Action using setVariableValue:
OLD --> $P(absoluteInstallLocation)/pathtooldfile/oldfilename
NEW -->$P(absoluteInstallLocation)/pathtooldfile/oldfilename.$V(EXTENSION)
Regards,
Tom
SOURCE = $V(OLD)
TARGET = $V(NEW)
You can set OLD and NEW vars in the properties manager and only set the Extenstion or the timestamp in a Custom Action using setVariableValue:
OLD --> $P(absoluteInstallLocation)/pathtooldfile/oldfilename
NEW -->$P(absoluteInstallLocation)/pathtooldfile/oldfilename.$V(EXTENSION)
Regards,
Tom