Problems with Windows 8 64 bit

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Problems with Windows 8 64 bit

21 Oct 2013, 23:05

I have a script that works without error on Windows 7 64 bit. On Windows 8 I've seen two errors. I believe the first is due to Windows 8 not finding the path to my files. The script is in a separate directory from other files. Relative paths are required. This is what I have been using:

Code: Select all

SetWorkingDir %A_ScriptDir%  	; Ensures a consistent starting directory.
SetWorkingDir ..\			; Makes the root folder \files
Can someone please confirm whether this works with Windows 8 or not, and if it doesn't does suggest a fix.

The second error is a message that says:
---------------------------
Test.ahk
---------------------------
Error: Too many fonts.

Line#
446: Step := 1.05
447: Else
448: Step := 0.95
449: Loop
449: {
450: CalcFS := Round(CalcFS * Step)
451: Gui,New
---> 452: Gui,Font,s%CalcFS% Bold,aakidprint
453: Gui,Add,Text,vCtrl,%txt%
454: GuiControlGet,Ctrl,Pos
455: Gui,Destroy
456: if (Step > 1)
456: {
457: if (CtrlW > fWd * max) || (CtrlH > fHt * max)
458: Break

The current thread will exit.
---------------------------
OK
---------------------------
aakidprint is a font installed on the system. The message goes away if I change it to arial. The code is from a procedure suggested by just me from the old forum. What does it mean by "Too many fonts"? Thanks
lexikos
Posts: 9665
Joined: 30 Sep 2013, 04:07
Contact:

Re: Problems with Windows 8 64 bit

22 Oct 2013, 02:44

There is no reason that SetWorkingDir or relative paths should function any differently on Windows 8 than they did on Windows 95. You can confirm that the working directory is correct by inspecting A_WorkingDir:

Code: Select all

MsgBox %A_WorkingDir%
For each combination of size, style and font family that you use, the Gui command creates a GDI font object. There is a limit of 200.
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: Problems with Windows 8 64 bit

22 Oct 2013, 14:32

Thanks for the reply. The following script works with Windows 7, but not Windows 8. It fails to read the words from the text file and the last msgbox is blank. Can you suggest what's wrong?

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Recommended for catching common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
#Warn  ; Recommended for catching common errors.
#Singleinstance, force
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.

SetWorkingDir %A_ScriptDir%  	; Ensures a consistent starting directory.
SetWorkingDir ..\			; Makes the root folder \files	
		
msgbox, 4096, Path, %A_WorkingDir%

WordsToUse =
	
Filereadline, FileToLoad, Settings\Touch The Picture.txt, 1

if FileToLoad =
exitapp

msgbox,4096,File, %FileToLoad%
	
Loop, read, %FileToLoad%
if A_loopreadline is not space
WordsToUse = %WordsToUse%%A_loopreadline%`n

msgbox,4096,Words, %WordsToUse%
lexikos
Posts: 9665
Joined: 30 Sep 2013, 04:07
Contact:

Re: Problems with Windows 8 64 bit

22 Oct 2013, 16:33

What is %FileToLoad%? Does that file exist? If you do the following, what does it display?

Code: Select all

FileRead text, %FileToLoad%
MsgBox %ErrorLevel%/%A_LastError%
User avatar
PuzzledGreatly
Posts: 1303
Joined: 29 Sep 2013, 22:18

Re: Problems with Windows 8 64 bit

22 Oct 2013, 19:47

Thanks, problem solved. The code you suggested gave 0/0 on my Windows 7 machine and 1/2 on my Windows 8 machine. FileToRead stores the name of the file to be read in the loop. My Path and File msgboxes were showing correctly on both machines but I failed to notice that the drive letter was wrong on the Windows 8 machine. I need to add an Ifnotexists routine to trap the error you found.
lexikos
Posts: 9665
Joined: 30 Sep 2013, 04:07
Contact:

Re: Problems with Windows 8 64 bit

23 Oct 2013, 05:27

The same sort of thing was common when users were moving to Windows 7. People are quick to blame the OS and ignore any other changes they've made, like installing a newer version of AutoHotkey. ;)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: pgeugene and 87 guests