Search found 4605 matches

by jeeswg
Today, 17:07
Forum: Scripts and Functions
Topic: YouTube API functions
Replies: 1
Views: 95

Re: YouTube API functions

Library: JEEYouTubeAPI_Load() { } ;================================================== ;note: functions that do not use the YouTube API: ;JEE_YouTubeChannelGetRelated ;JEE_YouTubeChannelGetUsername [it does use the API to check the result] ;JEE_YouTubePlaylistGetViewCount ;note: for some functions yo...
by jeeswg
Today, 15:03
Forum: Ask For Help
Topic: Simpel formattime
Replies: 21
Views: 174

Re: Simpel formattime

- 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. q:: vText := "abc123" if InStr(vText, "abc") ;contains 'abc' (case-insensitive search) MsgBox, % "y" else M...
by jeeswg
Today, 14:22
Forum: Ask For Help
Topic: Create own class id for ahk gui?
Replies: 5
Views: 106

Re: Create own class id for ahk gui?

- Here's a script I wrote to change 'AutoHotkeyGUI' to something else, live, while the exe is open, rather than editing the exe file. test whether another script's hotkeys are still working (trigger hotkeys in another script) - AutoHotkey Community https://autohotkey.com/boards/viewtopic.php?f=5&...
by jeeswg
Today, 14:10
Forum: Ask For Help
Topic: Simpel formattime
Replies: 21
Views: 174

Re: Simpel formattime

It depends on what you mean by 'text'. No numbers? Contains at least 1 letter? Contains at least one space? Or some other condition like that. If you can come up with some criteria, it should be doable.
by jeeswg
Today, 12:08
Forum: Ask For Help
Topic: Simpel formattime
Replies: 21
Views: 174

Re: Simpel formattime

- Check the documentation for InStr, SubStr, StrReplace, and look on the forum for examples of if statements. E.g. if (var = "text") E.g. if (var1 = var2) q:: vText := "Mom:" if InStr(vText, "Mom:") vText := "Mom: 23132131561531" MsgBox, % vTex...
by jeeswg
Today, 10:35
Forum: Ask For Help
Topic: Simpel formattime
Replies: 21
Views: 174

Re: Simpel formattime

This is probably more like what you want: q:: ;dates - is date at least 18 years ago vDate1 := A_Now ;vDate2 := "20060504-9999" Clipboard := "" SendInput, ^c ClipWait, 3 if ErrorLevel { MsgBox, % "error: failed to retrieve clipboard text" return } vDate2 := Clipboard if...
by jeeswg
Today, 10:10
Forum: Ask For Help
Topic: Simpel formattime
Replies: 21
Views: 174

Re: Simpel formattime

If the hyphen and last 4 digits are unnecessary, you can crop them like this:

Code: [Select all]GeSHi © Codebox Plus

q:: ;convert dates - 'yyyyMMdd-XXXX' to 'yyyyMMdd'
vDate := "20060504-9999"
vDate := SubStr(vDate, 1, -5)
MsgBox, % vDate
return
by jeeswg
Today, 09:50
Forum: Ask For Help
Topic: Simpel formattime
Replies: 21
Views: 174

Re: Simpel formattime

- I would do it like this, using a backport of the DateDiff function from AHK v2. - Note: the dates must be in the appropriate format: 'all or the leading part of a timestamp in the YYYYMMDDHH24MISS format'. q:: ;dates - are dates at least 18 years apart vDate1 := 20180722120000 ;midday 2018-07-22 v...
by jeeswg
Today, 07:28
Forum: Ask For Help
Topic: Simpel formattime
Replies: 21
Views: 174

Re: Simpel formattime

- That sounds like a simple string manipulation, one of my examples above achieved that, here it is again. You replace hyphens with spaces, and crop the first 2 characters via SubStr. q:: ;convert dates - 'yyyyMMdd-XXXX' to 'yyMMdd XXXX' vDate := "20060504-9999" vDate := SubStr(StrReplace(...
by jeeswg
Today, 06:07
Forum: Ask For Help
Topic: Simpel formattime
Replies: 21
Views: 174

Re: Simpel formattime

- What is XXXX? Is it HHmm? That information is crucial. - FormatTime can only handle blank (for the time now) or a number of the form yyyyMMddHHmmss, or a partial string e.g. of the form yyyyMMdd or yyyyMMddHHmm. - So, some possible input values: 20060504030201, 200605040302, 2006050403, 20060504, ...
by jeeswg
20 Jul 2018, 17:24
Forum: Offtopic
Topic: Return from function - True or 1?
Replies: 20
Views: 232

Re: Return from function - True or 1?

- Yes, it's all debatable. Thanks for the link. - This is pretty good: SplitPath, InputVar [, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive] - I actually think of *filename* as full path, and *file name* as 'name' i.e. full path minus dir. - Here are my notes on Excel macros: vPath := oX...
by jeeswg
20 Jul 2018, 15:50
Forum: Offtopic
Topic: Return from function - True or 1?
Replies: 20
Views: 232

Re: Return from function - True or 1?

I might do something like:
return True ;1
but since it literally returns 1, I might just do:
return 1
by jeeswg
20 Jul 2018, 14:33
Forum: Scripts and Functions
Topic: YouTube API functions
Replies: 1
Views: 95

YouTube API functions

- I had mentioned here about YouTube API functions: log in to Gmail/YouTube programmatically (+ YouTube API) - AutoHotkey Community https://autohotkey.com/boards/viewtopic.php?f=5&t=32410 - Someone reminded me about it, asking specifically about getting the duration from a YouTube video, and so ...
by jeeswg
20 Jul 2018, 14:22
Forum: Offtopic
Topic: Return from function - True or 1?
Replies: 20
Views: 232

Re: Return from function - True or 1?

- @Flipeador: I do tend to consider that often people looking at code will be experienced programmers, who do not happen to be familiar with AutoHotkey, but who would like to translate the code to their favoured programming language.
- @gregster: Thanks for pointing that out, I meant to mention that.
by jeeswg
20 Jul 2018, 14:06
Forum: Offtopic
Topic: Return from function - True or 1?
Replies: 20
Views: 232

Re: Return from function - True or 1?

- @Flipeador: Func1() { return True ;ambiguous (unless you already knew that in AutoHotkey, True = 1) } Func2() { return 1 ;unambiguous } - @john_c: Btw I would call the variable 'Dir', not 'DirName'. I think that 'dir name' is ambiguous, e.g. for 'C:\Program Files\AutoHotkey', I would say that 'Aut...
by jeeswg
20 Jul 2018, 13:01
Forum: Offtopic
Topic: Return from function - True or 1?
Replies: 20
Views: 232

Re: Return from function - True or 1?

I would use 1 to be clear, because sometimes True is defined as -1 e.g. Excel macros.
by jeeswg
20 Jul 2018, 06:28
Forum: Wish List
Topic: one line IF command
Replies: 4
Views: 99

Re: one line IF command

- @swagfag: Yes, depending on the situation, I try to find the most readable workaround, and sometimes I go longhand and write everything in full. - Here are some implementation ideas: ;worst (current situation): if a { b(), c(), d() return } else if e { f(), g(), h() return } else if i { j(), k(), ...
by jeeswg
20 Jul 2018, 00:46
Forum: Ask For Help
Topic: Cant exit script, now im screwed
Replies: 5
Views: 54

Re: Cant exit script, now im screwed

- Can you close it via the systray icon or Task Manager?
- Issues relating to reopening existing scripts can include: the #SingleInstance mode, and, the original script being run in admin mode, but the new script not being run in admin mode (see A_IsAdmin).
by jeeswg
20 Jul 2018, 00:38
Forum: Wish List
Topic: one line IF command
Replies: 4
Views: 99

Re: one line IF command

- @guest3456: -1 to the syntax or -1 to the principle? - smarq8: I think the idea is great, the main issues are: what syntax to use (what operator e.g. a symbol or 'then') and whether it's possible to handle break/continue/return (e.g. as functions, or whether AHK could run a text macro internally)....
by jeeswg
19 Jul 2018, 14:22
Forum: Ask For Help
Topic: how to send paste command Topic is solved
Replies: 7
Views: 868

Re: how to send paste command Topic is solved

Here's what I'm currently using to copy and paste on the command prompt: #IfWinActive, ahk_class ConsoleWindowClass ^v:: ;command prompt - send the clipboard if InStr(vText, "`r") vText := SubStr(vText, 1, InStr(vText, "`r")-1) if InStr(vText, "`n") vText := SubStr(vTex...

Go to advanced search