Sign in to follow this  
Followers 0
markdui

Error with $ModDate

4 posts in this topic

Hi ,,

i am having problem with the below code. can someone assist me.

Basically this was passed to me from someone who is long gone (MIA)

It use to work until i tested it and now stuck at the Moddate ^

Appreciate if you could help me

Func UqKey()

$ModDt = FileGetTime(@ScriptDir & "\" & @ComputerName & "_Security_" & @YEAR & @MON & @MDAY & ".htm", 0, 0)

$ModDate = $ModDt[0] & $ModDt[1] & $ModDt[2] & $ModDt[3] & $ModDt[4]

$UniqueKey = ($ModDate * 81) + 250680

$Encrypt = StringReplace($UniqueKey, "e", "z")

$Encrypt = StringReplace($Encrypt, "+", "")

$Encrypt = StringReplace($Encrypt, "5", "S")

$Encrypt = StringReplace($Encrypt, "8", "B")

$Encrypt = StringReplace($Encrypt, "7", "L")

$Encrypt = StringReplace($Encrypt, ".", "#")

$Encrypt = StringReplace($Encrypt, "4", "H")

$Encrypt = StringReplace($Encrypt, "3", "K")

$Encrypt = $Encrypt

Return $Encrypt

EndFunc

Error

C:\Mark\My Scripts\W2K3 Scripts\Windows_Security.au3 (12295) : ==> Subscript used with non-Array variable.:

$ModDate = $ModDt[0] & $ModDt[1] & $ModDt[2] & $ModDt[3] & $ModDt[4]

$ModDate = $ModDt^ ERROR

Share this post


Link to post
Share on other sites



I expect that there is something wrong with the file you are trying to read, probably doesn't exist. Try adding this to the start of the function

$filename = @ScriptDir & "\" & @ComputerName & "_Security_" & @YEAR & @MON & @MDAY & ".htm"
if not fileExist($filename) then
 msgbox(0,'ERROR','No such file as' & @CRLF & $filename)
 return
endif

$ModDt = FileGetTime($filename, 0, 0)
if @error = 1 then
 msgbox(0,'ERROR',"Couldn't get time from file")
 return
endif
$ModDate = $ModDt[0] & $ModDt[1] & $ModDt[2] & $ModDt[3] & $ModDt[4]

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Assuming that there's an issue with the file it's referencing. Give this a shot:

Func UqKey()
    $ModFile = @ScriptDir & "\" & @ComputerName & "_Security_" & @YEAR & @MON & @MDAY & ".htm"
    If FileExists($ModFile) Then
        $ModDt = FileGetTime($ModFile, 0, 0)
        $ModDate = $ModDt[0] & $ModDt[1] & $ModDt[2] & $ModDt[3] & $ModDt[4]
        $UniqueKey = ($ModDate * 81) + 250680
        $Encrypt = StringReplace($UniqueKey, "e", "z")
        $Encrypt = StringReplace($Encrypt, "+", "")
        $Encrypt = StringReplace($Encrypt, "5", "S")
        $Encrypt = StringReplace($Encrypt, "8", "B")
        $Encrypt = StringReplace($Encrypt, "7", "L")
        $Encrypt = StringReplace($Encrypt, ".", "#")
        $Encrypt = StringReplace($Encrypt, "4", "H")
        $Encrypt = StringReplace($Encrypt, "3", "K")
        $Encrypt = $Encrypt
        Return $Encrypt
    Else
        MsgBox(48,"Error","Source File was not found for encryption mask." &@LF &@LF &$ModFile)
    EndIf

EndFunc

Edit: martin obviously had the same thought :) ^

Edited by Monamo

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

Thanks guy. am able to pit point whats causing the error. seems like it was unable to create a htm file. got to go figure. anyway thanks to all your help. :)

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