safetycar wrote: ↑06 Sep 2021, 01:05
Good work to those involved in this.
@AHK_user I've seen your extension on the project, and I've noticed some changes that you could consider.
I did some changes but I'm not familiar enough to know if it's the best way.
In ConvertFuncs.ahk...
Line 071 changed to:
BlockInput,OptionT2E | BlockInput({1}) (it was not converting to string)
Line 269 changed to:
OnClipboardChange(FuncQ2T,AddRemove) | OnClipboardChange({1},{2})
Thanks for the compliments
, I am working hard to improve it.
And thanks to pointing out the changes, I went over it quite fast to get a rough working script, and now I am testing it more in detail so it is normal that some coding errors are made. Currently working on GuiControl
BlockInput is changed
OnClipboardChange is also done, I also added a labelToFunction convertion in it.
It is becoming to be usable, and most of the v1 examples begin to work. But at the moment I still find convertion errors.
I think this will be a great help for people who want to convert their scripts.
Possible problems:
- The use of terniary operators in commands, but even that could maybe handled if somebody uses it a lot.
- Objects are quite hard to tell if they should be an object, map or array
Code: Select all
#Persistent
return
OnClipboardChange:
ToolTip Clipboard data type: %A_EventInfo%
Sleep 1000
ToolTip ; Turn off the tip.
return
=>
Code: Select all
OnClipboardChange(ClipChanged)
Persistent
return
ClipChanged(Type)
{ ; V1toV2: Added bracket
ToolTip("A_Clipboard data type: " Type)
Sleep(1000)
ToolTip() ; Turn off the tip.
return
} ; V1toV2: Added bracket in the end
Currently I am improving the Gui conversion, very tricky, but this beautiful example already works.
Code: Select all
Gui, Add, Text,vTextC, First name:
Gui, Add, Edit, vFirstName hwndtest ; The ym option starts a new column of controls.
Gui, Add, Picture, vMyPic w20 h-1, C:\Users\Dimitri\Pictures\Save24.png
Gui, Add, CheckBox, vMyCheckBox, Option1
Gui, Add, Radio, vMyRadio, Radio
Gui, Add, Radio, , Radio2
Gui, Add, DropDownList, vMyDropDownList, Black|White|Red|Green|Blue
Gui, Add, ListBox, r5 vmyListBox, Red|Green|Blue|Black|White
Gui, Add, ComboBox, vMyComboBox, Red|Green|Blue|Black|White
Gui, Add, Link, vMyLink, This is a <a href="https://www.autohotkey.com">link</a>
Gui, Add, Hotkey, vMyHotkey
Gui, Add, DateTime, vMyDateTime,
Gui, Add, Button, vMyButton default, OK ; The label ButtonOK (if it exists) will be run when the button is pressed.
Gui, Show,, Simple Input Example
return ; End of auto-execute section. The script is idle until the user does something.
ButtonOK:
Gui, Submit, nohide ; Save the input from the user to each control's associated variable.
GuiControl, , TextC, test
GuiControl, , % test, test
GuiControl, , MyPic, C:\Users\Dimitri\Pictures\test.png
GuiControl, , MyCheckBox, 1
GuiControl, , MyRadio, 1
GuiControl,, MyDropDownList,test
GuiControl,,myListBox,test1|test2
GuiControl,,MyComboBox,|test1|test2
GuiControl,,MyLink, test
GuiControl,,MyHotkey, ^!c
GuiControl,,MyDataTime, 01/01/2000
GuiControl, , MyButton, test
return
GuiClose:
ExitApp
=>
Code: Select all
myGui := Gui()
myGui.OnEvent("Close", GuiClose)
ogcTextC := myGui.Add("Text", "vTextC", "First name:")
ogcEditFirstName := myGui.Add("Edit", "vFirstName")
test := ogcEditFirstName.hwnd ; The ym option starts a new column of controls.
ogcPictureMyPic := myGui.Add("Picture", "vMyPic w20 h-1", "C:\Users\Dimitri\Pictures\Save24.png")
ogcMyCheckBox := myGui.Add("CheckBox", "vMyCheckBox", "Option1")
ogcMyRadio := myGui.Add("Radio", "vMyRadio", "Radio")
myGui.Add("Radio", , "Radio2")
ogcMyDropDownList := myGui.Add("DropDownList", "vMyDropDownList", ["Black", "White", "Red", "Green", "Blue"])
ogcmyListBox := myGui.Add("ListBox", "r5 vmyListBox", ["Red", "Green", "Blue", "Black", "White"])
ogcMyComboBox := myGui.Add("ComboBox", "vMyComboBox", ["Red", "Green", "Blue", "Black", "White"])
ogcMyLink := myGui.Add("Link", "vMyLink", "This is a <a href=`"https://www.autohotkey.com`">link</a>")
ogcMyHotkey := myGui.Add("Hotkey", "vMyHotkey")
ogcMyDateTime := myGui.Add("DateTime", "vMyDateTime")
ogcMyButton := myGui.Add("Button", "vMyButton default", "OK")
ogcMyButton.OnEvent("Click", ButtonOK) ; The label ButtonOK (if it exists) will be run when the button is pressed.
myGui.Title := "Simple Input Example"
myGui.Show()
return ; End of auto-execute section. The script is idle until the user does something.
ButtonOK(*)
{ ; V1toV2: Added bracket
oSaved := myGui.Submit("0")
FirstName := oSaved.FirstName
MyCheckBox := oSaved.MyCheckBox
MyRadio := oSaved.MyRadio
MyDropDownList := oSaved.MyDropDownList
myListBox := oSaved.myListBox
MyComboBox := oSaved.MyComboBox
MyHotkey := oSaved.MyHotkey
MyDateTime := oSaved.MyDateTime ; Save the input from the user to each control's associated variable.
ogcTextC.Value := "test"
ogcEditFirstName.Value := "test"
ogcPictureMyPic.Value := "C:\Users\Dimitri\Pictures\test.png"
ogcMyCheckBox.Value := 1
ogcMyRadio.Value := 1
ogcMyDropDownList.Add(["test"])
ogcmyListBox.Add(["test1", "test2"])
ogcMyComboBox.Delete() ;Clean the list
ogcMyComboBox.Add(["test1", "test2"])
ogcMyLink.Text := "test"
ogcMyHotkey.Value := "^!c"
ogcMyDataTime.Value := "01/01/2000"
ogcMyButton.Text := "test"
return
} ; V1toV2: Added bracket before function
GuiClose(*)
{ ; V1toV2: Added bracket
ExitApp
} ; Added bracket in the end