Simpel formattime

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Simpel formattime

22 Jul 2018, 15:03

- To search for an exact string, use InStr, e.g. 'abc'.
- To search for something more advanced, use RegExMatch, e.g. at least one letter, at least one non-digit.

Code: Select all

q::
vText := "abc123"

if InStr(vText, "abc") ;contains 'abc' (case-insensitive search)
	MsgBox, % "y"
else
	MsgBox, % "n"

if RegExMatch(vText, "[A-Za-z]") ;contains a letter
	MsgBox, % "y"
else
	MsgBox, % "n"

if RegExMatch(vText, "\D") ;contains a non-digit
	MsgBox, % "y"
else
	MsgBox, % "n"
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
marsa
Posts: 25
Joined: 11 Jul 2018, 10:36

Re: Simpel formattime

22 Jul 2018, 15:33

jeeswg wrote:- To search for an exact string, use InStr, e.g. 'abc'.
- To search for something more advanced, use RegExMatch, e.g. at least one letter, at least one non-digit.

Code: Select all

q::
vText := "abc123"

if InStr(vText, "abc") ;contains 'abc' (case-insensitive search)
	MsgBox, % "y"
else
	MsgBox, % "n"

if RegExMatch(vText, "[A-Za-z]") ;contains a letter
	MsgBox, % "y"
else
	MsgBox, % "n"

if RegExMatch(vText, "\D") ;contains a non-digit
	MsgBox, % "y"
else
	MsgBox, % "n"
return
Thx for all the help, I will dabel but I might be back ;)
marsa
Posts: 25
Joined: 11 Jul 2018, 10:36

Re: Simpel formattime

24 Jul 2018, 00:20

Yo Jeeswg

You seem to have a handle on things, whats wrong with my code?


InputBox, kommun, Enter kommun,
LookFor := kommun


FilePath := A_Desktop "\Book1.xlsx" ; example path
oWorkbook := ComObjGet(FilePath) ; access Workbook object

; Get a Range object that represents the first cell in column N where the information is found.
; Then, using offset(Row, Col), get the text from the cell in column M directly left of the found cell.
FoundM := oWorkbook.Sheets(1).Range("N:N").Find(LookFor).Offset(0,1).Text

if (FoundM)
Send, ^c

Trying to checka a excel file and if VAR is found I want to copy the cell to the right of it.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Simpel formattime

24 Jul 2018, 17:34

You asked the same question in another thread, and I've responded there.
Excel copy pasting - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=52525
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 291 guests