Search found 372 matches

by Odlanir
Today, 01:34
Forum: Ask For Help
Topic: Parsing xml file for a specific name inside a tag Topic is solved
Replies: 9
Views: 446

Re: Parsing xml file for a specific name inside a tag Topic is solved

Code: Select all

var := "HOD"
RegExMatch(XMLSource, "s)<Type>" var "<\/Type>.*?<Status>(.*?)<\/Status>", Status)
MsgBOx, % Status1
by Odlanir
Yesterday, 07:00
Forum: Ask For Help
Topic: read directory: number of files and name of the first file
Replies: 3
Views: 113

Re: read directory: number of files and name of the first file

Another way:

Code: Select all

arr := []
loop, files, c:\temp\*.*, FDR ; F = Include files - D = Include Folder - R = recurse subdir ( Default F )
    arr[a_index]  := A_LoopFileFullPath
MsgBox % "Total files : " arr.MaxIndex() "`nFirst file : " arr[1]
by Odlanir
20 Jul 2019, 10:11
Forum: Ask For Help
Topic: How to Select (Click) a Row in a ListBox or ComboBox? Topic is solved
Replies: 2
Views: 136

Re: How to Select (Click) a Row in a ListBox or ComboBox? Topic is solved

gui, add, ComboBox, gCombo vCmb, aaa||bbb|ccc|ddd|eee gui, Show return Combo: Gui, submit, NoHide MsgBox % Cmb return f1:: GuiControl, Choose, Cmb, 4 ; this will only select the 4th item ;~ GuiControl, Choose, Cmb, |4 ; this will also fire the g-label acting as a click on the control return GuiClos...
by Odlanir
20 Jul 2019, 03:54
Forum: Ask For Help
Topic: Really simple stuff - Diffrent outcomes of pressing one button second time
Replies: 2
Views: 169

Re: Really simple stuff - Diffrent outcomes of pressing one button second time

In a shorter form:

Code: Select all

cnt := 0, chars := StrSplit("ABCDE") ; if you change the chars the script will cycle for all the char listed
x::			 
   send, % chars[mod(cnt++,chars.MaxIndex())+1] 
Return
or

Code: Select all

send, % cnt++ >= chars.MaxIndex() ? chars[cnt:=1] : chars[cnt]
by Odlanir
19 Jul 2019, 05:55
Forum: Ask For Help
Topic: switching between sets of hotkeys
Replies: 1
Views: 113

Re: switching between sets of hotkeys

Code: Select all

#NoEnv
#Persistent
!F1::Flag := !Flag

#If (Flag) 
!e::Send, Ǝ
e::Send, ǝ
#If !(Flag) 
!e::Send,ǝ
e::Send, e
#If 
by Odlanir
19 Jul 2019, 00:57
Forum: Ask For Help
Topic: [Solved] ListView search / filter
Replies: 24
Views: 2676

Re: [Solved] ListView search / filter

@garry If you clear the search edit field ( after a search ) the ListView is a mess. I suggest you to use an object to store the value pairs. This enable also the path display when search is used. #NoEnv #SingleInstance force SetBatchLines, -1 LVArray := {} Gui, Add, Text, ,Search: Gui, Add, Edit, ...
by Odlanir
18 Jul 2019, 00:59
Forum: Ask For Help
Topic: Need help to write the good example of using "return" Topic is solved
Replies: 19
Views: 835

Re: Need help to write the good example of using "return" Topic is solved

@swagfag shouldn't it be like this?

Code: Select all

static Sizes := {big:500,small:50,tiny:10}
by Odlanir
12 Jul 2019, 08:32
Forum: Ask For Help
Topic: why is this countdown timer wrong? Topic is solved
Replies: 2
Views: 74

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: 105

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: 105

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: 113

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: 133

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: 157

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: 227

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: 133

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: 294

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: 294

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: 294

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: 294

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: 429

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...

Go to advanced search