Jump to content

Invoking autoit snipet by shortcut disables pc (windows 7 64bit)


kaengo
 Share

Recommended Posts

Hello all,

below is a very nice snippet.

I've been using it often several times a day, because when I'm making a entry at a log or journal,

I wished to precede it by the actual time.

It worked with all programs, text, ms office, open office or google docs.

I'm starting it using a short-cut while working at a document.

Always it was difficult to use, it was needful to press the keys very short to invoke the snippet,

but it worked.

If you pressed the keys (I used CTR+ALT+D) to long, the behaviour of the pc/keyboard whould become ,crazy'

Now I changed from windows xp64 to windows 7 64bit. I compiled the script newly, using the 64bit option.

When I start it, by shortcut, ,nothing goes'. The keyboad is working wrong, the left mouse button works as it is the right.

Also the wished date isn't send to the text document, which was active at the time of invoking the snippet.

Only get-out is to reboot the pc.

I think, the snippet is changing the active window, but I'm not sure.

Does someone here knows a way out or a workaround?

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=C:\mein_d\meine_programme\datum64.exe
#AutoIt3Wrapper_UseX64=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.0.0
Author:      Holger Steffen

Script Function:
Fuegt Datum und Zeit ein
013 12:51

#ce ----------------------------------------------------------------------------
#include <Date.au3>
#include <WindowsConstants.au3>

Dim $tCur
Dim $formatiert
Dim $MyDate
Dim $MyTime
Dim $wochentag
Dim $woTaNum
Dim $woTaNam
Dim $meineZeit

$tCur = _Date_Time_GetLocalTime()
$formatiert =_Date_Time_SystemTimeToDateTimeStr($tCur)
_DateTimeSplit($formatiert,$MyDate,$MyTime)

$wochentag = _Date_Time_SystemTimeToArray($tCur)
$woTaNum = $wochentag[7]
switch $woTaNum
Case 1
$woTaNam = "Montag"
Case 2
$woTaNam = "Dienstag"
Case 3
$woTaNam = "Mittwoch"
Case 4
$woTaNam = "Donnerstag"
Case 5
$woTaNam = "Freitag"
Case 6
$woTaNam = "Samstag"
Case Else
$woTaNam = "Sonntag"
EndSwitch

$meineZeit = _NowTime(4)

send ($woTaNam)
send (", ")
send ($MyDate[2])
send (".")
send ($MyDate[1])
send (".")
send ($MyDate[3])
send (" ")
send ($meineZeit)
send ("{ENTER}")


exit
Link to comment
Share on other sites

Try compiling it as a 32 bit program instead and see if that works. Perhaps trying to access 32 bit windows is what is failing.

Also, you need to explain what this " the behaviour of the pc/keyboard whould become ,crazy" means before we can give you much help.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thank you for the tip.

I tried now with no success.

With ,crazy' I mean, that keyboard nor mouse are working correct after invoking the snippet.

Maybe, the behaviour is, if someone has pressed the ctr or alt key before.

Sometimes with pressing ctr+ a key, it successes, to work normally again,

The left mouse button is behaving as the right.

Greetings,

H.Steffen

Link to comment
Share on other sites

Try this suggestion from the Wiki to fix the issue with the stuck key.

I'm guessing that it's a stuck key because once again you used a very vague description of the problem you're having. This "With ,crazy' I mean, that keyboard nor mouse are working correct after invoking the snippet." makes it clear as mud as to what you meant by 'crazy'. Not working correctly doesn't tell anyone anything about what the problem is. I'd suggest reading the top link in my signature to get a better idea of how to request help, it will benefit you in the long run.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thank you, the tip was helpful, the keyboard is no longer blocked by the short-key.

But the date doesn' appear at the wished document, which have had the focus at the moment of invoking the key.

I think, the focus is switching to the autoit-Program (it didn't, if used with windows xp64)

Does anyone know?

Greetings, Holger

Link to comment
Share on other sites

Perhaps this helps :thumbsup:

#include <String.au3>
;If not HotKeySet("!^d", "_Hotkey") Then .......... ; alt+cntl+D is already used in my system. So I prefer '°'
If Not HotKeySet("°", "_Hotkey") Then Exit MsgBox(262144 + 16, "Timestamp Error", "Hotkey is already used by another program", 0)
Func _Hotkey()
$Tag = _StringBetween("1Sonntag 2Montag 3Dienstag 4Mittwoch 5Donnerstag 6Freitag 7Samstag", @WDAY, " ")
ClipPut($Tag[0] & ", " & @MDAY + 0 & "." & @MON + 0 & "." & @YEAR & " " & @HOUR + 0 & ":" & @MIN & @CRLF)
Send("^v")
EndFunc ;==>_Hotkey
While Sleep(9999999) ; leaves the cpu consumption low
WEnd

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

  • 2 weeks later...

My version above was for german usage only.

Here an international version where the daynames are in your language.

;If not HotKeySet("!^d", "_Hotkey") Then .......... ; alt+cntl+D is already used in my system. So I prefer '°'
If Not HotKeySet("°", "_Hotkey") Then Exit MsgBox(262144 + 16, "Timestamp Error", "Hotkey is already used by another program", 0)
Func _Hotkey()
    Local $clip = ClipGet()  ; save text from clipboard
    ClipPut(__GetLongDayName() & ", " & @MDAY + 0 & "." & @MON + 0 & "." & @YEAR & " " & @HOUR + 0 & ":" & @MIN & @CRLF)  ; put text to clipboard
    Send("^v") ; paste text from clipboard to active window (CTRL+V)
    ClipPut($clip) ; restore saved text to clipboard
EndFunc   ;==>_Hotkey
While Sleep(9999999) ; leaves the cpu consumption low
WEnd
Func __GetLongDayName($day = @WDAY)
    Local $a = DllCall('kernel32.dll', 'int', 'GetLocaleInfoW', 'ulong', Dec(@OSLang), 'dword', Mod(($day+5),7)+42, 'wstr', '', 'int', 2048)
    Return $a[3]
EndFunc   ;==>__GetLongDayName
Edited by Exit

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
Share on other sites

  • 2 weeks later...

I put a:

Send("!{TAB}")

into the script before output of date.

Now my script is working fine.

Am I right, that your script puts the date to the clipboard?

I think, that's a disadvantage, because than the clipboard is blocked?

Greetings, Holger

Link to comment
Share on other sites

Am I right, that your script puts the date to the clipboard?

I think, that's a disadvantage, because than the clipboard is blocked?

If you use the international script (Post #7), the clipboard is saved before usage and restored after.

See the comments in the code.

App: Au3toCmd              UDF: _SingleScript()                             

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...