sandman Posted May 5, 2007 Posted May 5, 2007 (edited) I am getting really frustrated with this.. here is my code:Global Const $ubuntuHotkey = IniRead($iniPath, "Settings", "ubuntuhotkey", "^!a") Global Const $winHotkey = IniRead($iniPath, "Settings", "winhotkey", "^!d") HotKeySet($ubuntuHotkey, "ShowUbuntu") HotKeySet($winHotkey, "ShowWindows") Func ShowUbuntu() Local $cWin = WinExists($vmxName) If $cWin = 0 Then MsgBox(0, "Uh-oh!", "Ubuntu is not running!") Return 0 Else WinSetState($vmxName, "", @SW_SHOW) Sleep(50) Send("^g") Return 1 EndIf EndFunc Func ShowWindows() Local $cWin = WinActive($vmxName) If $cWin = 0 Then MsgBox(0, "Uh-oh!", "Ubuntu is not the active window!") Return 0 Else Send("^!") Sleep(50) WinSetState($vmxName, "", @SW_MINIMIZE) EndIf EndFuncI have already tried using variables and normal text for HotKeySet.. neither work. When the keys are pressed, as you can see by the function, it will do SOMETHING. But even if I press these keys a billion times, NOTHING happens. I have tried both with the windows active and inactive. Oh God, I feel like the guy in my avatar Hopefully this won't be one of my stupid questions again. Edited May 5, 2007 by sandman [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
tAKTelapis Posted May 5, 2007 Posted May 5, 2007 (edited) sorry to say it, but i think you need a break sandman, rather basic mistake. your script opens, then closes. throw in a loop with a sleep, and bob is your mothers brother. ... try this: Global Const $ubuntuHotkey = IniRead($iniPath, "Settings", "ubuntuhotkey", "^!a") Global Const $winHotkey = IniRead($iniPath, "Settings", "winhotkey", "^!d") HotKeySet($ubuntuHotkey, "ShowUbuntu") HotKeySet($winHotkey, "ShowWindows") while 1 Sleep(250) WEnd Func ShowUbuntu() Local $cWin = WinExists($vmxName) If $cWin = 0 Then MsgBox(0, "Uh-oh!", "Ubuntu is not running!") Return 0 Else WinSetState($vmxName, "", @SW_SHOW) Sleep(50) Send("^g") Return 1 EndIf EndFunc Func ShowWindows() Local $cWin = WinActive($vmxName) If $cWin = 0 Then MsgBox(0, "Uh-oh!", "Ubuntu is not the active window!") Return 0 Else Send("^!") Sleep(50) WinSetState($vmxName, "", @SW_MINIMIZE) EndIf EndFunc Edited May 5, 2007 by tAKTelapis
sandman Posted May 5, 2007 Author Posted May 5, 2007 Yes, I already have that, sorry to not post it What I posted was only a portion of my code. That is included in my full script, but it doesn't work. [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
tAKTelapis Posted May 5, 2007 Posted May 5, 2007 hmm, well, i created an ini file: c:\test.ini and specified it as $inipath (for testing) and over-wrote your chosen default values with A and S. as such: [settings] ubuntuhotkey=a winhotkey=s and when i hit A or S, i get an error, but it does activate the function like it is meant to.. perhaps if you removed the default values, and juts ran with what is in the ini file.
sandman Posted May 5, 2007 Author Posted May 5, 2007 Hm, that's weird, it works now.. I should report that then. That's WEIRD.. Okay, well, thanks! [center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]
martin Posted May 5, 2007 Posted May 5, 2007 Hm, that's weird, it works now.. I should report that then. That's WEIRD..Okay, well, thanks!Can't follow what's been said here.I don't see any problem with the "^!a" or "^!d" in the defaults or in the ini file, change either and what's in the ini file works. Remove the setting from the ini file and the default setting works. No errors. 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now