Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Autohotkey for Pocket PCs / WinCE / Smartphones


  • Please log in to reply
466 replies to this topic
Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005
Added V11.
Ciao
Micha

Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005
My little testscript for functions
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <myemail@nowhere.com>
;
; Script Function:
;	Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;

;_FileAppend()
;_MsgBox()
;_FileCopy()
;_loop()
;_variables()
;_funcs()
;_gui()
;_FileSelectFile()
;_FileSetGetAttrib()
;_FileGetSetTime()
;_SetFormat()
;_FileCreateDir()
;_FormatTime()
;_DriveSpaceFree()
;_RegReadWrite()
;_FileCreateShortcut()
;_Strings()
_WindowFunctions()
exitapp

_WindowFunctions()
{
}

_Strings()
{
  szText = This is a very stupid text
  StringGetPos, OutputVar, szText, very
  MsgBox, Position of very = %OutputVar%
  res:= InStr(szText, stup)
  MsgBox, Instr:= %res%
  StringLeft, OutputVar, szText, 7
  MsgBox, StringLeft OutputVar szText 7=%OutputVar%
  StringLen, OutputVar, szText
  MsgBox, StringLen:=%OutputVar%
  StringLower, OutputVar, szText , T
  StringLower, OutputVar1, szText
  StringUpper, OutputVar2, szText , T
  StringUpper, OutputVar3, szText
  MsgBox, StringLower:%OutputVar% - %OutputVar1% StringUpper: %OutputVar2% - %OutputVar3%
  StringMid, OutputVar, szText, 9, 7
  MsgBox, StringMid:=%OutputVar%
  StringReplace, OutputVar, szText, stupid , genius
  MsgBox, StringReplace: %OutputVar%
  StringRight, OutputVar, szText, 11
  MsgBox, StringRight: %OutputVar%
  TestString = This is a test.    
  Colors = red,green,blue
  StringSplit, ColorArray, Colors, `,
  Loop, %ColorArray0%
  {
      this_color := ColorArray%a_index%
      MsgBox, Color number %a_index% is %this_color%.
  }
  StringTrimLeft, OutputVar, szText, 5
  StringTrimRight, OutputVar1, szText, 5
  MsgBox, StringTrimLeftRight: %OutputVar% - %OutputVar1%
    
}

_FileCreateShortcut()
{
  FileCreateShortcut, \temp\ahk2008.exe, \windows\desktop\ahk.lnk
}

_RegReadWrite()
{
  RegRead, OutputVar, HKCU, ControlPanel\Backlight, BatteryTimeout
  MsgBox,  %OutputVar%
  RegWrite, REG_SZ, HKCU, Software\AutohotkeyCE, Demovalue, ValueText 
  RegRead, OutputVar, HKCU, Software\AutohotkeyCE, Demovalue
  MsgBox,  %OutputVar%
  
}

_DriveSpaceFree()
{
  DriveSpaceFree, OutputVar, \
  MsgBox, %OutputVar% free
}

_FormatTime()
{
  FormatTime, TimeString
  MsgBox The current time and date (time first) is %TimeString%.
  
  FormatTime, TimeString, R
  MsgBox The current time and date (date first) is %TimeString%.
  
  FormatTime, TimeString,, Time
  MsgBox The current time is %TimeString%.
  
  FormatTime, TimeString, T12, Time
  MsgBox The current 24-hour time is %TimeString%.
  
  FormatTime, TimeString,, LongDate
  MsgBox The current date (long format) is %TimeString%.
  
  FormatTime, TimeString, 20050423220133, dddd MMMM d, yyyy hh:mm:ss tt
  MsgBox The specified date and time, when formatted, is %TimeString%.
  
  FormatTime, TimeString, 200504, 'Month Name': MMMM`n'Day Name': dddd
  MsgBox %TimeString%
  
  FormatTime, YearWeek, 20050101, YWeek
  MsgBox January 1st of 2005 is in the following ISO year and week number: %YearWeek%
}

_FileCreateDir()
{
  FileCreateDir, \temp\a
  FileCreateDir, \temp\b
  FileCreateDir, \temp\c
  MsgBox, Folders are there
  FileRemoveDir, \temp\a
  FileRemoveDir, \temp\b
  FileRemoveDir, \temp\c
}

_SetFormat()
{
  VariableContainingAnInteger = 54
  SetFormat, integer, hex
  VariableContainingAnInteger += 0
  SetFormat, integer, d
  MsgBox, %VariableContainingAnInteger%

  Var = 11.333333
  SetFormat, float, 6.2
  Var -= 1  ; Sets Var to be 10.33 with one leading space because the total width is 6.
  MsgBox, %Var%

  SetFormat, float, 0.2
  Var += 1  ; Sets Var to be 11.33 with no leading spaces.
  MsgBox, %Var%

  SetFormat, float, 06.0
  Var += 0  ; Sets Var to be 000011
  MsgBox, %Var%
  
  SetFormat, integer, hex
  Var += 0  ; Sets Var to be 0xb
  SetFormat, integer, d
  MsgBox, %Var%
}
_FileGetSetTime()
{
  FileGetTime, OutputVarM, \temp\AutoHotkey.ahk
  FileGetTime, OutputVarC, \temp\AutoHotkey.ahk
  FileGetTime, OutputVarA, \temp\AutoHotkey.ahk
  FileSetTime, 2007122109244523, \temp\AutoHotkey.ahk, M
  FileSetTime, 2007122109244523, \temp\AutoHotkey.ahk, C
  FileSetTime, 2007122109244523, \temp\AutoHotkey.ahk, A
  FileGetTime, OutputVarNM, \temp\AutoHotkey.ahk
  FileGetTime, OutputVarNC, \temp\AutoHotkey.ahk
  FileGetTime, OutputVarNA, \temp\AutoHotkey.ahk
  MsgBox, %OutputVarM% - %OutputVarC% - %OutputVarA% - %OutputVarNM% - %OutputVarNC% - %OutputVarNA%  
}

_FileSetGetAttrib()
{
  FileGetAttrib, OutputVarbefore, \temp\AutoHotkey.ahk
  FileSetAttrib, +RASH, \temp\AutoHotkey.ahk
  FileGetAttrib, OutputVarAfter, \temp\AutoHotkey.ahk
  MsgBox, %OutputVarbefore% - %OutputVarAfter%
}

_FileSelectFile()
{
  FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt; *.doc)
  if SelectedFile =
      MsgBox, The user didn't select anything.
  else
      MsgBox, The user selected the following:`n%SelectedFile%

}

_gui()
{
  gui, add, edit, w600  ; Add a fairly wide edit control at the top of the window.
  gui, add, text, section, First Name:  ; Save this control's position and start a new section.
  gui, add, text,, Last Name:
  gui, add, edit, ys  ; Start a new column within this section.
  gui, add, edit
  gui, show, , AHKGuiTitel
  
/*  IfWinExist, AHKGuiTitel
    MsgBox, AHKGuiTitel existiert
  else
    MsgBox, AHKGuiTitel existiert nicht
  loop, 3
  {
    ControlFocus, Edit1, AHKGuiTitel 
    Sleep, 500
    ControlFocus, Edit2, AHKGuiTitel 
    Sleep, 500
  }  
*/
  ControlFocus, Edit1, AHKGuiTitel
  ControlSetText, Edit1, Das ist der neue Text, AHKGuiTitel
  Sleep, 4000
  ControlSend, Edit2, KeysToSend, AHKGuiTitel

  MsgBox, fertig
  
}

_funcs()
{
  v1 := abs(-23)
  v2 := FileExist("\temp\autohotkey.ahk") 
  v3 := FileExist("\temp\autohotkey.xxx")
  v4 := InStr("abcdefghijk", "fg") 
  MsgBox, abs:=%v1% - Exist:%v2% - existx:%v3% - instr:%v4%
  v1 := SubStr("WholelonglongString", 2, 3)
  v2 := StrLen("longlongstring")
  v3 := asc("A")
  V4 := chr(65)
  MsgBox, substr:=%v1% - strlen:%v2% - asc:=%v3% - chr:=%v4%
  v1:= exp(4) 
  v2:= Ceil(4.5) 
  v3:= floor(4.5) 
  v4:= log(4) 
  MsgBox, exp:=%v1% - ceil:%v2% - floor:=%v3% - log:=%v4%
  v1:= ln(4) 
  v2:= mod(10,3) 
  v3:= round(4.5) 
  v4:= sqrt(4)
  v5:= sin(34) 
  MsgBox, ln:=%v1% - mod:%v2% - round:=%v3% - sqrt:=%v4% - sin:=%v5%
}

_variables()
{
  outVar := GetVarVal("a_ahkPath") . " " . GetVarVal("a_ahkversion") 
  MsgBox, %outVar%  
  outVar := GetVarVal("a_workingdir") . " " . GetVarVal("a_scriptdir") 
  MsgBox, %outVar%  
  outVar := GetVarVal("a_scriptname") . " " . GetVarVal("a_scriptfullpath") 
  MsgBox, %outVar%  
  outVar := GetVarVal("a_linenumber") . " " . GetVarVal("a_linefile") 
  MsgBox, %outVar%  
  outVar := GetVarVal("a_thisfunc") . " " . GetVarVal("a_thislabel") 
  MsgBox, %outVar%  
  outVar := GetVarVal("a_ahkversion") . " " . GetVarVal("a_ahkpath") 
  MsgBox, %outVar%  
  outVar := GetVarVal("a_YYYY") . " " . GetVarVal("A_MM") . " " . GetVarVal("A_DD") . " " . GetVarVal("a_MMMM") 
  MsgBox, %outVar%
  outVar := GetVarVal("a_MMM") . " " . GetVarVal("a_DDDD") . " " . GetVarVal("a_DDD") . " " . GetVarVal("a_Wday") 
  MsgBox, %outVar%  
  outVar := GetVarVal("a_yday") . " " . GetVarVal("a_yweek") 
  MsgBox, %outVar%  
  outVar := GetVarVal("a_hour") . " " . GetVarVal("a_min") 
  MsgBox, %outVar%  
  outVar := GetVarVal("a_sec") . " " . GetVarVal("a_msec") 
  MsgBox, %outVar%  
  outVar := GetVarVal("a_now") . " " . GetVarVal("a_nowutc") 
  MsgBox, %outVar%  
  outVar := GetVarVal("a_tickcount") . " " . GetVarVal("A_IsSuspended") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_BatchLines") . " " . GetVarVal("A_TitleMatchMode") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_TitleMatchModeSpeed") . " " . GetVarVal("A_DetectHiddenWindows") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_DetectHiddenText") . " " . GetVarVal("A_AutoTrim") 
  MsgBox, %outVar%  

  outVar := GetVarVal("A_StringCaseSense") . " " . GetVarVal("A_FormatInteger") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_FormatFloat") . " " . GetVarVal("A_KeyDelay") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_WinDelay") . " " . GetVarVal("A_ControlDelay") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_MouseDelay") . " " . GetVarVal("A_DefaultMouseSpeed") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_Temp") . " " . GetVarVal("A_OSType") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_OSVersion") . " " . GetVarVal("A_Language") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_ComputerName") . " " . GetVarVal("A_WinDir") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_UserName") 
  MsgBox, %outVar%
  
  outVar := GetVarVal("A_TimeIdle") . " " . GetVarVal("A_TimeIdlePhysical") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_ProgramFiles") . " " . GetVarVal("A_Desktop") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_StartMenu") . " " . GetVarVal("A_Programs") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_Startup") . " " . GetVarVal("A_MyDocuments") 
  MsgBox, %outVar%  
  outVar := GetVarVal("A_ScreenWidth") . " " . GetVarVal("A_ScreenHeight") 
  MsgBox, %outVar%  
}
GetVarVal(VarName)
{
  Val1 := %VarName%
  szRC = %VarName%:=%Val1% -  
  return szRC 
}

_loop()
{
  a:=5
  loop, 30
  {
      a := a + a_index
  }  
  MsgBox, a:= %a%
}
_FileCopy()
{
  FileCopy, \temp\FileAppend.txt, \temp\FileCopytest.txt, 1
}

_MsgBox()
{
    MsgBox, 4,, Would you like to continue? (press Yes or No)
  IfMsgBox Yes
      MsgBox You pressed Yes.
  else
      MsgBox You pressed No. 
}
_FileAppend()
{
  FileAppend, LangerLangerText!§$`%&/()=?*öäüÖÄÜß?, \temp\fileappend.txt
}


sergeich
  • Members
  • 20 posts
  • Last active: Oct 04 2009 09:41 AM
  • Joined: 11 Jan 2008
2Micha
IniRead and IniWrite are not supported for ever or you on this work? Thank you.

BoBo¨
  • Guests
  • Last active:
  • Joined: --

or you on this work

Das klingt jetzt schon fast Deutsch :wink:

Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005

2Micha
IniRead and IniWrite are not supported for ever or you on this work? Thank you.

Hi,
WinCE does not have an API for ini files. So I can't just adjust the code of ahk. These functions have to be written from scratch or copied from some other work.
Thus these functions are not available, maybe never. It depends on my mood to implement them :-)
But every coder is invited to do the work.
I just wanted to make ahk available for WinCE. I didn't expected that it lasts so long... I'm working on it for 4 weeks now.
Ciao
Micha

Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005
Uploaded V12.
New functions:
WinClose WinGetActiveStats WinGetActiveTitle WinGet(ID, IDLast, PID, ProcessName, Count, List, MinMax, ControlList, Style, ExStyle) WinGetClass WinGetPos WinGetText WinGetTitle WinHide WinKill WinSetTitle WinSet(bottom, top, disable, enable, redraw?) WinWait WinWaitActive
Ciao
Micha

sergeich
  • Members
  • 20 posts
  • Last active: Oct 04 2009 09:41 AM
  • Joined: 11 Jan 2008
2Micha
Thanks for answers. Waiting new versions!

AHKnow*
  • Guests
  • Last active:
  • Joined: --
Ah.... Got damn wow! :shock: And... You are awesome and great work. :D

sergeich
  • Members
  • 20 posts
  • Last active: Oct 04 2009 09:41 AM
  • Joined: 11 Jan 2008
2Micha
Hi, i'm to associate AHK-Files with AutohotkeyCE.exe, but working only autohotkey.ahk script. If name script not autohotkey.ahk, script ignore and running always autohotkey.ahk Please correct this problem. Thank you.

Boris Brodski
  • Guests
  • Last active:
  • Joined: --
Hi!

I'm trying to write a "normal" GUI application for PocketPC with AHK.
Could you please help me with following two main problems:

1. I can't create "normal" main window (like contacts): a maximized window with "x" right above. If PocketPC-screen was rotated, window should be resized (rotated too): newwidth=oldheight; newheight=oldwidth.

I can create such window with WinApi, if I left Style and StyleEx unchanged:

WNDCLASS wc;
  
  wc.style         = CS_HREDRAW | CS_VREDRAW;
  wc.lpfnWndProc   = (WNDPROC) WndProc;
  wc.cbClsExtra    = 0;
  wc.cbWndExtra    = 0;
  wc.hInstance     = hInstance;
  wc.hIcon         = 0;
  wc.hCursor       = 0;
  wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
  wc.lpszMenuName  = 0;
  wc.lpszClassName = szWindowClass;
  RegisterClass(&wc);

  g_hWndMain = CreateWindow(szWindowClass, szTitle, WS_VISIBLE,
          CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 
          CW_USEDEFAULT, NULL, NULL, hInstance, NULL);

2. If I show a AHK-dialog window and then I open an other program, then it is no way to show my dialog window again besides close this last opened program. Normally I would expect to see my dialog again, if start AHK-script one more time. My C-Program uses following code:

// Look for running instance of application
  if (FindWindow(szWindowClass, szTitle)){
    SetForegroundWindow(FindWindow(szWindowClass, szTitle));
    return FALSE;
  }

My problem is: AHK don't allows two instances running and can't simulate this behavior.


Thank you very much for your comments!!!
Boris Brodski

Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005

2Micha
Hi, i'm to associate AHK-Files with AutohotkeyCE.exe, but working only autohotkey.ahk script. If name script not autohotkey.ahk, script ignore and running always autohotkey.ahk Please correct this problem. Thank you.

Hi, I'm working on it.
argc and argv are NULL in WinCE. So I have to parse the command line by myself.
Ciao
Micha

Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005
Hi Boris Brodski,

You can have a look at the source of AHK. I do not see differences in the system calls. AFAIK: ahk windows are forms. The windows you are talking about could be SDI-windows. So it's possible that it will not work to show a maximized ahk-SDI-window. (But I really do not know it for sure)

I have absolut no clue about the special WinCE features. I'm just a WinXP programmer. So I don't know anything about rotating screens in WinCE. I just know there is such a feature, but I do not know how to handle this.
My aim is to make ahk working under WinCE (which lasts over a month now), but I do not want to implement new features which doesn't exist in real windows systems.

2.) I've started an ahkdialog, started contacts, closed contacts and the ahk-dialog is still there.
I do not know if there's a feature like <alt-tab> in windows.

Are all WinCE programs programmed like: If another instance of me does not exist, continue starting. If another instance does exist, bring it to the front and terminate myself?
If the behavior is like this, I don't know a solution at the moment.

I just can say: ahk is open source. Everybody who's a crack with WinCE programming is invited to help

Ciao
Micha

Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005

2Micha
Hi, i'm to associate AHK-Files with AutohotkeyCE.exe, but working only autohotkey.ahk script. If name script not autohotkey.ahk, script ignore and running always autohotkey.ahk Please correct this problem. Thank you.

Hi, I'm working on it.
argc and argv are NULL in WinCE. So I have to parse the command line by myself.
Ciao
Micha


Hi sergeich,
please download V13.
http://www.autohotke...ohotkeyCE13.exe
First create a script "autohotkey.ahk" and register the ahk-extension.
Now you should be able to click on any ahk-file to start the script.
It would be very kind of you to post a message if my changes are working for you.
Ciao
Micha

sergeich
  • Members
  • 20 posts
  • Last active: Oct 04 2009 09:41 AM
  • Joined: 11 Jan 2008
Hi, Micha! I'm download version 13 and now working any .ahk file!!!! Thank you! I'm testing with emulator and ASUS P535 device.

Micha
  • Members
  • 539 posts
  • Last active: Dec 31 2011 01:43 PM
  • Joined: 15 Nov 2005
Hi,
I've uploaded V13 with these new working commands

WinMove ControlGetPos WinWaitNotActive WinWaitClose FileCopyDir Process(Close, Wait), Control: Check Uncheck Enable Disable Show Hide ShowDropDown HideDropDown FileDelete FileMoveDir ControlClick ControlMove SoundPlay


After you have registered the ahk-extension (with the 2 lines scriptof the 1. post ) you can start any ahk-file.

Ciao
Micha