Jump to content
Sign in to follow this  
turbox

Small help with a script

Recommended Posts

turbox

I made a greek to ascii converter and filedelete can't delete the new created file charinfo.ini

here is the script:

$iniexist = FileExists("C:\charinfo.ini")

if $iniexist = 0 Then

run("cmd.exe")

WinWaitActive(@HomeDrive & "\WINDOWS\system32\cmd.exe")

send("cd\{ENTER}")

sleep(222)

send("copy con charinfo.ini{ENTER}")

sleep(222)

send("^z{ENTER}")

$inifile = "[Ascii]" & @CRLF & @CRLF & "Α=128" & @CRLF & "Β=129" & @CRLF & "Γ=130" & @CRLF & "Δ=131" & @CRLF & "Ε=132" & @CRLF & "Ζ=133" & @CRLF & "Η=134" & @CRLF & "Θ=135" & @CRLF & "Ι=136" & @CRLF & "Κ=137" & @CRLF & "Λ=138" & @CRLF & "Μ=139" & @CRLF & "Ν=140" & @CRLF & "Ξ=141" & @CRLF & "Ο=142" & @CRLF & "Π=143" & @CRLF & "Ρ=144" & @CRLF & "Σ=145" & @CRLF & "Τ=146" & @CRLF & "Υ=147" & @CRLF & "Φ=148" & @CRLF & "Χ=149" & @CRLF & "Ψ=150" & @CRLF & "Ω=151" & @CRLF & "α=152" & @CRLF & "β=153" & @CRLF & "γ=154" & @CRLF & "δ=155" & @CRLF & "ε=156" & @CRLF & "ζ=157" & @CRLF & "η=158" & @CRLF & "θ=159" & @CRLF & "ι=160" & @CRLF & "κ=161" & @CRLF & "λ=162" & @CRLF & "μ=163" & @CRLF & "ν=164" & @CRLF & "ξ=165" & @CRLF & "ο=166" & @CRLF & "π=167" & @CRLF & "ρ=168" & @CRLF & "σ=169" & @CRLF & "τ=171" & @CRLF & "υ=172" & @CRLF & "φ=173" & @CRLF & "χ=174" & @CRLF & "ψ=175" & @CRLF & "ω=224" & @CRLF & "ς=170" & @CRLF & "Ά=234" & @CRLF & "ά=225" & @CRLF & "Ώ=240" & @CRLF & "ώ=233" & @CRLF & "Ή=236" & @CRLF & "ή=227" & @CRLF & "Έ=235" & @CRLF & "έ=226" & @CRLF & "Ύ=239" & @CRLF & "ύ=231" & @CRLF & "Ί=237" & @CRLF & "ί=229" & @CRLF & "Ό=238" & @CRLF & "ό=230" & @CRLF & "Ϊ=244" & @CRLF & "ϊ=228" & @CRLF & "ϋ=232" & @CRLF & " =32"

FileOpen("C:\charinfo.ini", 1)

FileWrite(@HomeDrive & "\charinfo.ini", $inifile)

WinClose(@HomeDrive & "\WINDOWS\system32\cmd.exe")

Else

endif

$filecheck = FileExists ( @HomeDrive & "\Ascchars.txt" )

if $filecheck = 0 Then

run("cmd.exe")

WinWaitActive(@HomeDrive & "\WINDOWS\system32\cmd.exe")

send("cd\{ENTER}")

sleep(222)

send("copy con ascchars.txt{ENTER}")

sleep(222)

send("^z{ENTER}")

WinClose(@HomeDrive & "\WINDOWS\system32\cmd.exe")

$true = 1

Else

$true = 1

EndIf

if $True = 1 Then

$string = inputbox("Greek to Ascii converter", "Enter Greek word")

$strlen = StringLen($string)

if $strlen = 0 Then

Exit

Else

For $i = 1 to $strlen Step 1

$char = StringMid ( $string, $i, 1 )

$asciichar = "{ASC " & IniRead ( "C:\charinfo.ini", "Ascii", $char, "Not Exist" ) & "}"

FileOpen("C:\ascchars.txt", 1)

FileWrite("C:\ascchars.txt", $asciichar)

Next

FileDelete(@HomeDrive & "\charinfo.ini")

fileopen("C:\ascchars.txt", 1)

FileWrite("C:\ascchars.txt", " ( " & $string & " )" & @CRLF & @CRLF)

EndIf

EndIf

MsgBox(0, "Chars Location", "The file with characters is located on " & @HomeDrive & "\ascchars.txt")

can somebody help

Share this post


Link to post
Share on other sites
smashly

When using FileOpen to FileWrite you should use the handle from fileopen to filewrite.

If your using FileOpen then you need to use FileClose to close the file when your finished with it.

eg:

$FO = FileOpen("C:\ascchars.txt", 1)
FileWrite($FO, " ( " & $string & " )" & @CRLF & @CRLF)
FileClose($FO)

Cheers

Share this post


Link to post
Share on other sites
turbox

Thank you but what about filedelete command

Share this post


Link to post
Share on other sites
youknowwho4eva

Looks like your trying to delete without closing. need to close before you can delete


Giggity

Share this post


Link to post
Share on other sites
turbox

done

Edited by vakis

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.