Sign in to follow this  
Followers 0
Noxcho

Help with read file name and write it to text file in specific line.

1 post in this topic

Hi everyone,

I am trying to create a custom script which would let me find out the date of my backup creation in a secure zone/backup capsule and then show me this date when I boot to special recovery interface.

As autoit is not able to read the file creation properties from an unmounted drive I've decided to use a workaround. Using script of my backup software I am able to read the properties and create a dummy file which has the date name.

Then autoit needs to read the name of that file and write it to a txt.ini file in specific section. This ini file then shows in UI interface the buttons and hints to a small graphic interface called runner.exe

But this does not work for me whatever I try. Can someone please shed some light on this? Where am I making a mistake?

Here is my script:

#include <File.au3>
#include <Date.au3>

_FileCreate(@ScriptDir & "\program\date.999")
ShellExecuteWait(@ScriptDir & "\program\scripts.exe", " -Wno --multiple a.psl", "", "", @SW_HIDE)

$filesearch = FileFindFirstFile ( "*.999" )
$dateraw = StringTrimRight(FileFindNextFile($filesearch), 4)
$LB_Date = StringLeft($dateraw, 2) & "." & StringMid($dateraw, 3, 2)& "." & StringRight($dateraw, 4)
$LB_Date2 = StringRight($dateraw, 4) & "/" & StringMid($dateraw, 3, 2)& "/" & StringLeft($dateraw, 2)
$LB_days = _DateDiff("d",$LB_Date2 & " 00:00:00", _NowCalc())

$PSR_Menu = IniRead(@ScriptDir & "\menu\runner.ini", "Menu_0", "Name_2","")
$PSR_Hint = IniRead(@ScriptDir & "\menu\runner.ini", "Menu_0", "Hint_2","")
IniWrite(@ScriptDir & "\menu\runner.ini", "Menu_0", "Name_2",$PSR_Menu & " (" & $LB_days & ") days")
IniWrite(@ScriptDir & "\menu\runner.ini", "Menu_0", "Hint_2",$PSR_Hint & " " & $LB_Date )
;~ ConsoleWrite(@ScriptDir & "\menu\runner.exe" & @CRlf)
ShellExecute(@ScriptDir & "\menu\runner.exe")

And the ini file runner.ini has the following lines:

 

[Menu_0]

Name_1=Restore Original State
Hint_1=All custom setting will be overwritten
Execute_1="%systemdrive%\Paragon\program\scripts\restorefactory.cmd"
Iconpath_1=restore.png

Name_2=Create or update user Backup
Hint_2=The user backup will be updated. If no backup was done yet, it will be created
Iconpath_2=hddbackup.png
Execute_2="%systemdrive%\paragon\program\scripts\updatefactory.cmd"

How do I make the script write the Hint_2 taking the name of .999 file?

 

Thanks!

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0