Search found 365 matches

by Odlanir
12 Jul 2019, 08:32
Forum: Ask For Help
Topic: why is this countdown timer wrong? Topic is solved
Replies: 2
Views: 70

Re: why is this countdown timer wrong? Topic is solved

Try this: #Persistent #SingleInstance, Force #NoEnv eta := 10 eta *= 60 Gui, Font, S50 CDefault, Verdana Gui, Add, Text,vMyTime w200 Center, %oras% Gui,Show Return eggtimer: --eta oras := % floor(eta / 60) ":" substr( "0" . mod(round(eta), 60), -1) if (eta > 0) SetTimer,, -1000 GuiControl,,MyTime, %...
by Odlanir
11 Jul 2019, 08:35
Forum: Ask For Help
Topic: Noob question about Array search
Replies: 2
Views: 99

Re: Noob question about Array search

Code: Select all

SafeArray := xl.ActiveSheet.Range("A1:D" lstrw2).value
loop, % lstrw2 {
   if (Safearray[a_index,1] = needle)  ; 1 = column A, 2 = column B and so on ...   
      MsgBox % "Found at line " a_index
}   
by Odlanir
10 Jul 2019, 08:50
Forum: Ask For Help
Topic: Is there a way to get the list of items for a ComboBox? Topic is solved
Replies: 2
Views: 96

Re: Is there a way to get the list of items for a ComboBox? Topic is solved

Code: Select all

Gui, Add, ComboBox, vColorChoice HwndCB, Red|Green|Blue|Black|White
Gui, Show, h300 w400
gosub GetCombo
return

GetCombo:
   ControlGet, MyList, List, , , ahk_id %CB%
   MsgBox % RegExReplace(MyList, "`n", " ")
return
by Odlanir
10 Jul 2019, 08:28
Forum: Ask For Help
Topic: Need help comparing sets of Arrays or Tables Topic is solved
Replies: 5
Views: 103

Re: Need help comparing sets of Arrays or Tables Topic is solved

Try this Table1= ( Cheese,2 Rice,3 Orange,4 Banana,2 ) Table2= ( Rice,Tonys Rice Orange,Simons Vegetables ) ;~ or, if you want to popolate the arrays from file: ;~ FileRead, Table1, % "path for the table1 file" ;~ FileRead, Table2, % "path for the table2 file" tab1Array := Object(StrSplit(Table1, ["...
by Odlanir
10 Jul 2019, 01:06
Forum: Ask For Help
Topic: chage value of a variable with a hot key Topic is solved
Replies: 3
Views: 116

Re: chage value of a variable with a hot key Topic is solved

Code: Select all

multiplier := 1
c::
f1::
+!2::
+!3::
+!4::
if (A_ThisHotkey = "c") {
   random, Multiplier, 0.0, 1.0 ; random floating number between 0 an 1
} else {
   multiplier := substr(A_ThisHotkey,-0)
}
gosub DoTheWork
return

DoTheWork:
	MsgBox % 5*Multiplier "`n"  56*Multiplier
return
Esc::
  ExitApp
by Odlanir
08 Jul 2019, 12:02
Forum: Ask For Help
Topic: Can an item of the context menu be disabled? Topic is solved
Replies: 2
Views: 140

Re: Can an item of the context menu be disabled? Topic is solved

You can put this wherever you need it:

Code: Select all

    ; to Disable the menu Item ...
    Menu, ContextMenu, Disable, Paste 
    ; ... or to Enable the menu Item
    Menu, ContextMenu, Enable, Paste
by Odlanir
08 Jul 2019, 11:51
Forum: Ask For Help
Topic: Retrieve element from simple-vs.-associative array
Replies: 3
Views: 197

Re: Retrieve element from simple-vs.-associative array

This works for me even adding an extra space to the keys. Book := {"Title 111": "Les Trois Mousquetaires", "Author 222": "Alexandre Dumas", "Publication date 333": 1844} MsgBox,,, % Book["Title 111"] "`n" Book["Author 222"] "`n" Book["Publication date 333"] ;~ This prints all the Key-Value pairs for...
by Odlanir
08 Jul 2019, 07:26
Forum: Ask For Help
Topic: chage value of a variable with a hot key Topic is solved
Replies: 3
Views: 116

Re: chage value of a variable with a hot key Topic is solved

Code: Select all

multiplier := 1
f1::
+!2::
+!3::
+!4::
multiplier := substr(A_ThisHotkey,-0)
gosub DoTheWork
return

DoTheWork:
	MsgBox % 5*Multiplier "`n"  56*Multiplier
return
Esc::
  ExitApp
by Odlanir
06 Jul 2019, 02:37
Forum: Ask For Help
Topic: Logging Indentation
Replies: 11
Views: 259

Re: Logging Indentation

I would go this way. Leaving the z param and coding -1 wherever you want to reset the tab to 0. blue() ExitApp red(z := 0) { log(z,A_ThisFunc "()") log(1,"message1") log(2,"message2") green(-1) } blue(z := 0) { log(z,A_ThisFunc "()") log(1,"message1") red(1) } green(z := 0) { log(z, A_ThisFunc "()")...
by Odlanir
06 Jul 2019, 02:06
Forum: Ask For Help
Topic: Logging Indentation
Replies: 11
Views: 259

Re: Logging Indentation

By suppressing the z parameter in the function call you loose the chance to dinamically indent the first message of every function/hothey. That's why I suggest you to leave the z param in the first log() call of every function. So the z becams important only for tha name indentation, not for the sub...
by Odlanir
05 Jul 2019, 13:29
Forum: Ask For Help
Topic: Logging Indentation
Replies: 11
Views: 259

Re: Logging Indentation

I suggest you to use the var z only for the first log call inside every function. The static var in log() function will keep the last tab position. global z:=0 blue() ExitApp red(z := 0) { log(z,A_ThisFunc "()") log(1,"message1") log(2,"message2") green(1) } blue(z := 0) { log(z,A_ThisFunc "()") log...
by Odlanir
05 Jul 2019, 08:16
Forum: Ask For Help
Topic: Logging Indentation
Replies: 11
Views: 259

Re: Logging Indentation

global fname := "C:\Users\Hardings\Documents\AutoHotkey\HTPC\log.txt" red() blue() run , %fname% ExitApp red() { log(A_ThisFunc "()") log("message", 1) log("message", 2) } blue() { log(A_ThisFunc "()") red() } log(msg,NumTabs:=0) { FormatTime vTimeStamp,, HH:mm:ss`.%A_MSec% ddd`, dd MMM yyyy vTimeS...
by Odlanir
03 Jul 2019, 10:26
Forum: Ask For Help
Topic: Duplicate an array and change the value Topic is solved
Replies: 11
Views: 373

Re: Duplicate an array and change the value Topic is solved

@swagfag You're right! My bad ! I need to clone the arrays recursively. Object.clone() doesn't create a copy, keeps references: Not exactly true, this shows that the 2 arrays are two different objects. arr2 := Array() arr := [["11", "12"],["21", "22"]] for k, arrs in arr arr2[k] := arr[k].clone() ar...
by Odlanir
03 Jul 2019, 08:37
Forum: Ask For Help
Topic: How to close a stdoutstream
Replies: 7
Views: 441

Re: How to close a stdoutstream

I'm italian and my console codepage is 850 ( 850 – Latin-1 as reported here)
by Odlanir
03 Jul 2019, 08:28
Forum: Ask For Help
Topic: Duplicate an array and change the value Topic is solved
Replies: 11
Views: 373

Re: Duplicate an array and change the value Topic is solved

Code: Select all

arr := arr2 := Array()
arr := [["11", "12"],["21", "22"]]

arr2.clone(arr)
arr2[1,1] := "hello"

MsgBox % arr2[1, 1] ; returns 'hello'
MsgBox % arr[1, 1] ; returns '11'

ExitApp
by Odlanir
03 Jul 2019, 08:14
Forum: Ask For Help
Topic: Arrays, Small letters and Capital Letters
Replies: 4
Views: 191

Re: Arrays, Small letters and Capital Letters

I don't see where's the problem. If you digit a % char in the InputBox the script works as expected. BTW as suggested by Rohwedder you can compact your script : pw := "TIBAKSONCRMDEFGHJLPQUVWXYZtibaksoncrmdefghjlpquvwxyz" Alphabet := "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" TestData = ...
by Odlanir
03 Jul 2019, 05:56
Forum: Ask For Help
Topic: Arrays, Small letters and Capital Letters
Replies: 4
Views: 191

Re: Arrays, Small letters and Capital Letters

#SingleInstance, Force #NoEnv pw := StrSplit("TIBAKSONCRMDEFGHJLPQUVWXYZtibaksoncrmdefghjlpquvwxyz") Alphabet := StrSplit("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") TestData = Lucky is my NAME! >.<" Hello! &*/()[email protected]#$456`%789`~{}[]|":?><,. Loop, parse, TestData { q:= LookFor(Alphabet...
by Odlanir
01 Jul 2019, 08:15
Forum: Ask For Help
Topic: Is there a way to simply access data from the database? Topic is solved
Replies: 5
Views: 357

Re: Is there a way to simply access data from the database? Topic is solved

The StrSplit() function creates a linear array which can be converted in an Object ( in this case in an associative array ) calling the function Object(array*) . Note then this works only if the items in the linear array are an even number. Example: arr := ["key1","aa","key2","bb","key3","cc"] MsgBo...
by Odlanir
30 Jun 2019, 06:49
Forum: Ask For Help
Topic: Translate PowerShell to AHK - possible?
Replies: 36
Views: 1375

Re: Translate PowerShell to AHK - possible?

Replace the Loop Read with this: Loop, Read, % fname { if ( trim(A_LoopReadLine) = "" ) continue ++cnt if ( cnt > 10 ) break totRows := cnt FindValidDelimitersNotInQuote(A_LoopReadLine) } BTW what kind of program writes a CSV with so many blank lines ? Any program I know in absence of values writes ...
by Odlanir
30 Jun 2019, 04:52
Forum: Ask For Help
Topic: Passing variables between scripts Topic is solved
Replies: 16
Views: 639

Re: Passing variables between scripts Topic is solved

In the OnMessage docs : https://www.autohotkey.com/docs/commands/OnMessage.htm there's a good working example ( the last one ) on how to send/receive data between scripts:

Go to advanced search