How to change system localization through AutoIt? - winapi

One of my (very old VB6) programs crashes when the system uses numbers in thousands with a "," (european?) instead of a "." (American?). This is can be changed in windows using the "format" setting (found in the localization settings).
What I want to do is build a script that changes this setting in Windows 7 during the use of the program. I know I probably have to use the Winapi extension in AutoIt, but is there a function for this so I can make a script that calls it and changes this setting and on opening and back on the closing of the program?
Thanks in advance!

Just use RegWrite("HKEY_CURRENT_USER\Control Panel\International", "sThousand", "REG_SZ", ".") to change this setting directly. You can find a good explanation for these values at windowsitpro. Maybe you want to change "sDecimal" as well?

Look at _WinAPI_SetLocaleInfo() and _WinAPI_GetLocaleInfo() in WinAPILocale.au3.

Related

Global Hotkeys UI-control for program settings

In my first MacOS desktop program I need to be able to put my own global hotkeys for certain actions.
In many other programs I saw a special UI-control for these purposes, like that:
I also want something like that in my program, but searching right library panel (and also googled), I did not found the component like this...
Where to find? How to use? The link on download and a brief tutorial would be appreciated!
ShortcutRecorder: http://wafflesoftware.net/shortcut/, but you want this fork: https://github.com/Kentzo/ShortcutRecorder to work with Xcode 4.
Alternatively MasShortcut: https://github.com/shpakovski/MASShortcut.

Open an application in a space using applescripts

I am trying to create a script that will open an application in a specific "space". So let's say I am on space 1 working in the terminal and then I want to be able to open safari in space 4. Is there a way to do this?
I have done some searching and found only ways to set the system profile options. Maybe I should tell you my end goal in case what I am attempting is not possible.
I use a laptop and plugin in to multiple stations, home, office, and travel. I want to create different window layouts for each one. So I will need an apple script telling it to open applications in varios spaces and different dimensions. I hope this makes sense. Ask me for clarification if it doesn't thanks!
PS the answer doesn't necessarily have to be any applescript I just thought that would be the easiest way :)
Here's a list of applescript commands for Spaces. There's a couple things there that might help you.
It is possible to do some scripting of application Space preferences by using the scripting interface to the System Events.app. See the answer to a similar question here.
The easiest way I've found is via GUI scripting. Make sure the Spaces menu is active on the upper right of your computer. That lists the spaces by number. You can then just write a GUI script to select the menu item of the space you wish. That will switch to that space. Then do an activate Applescript to open the application there.
Let me know if you need sample code demonstrating this. I have some in Python + Appsscript that does this but I should be easily able to convert it back to Applescript proper if you need it.

Update desktop "show window contents while dragging" setting programatically

One of my programs seems to be changing the Display Properties > Appearance > Effects > Show window contents while dragging setting to off every few hours.
I'm not sure exactly which program, or when it happens. I have a number of programs that seem like likely culprits - wallpaper rotators, software for multiple monitors, multiple virual desktops and switching, and a few others.
I am just thinking to create a little batch script to run periodically and set the setting back to on.
Does anyone know how to do this in windows? I'm using xp pro sp3.
Thanks!
The best option is to do this programmatically using the supported API. i haven't tested this, but it should do the trick:
SystemParametersInfo(SPI_SETDRAGFULLWINDOWS,
TRUE,
NULL,
SPIF_UPDATEINIFILE | SPIF_SENDCHANGE)
You can use SPI_GETDRAGFULLWINDOWS to see if the the bit has been flipped to avoid unnecessarily triggering a WM_SETTINGCHANGE.
You can use RegMon to find the program that keeps changing your settings. Maybe that's a better start than hacking around it.
There is a simple and effective solution to this problem. In Notepad type the following lines :
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control Panel\Desktop] "DragFullWindows"="1"
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\DragFullWindows] "CheckedValue"=dword:00000001 "UncheckedValue"=dword:00000001
Save the file as "Show Window Contents.reg" Double clicking this file and restarting will cure the problem permanently. Post a message if you find this useful.
Aravind Banerjee
It seems the registry setting which controls that preference is HKCU\Control Panel\Desktop\DragFullWindows. You can read more about it here. However, trying it on my own computer does not register the change right away, so a batch script won't do it. You'll probably have to write a program to manipulate it using SystemParametersInfo(). You can pass it the SPI_SETDRAGFULLWINDOWS parameter. Here's a page explaining it more. Here's a page showing how to call it, albeit not for the same parameter.
I suspect it's kept in the registry - maybe [HKEY_CURRENT_USER\Control Panel\Desktop] - "DragFullWindows"?
It would be easy to flip the registry setting back to "1" every hour or so with a batch file.

Change the taskbar settings programmatically?

I want to change the settings of my taskbar with a small batch file or java programm or whatever.
So I want to know, if there is a registry key containg this information.
Does anybody knows, where Windows sets taskbar settings?
Edit: No, I don't want to annoy the users with changing taskbar settings on every boot.
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\
and 64 bit eqivalent?
TaskBarCmd seems to do the job. It includes C++ source code. It uses the IBandSite COM Interface. Haven't tried the source, but the compiled version seems to work.

In WSH, how can I parse multiple-key presses like ALT-CTRL-DEL?

How can I use multiple keys in WSH Script like (ALT,CTRL,DELETE)?
How can i take a screenshot of an application and paste it in MSWord using WSH SCript?
Using SendKeys, you can't. I told you so.
Regarding sending multiple keys - please read the documentation on SendKeys() on MSDN. It's not hard to find out.
Maybe there is an ActiveX component somewhere that can take screen shots for you, but using vanilla Windows scripting, this cannot be done.
Yeah I think like Tomalak said, what you're trying to do will most likely involve invoking an ActiveX component using the CreateObject command.
I'd advise against it though, usually when you hit the point where your script is trying to invoke applications (Word) and take screenshots... it's time to invest in some development software (Visual Studio or something) and write an actual application.
If you're totally set on it though, DevGuru has a decent reference page for the CreateObject command.
https://social.technet.microsoft.com/wiki/contents/articles/5169.vbscript-sendkeys-method.aspx
It says that to do something like "Alt F5", to do "% {F5}"
To do Ctrl Alt Delete, you have to do "^ % {DEL}"

Resources