Jump to content

Search the Community

Showing results for tags 'datetime'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 3 results

  1. I have a spreadsheet - daily routine which has two columns: activity and time as shown here | Activity | Time | |----------------------|----------| | Sleep | 6:00 am | | Toilet | 6:15 am | | Get ready for gym | 6:30 am | | Exercise | 7:50 am | | ... more things | 9:00 pm | | ... still more | 10:45 pm | | Sleep | 6:00 am | I wanted to find out, say in C1 which activity is current for me using now() I.e., if it’s 6:45am on my watch, it should show me Exercise in C1 Thanks to Adam D. PE, this formula works like magic to get the result =VLOOKUP(MOD(NOW(),1),{B2:B,A2:A},2,1) Now, I want to reproduce same result in autoit, how to do that? To have easy solution say, I copy-paste spreadsheet data in array directly in code, right? Use for loop and run the above vlookup function and show the answer using tooltip. How to achieve this? please help.
  2. I'm trying to display information from my printer queues and I cannot figure how to convert the 'datetime' value returned in the "time submitted" item to a date and time. Here's my test code: test3() Func test3() Local $str, $objWMIService, $AllPrintJobs, $PrintJob While 1 $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2") $AllPrintJobs = $objWMIService.ExecQuery("SELECT * FROM Win32_PrintJob") For $PrintJob In $AllPrintJobs $str = "" $str &= "Name: " & $PrintJob.Name & @CRLF ; Name of the printer $str &= "DocName " & $PrintJob.Document & @CRLF; Documentname $str &= "HostName: " & $PrintJob.HostPrintQueue & @CRLF ; Computer where the Printjob started from ; Time the printjob was submitted $str &= "Time Submitted: " & $PrintJob.TimeSubmitted & @CRLF $str &= @CRLF ConsoleWrite($str & @CRLF) Exit ;;; TESTING ;;; Next Sleep(1000) ;Log every second WEnd EndFunc ;==>test3 The Console output looks like this: Name: HP LaserJet Professional P 1102w, 2 DocName Test Page HostName: \\ANDY-LAPTOP2 Time Submitted: 20150624161307.544000-240How can I convert the "20150624161307.544000-240" value to a date and time?
  3. I am attempting to create a script which will poll a SQL database that is part of our internal server monitoring application. The results would then be pushed to the local growl client on my desktop. I am successful at querying the SQL database using the SQL UDF and can send growl notifications fine as well... What I run into is "Syntax error converting datetime from character string." when I try to query the database with the value from a previous query. (My appologies for making this sound confusing) For example, I query the database and return the results into a 2D array. I can display the results fine with "_ArrayDisplay". I then take the results from the query and using the next to last row from the results, get the value from the datetime column. $tmpDate = String($aData[$iRows-1][1]) MsgBox(0,"Date",$tmpDate) It is when I take the value in $tmpDate and attempt to search with it that I get the syntax error above. $iRval = _SQL_GetTable2D(-1, "select * from dbo.AllpagesToday WHERE PageRecip = 'SERVER_OC1' OR PageRecip = 'SERVER_ONCALL' AND Date > '" & $tmpDate & "' ORDER BY Date;", $aData, $iRows, $iColumns) I have also attempted to convert the date format from: 20120319090303 to 2012-03-19 09:03:03.000 to no avail. My conversion pieced together from other posts: Func _convertToDateTime($dtString) Local $newdt $newdt = StringRegExpReplace($dtString, "A(d{4})(d{2})(d{2})(d{2})(d{2})(d{2})(?:.*)","$1-$2-$3 $4:$5:$6") MsgBox(0,"Convert Results",$newdt) Return($newdt) EndFunc When I search using the converted datetime, it is as if the query ignored the datetime value and returns all values of the 2D array. $iRval = _SQL_GetTable2D(-1, "select * from dbo.AllpagesToday WHERE PageRecip = 'SERVER_OC1' OR PageRecip = 'SERVER_ONCALL' AND Date > '" & _convertToDateTime($tmpDate) & "' ORDER BY Date;", $aData, $iRows, $iColumns) Any suggestions? If more information is needed, let me know.
×
×
  • Create New...