Leaderboard
Popular Content
Showing content with the highest reputation on 01/09/2018 in all areas
-
I saw this code here: http://zoomquilt.org/ and here: http://arkadia.xyz and thought how this can be implemented in AutoIt. Here the results. The Zoomquilt: ;coded by UEZ build 2018-01-10, idea and images taken from http://zoomquilt.org/ ;thanks to spudw2k for the MouseZoom function #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit, $iW, $iH Global Const $sTitle = "GDI Image Zoom v2.1.2 coded by UEZ" AutoItSetOption("GUIOnEventMode", 1) Downloader() GDIPlus_ZoomImage() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_ZoomImage($bMultimonitor = False) $bExit = False Local $i, $aImages[46], $hImage, $hObj ConsoleWrite("Loading images from local disk..." & @CRLF) Local $fTimer = TimerInit() For $i = 0 To UBound($aImages) - 1 $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Images\TheZoomquilt" & StringFormat("%02i.jpg", $i)) $aImages[$i] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) Next ConsoleWrite(UBound($aImages) & " images loaded in " & TimerDiff($fTimer) & " ms" & @CRLF) Local $tDim = DllStructCreate($tagBITMAP) DllCall("GDI32.dll", 'int', 'GetObject', 'int', $aImages[0], 'int', DllStructGetSize($tDim), 'ptr', DllStructGetPtr($tDim)) $iW = $tDim.bmWidth $iH = $tDim.bmHeight Local $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]"), $aFullScreen[4], $iW_Dt, $iH_Dt $aFullScreen = WinGetPos($hFullScreen) If $bMultimonitor Then $iW_Dt = $aFullScreen[2] $iH_Dt = $aFullScreen[3] Else $iW_Dt = @DesktopWidth $iH_Dt = @DesktopHeight $aFullScreen[0] = "" $aFullScreen[1] = "" EndIf $hGUI = GUICreate($sTitle, $iW_Dt, $iH_Dt, $aFullScreen[0], $aFullScreen[1], $WS_POPUP, $WS_EX_TOPMOST) GUISetState(@SW_SHOW, $hGUI) GUISetCursor(16, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW_Dt, $iH_Dt) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC) _WinAPI_SetStretchBltMode($hDC_backbuffer, $STRETCH_DELETESCANS) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFF000000), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xFFFFFFFF), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 130, 16) $iFPS = 0 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") AdlibRegister("CalcFPS", 1000) Local $a[3], $b = 1, $c, $x, $e, $y, $w, $h, $w2 = $iW_Dt / 2, $h2 = $iH_Dt / 2, $q, $r If $iW_Dt > 1.5 * $iH_Dt Then $q = $iW_Dt $r = 0.75 * $iW_Dt Else $q = 1.5 * $iH_Dt $r = 0.75 * $iH_Dt EndIf Do For $e = 0 To 2 $a[$e] = $aImages[Mod(Floor($b) + $e, UBound($aImages))] Next $c = 2^(Mod($b, 1)) For $e = 0 To 2 $x = $w2 - $q / 2 * $c $y = $h2 - $r / 2 * $c $w = $q * $c $h = $r * $c $hObj = _WinAPI_SelectObject($hMemDC, $a[$e]) _WinAPI_StretchBlt($hDC_backbuffer, $x, $y, $w, $h, $hMemDC, 0, 0, $iW, $iH, $SRCCOPY) $c *= 0.5 Next $b += MouseZoom() IF $b < 0 Then $b = UBound($aImages) - $b _GDIPlus_GraphicsDrawStringEx($hCanvas, "FPS: " & $iShowFPS & " @ " & $iW_Dt & "x" & $iH_Dt & " px", $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) _WinAPI_BitBlt($hDC, 0, 0, $iW_Dt, $iH_Dt, $hDC_backbuffer, 0, 0, $SRCCOPY) $iFPS += 1 If $bExit Then ExitLoop Until Not Sleep(0) AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hMemDC, $hObj) _WinAPI_DeleteDC($hMemDC) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) For $i = 0 To UBound($aImages) - 1 _WinAPI_DeleteObject($aImages[$i]) Next GUIDelete($hGUI) EndFunc ;==>GDIPlus_ZoomImage Func MouseZoom() ;https://www.arduino.cc/reference/en/language/functions/math/map/ Local $iInput = MouseGetPos(1), $iInMin = 0, $iInMax = @DesktopHeight, $iOutMin = 1, $iOutMax = -1, $iStep = 0.025 Return (($iInput - $iInMin) * ($iOutMax - $iOutMin) / ($iInMax - $iInMin) + $iOutMin) * $iStep EndFunc ;MouseZoom() Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 EndFunc ;==>CalcFPS Func Downloader() Local $i, $A = StringSplit("FUjD9hf gbHhxTR 8YyzJdR xP3aNkR 2Qi4fQr E6pW5Ky zmtWIBF Af7LtYp TuXy30d 3nKGLr2 hNoWscB mSBvv3K f4wJ70e mIt9XmM M4TkAyh P4L4qhd hNM6bTv VoT8JXM jqcGH0B DYVoN8n bOPQkOI NeaTfJ1 18ppMNr FZ3d8Jv HsoX2RP mjv4kzI 6rpJbef pySKauq WjNQYRV Ffooo8y Xei5XfD T5A415r LiV0VNB nGcwiO4 b1Gdjjy GE828iy eSQ7SLe 1mPyGgL GNtwJIr KxBlU7E aKXhms5 9Quu2wu Y07quDf r0yC5Qa 273fCkD 2wMyCUw FUjD9hf", " ", 2) Local $sURL For $i = 0 To UBound($A) - 1 If Not FileExists(@ScriptDir & "\Images\TheZoomquilt" & StringFormat("%02i.jpg", $i)) Then If Not FileExists(@ScriptDir & "\Images") Then DirCreate(@ScriptDir & "\Images") $sURL = "http://imgur.com/" & $A[Mod(20 + $i, 46)] & ".jpg" ConsoleWrite("Downloading " & $sURL & ": " & InetGet($sURL, @ScriptDir & "\Images\TheZoomquilt" & StringFormat("%02i.jpg", $i), 8) & " bytes" & @CRLF) ToolTip("Downloading images...Please wait! -> " & $i + 1 & " / " & UBound($A), MouseGetPos(0), MouseGetPos(1)) EndIf Next ToolTip("") EndFunc ;==>Downloader Arkadia: ;coded by UEZ build 2018-01-10, idea and images taken from http://arkadia.xyz ;thanks to spudw2k for the MouseZoom function #pragma compile(Icon, "c:\Program Files (x86)\AutoIt3\Icons\au3.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit, $iW, $iH Global Const $sTitle = "GDI Image Zoom v2.2.1 coded by UEZ" AutoItSetOption("GUIOnEventMode", 1) Downloader() GDIPlus_ZoomImage() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_ZoomImage($bMultimonitor = False) $bExit = False Local $i, $aImages[49], $hImage, $hObj ConsoleWrite("Loading images from local disk..." & @CRLF) Local $fTimer = TimerInit() For $i = 0 To UBound($aImages) - 1 $hImage = _GDIPlus_ImageLoadFromFile(@ScriptDir & "\Images\Arkadia" & $i & ".jpg") $aImages[$i] = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) Next ConsoleWrite(UBound($aImages) & " images loaded in " & TimerDiff($fTimer) & " ms" & @CRLF) Local $tDim = DllStructCreate($tagBITMAP) DllCall("GDI32.dll", "int", "GetObject", "int", $aImages[0], "int", DllStructGetSize($tDim), "ptr", DllStructGetPtr($tDim)) $iW = $tDim.bmWidth $iH = $tDim.bmHeight Local $hFullScreen = WinGetHandle("[TITLE:Program Manager;CLASS:Progman]"), $aFullScreen[4], $iW_Dt, $iH_Dt $aFullScreen = WinGetPos($hFullScreen) If $bMultimonitor Then $iW_Dt = $aFullScreen[2] $iH_Dt = $aFullScreen[3] Else $iW_Dt = @DesktopWidth $iH_Dt = @DesktopHeight $aFullScreen[0] = "" $aFullScreen[1] = "" EndIf $hGUI = GUICreate($sTitle, $iW_Dt, $iH_Dt, $aFullScreen[0], $aFullScreen[1], $WS_POPUP, $WS_EX_TOPMOST) GUISetState(@SW_SHOW, $hGUI) GUISetCursor(16, 1) ;create canvas elements Local Const $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW_Dt, $iH_Dt) Local Const $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) Local Const $hMemDC = _WinAPI_CreateCompatibleDC($hDC) _WinAPI_SetStretchBltMode($hDC_backbuffer, $STRETCH_DELETESCANS) Local Const $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) Local Const $hBrush_Clr = _GDIPlus_BrushCreateSolid(0xFF000000), _ $hBrush_FPS = _GDIPlus_BrushCreateSolid(0xFFFFFFFF), _ $hFormat_FPS = _GDIPlus_StringFormatCreate(), _ $hFamily_FPS = _GDIPlus_FontFamilyCreate("Arial"), _ $hFont_FPS = _GDIPlus_FontCreate($hFamily_FPS, 8), _ $tLayout_FPS = _GDIPlus_RectFCreate(0, 0, 130, 16) $iFPS = 0 GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") AdlibRegister("CalcFPS", 1000) Local $a[3], $b = 1, $c, $x, $e, $y, $w, $h, $w2 = $iW_Dt / 2, $h2 = $iH_Dt / 2, $q, $r If $iW_Dt > 1.5 * $iH_Dt Then $q = $iW_Dt $r = 0.75 * $iW_Dt Else $q = 1.5 * $iH_Dt $r = 0.75 * $iH_Dt EndIf Do For $e = 0 To 2 $a[$e] = $aImages[Mod(Floor($b) + $e, UBound($aImages))] Next $c = 2^(Mod($b, 1)) For $e = 0 To 2 $x = $w2 - $q / 2 * $c $y = $h2 - $r / 2 * $c $w = $q * $c $h = $r * $c $hObj = _WinAPI_SelectObject($hMemDC, $a[$e]) _WinAPI_StretchBlt($hDC_backbuffer, $x, $y, $w, $h, $hMemDC, 0, 0, $iW, $iH, $SRCCOPY) $c *= 0.5 Next $b += MouseZoom() IF $b < 0 Then $b = UBound($aImages) - $b _GDIPlus_GraphicsDrawStringEx($hCanvas, "FPS: " & $iShowFPS & " @ " & $iW_Dt & "x" & $iH_Dt & " px", $hFont_FPS, $tLayout_FPS, $hFormat_FPS, $hBrush_FPS) _WinAPI_BitBlt($hDC, 0, 0, $iW_Dt, $iH_Dt, $hDC_backbuffer, 0, 0, $SRCCOPY) $iFPS += 1 If $bExit Then ExitLoop Until Not Sleep(0) AdlibUnRegister("CalcFPS") ;release resources _GDIPlus_FontDispose($hFont_FPS) _GDIPlus_FontFamilyDispose($hFamily_FPS) _GDIPlus_StringFormatDispose($hFormat_FPS) _GDIPlus_BrushDispose($hBrush_Clr) _GDIPlus_BrushDispose($hBrush_FPS) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hMemDC, $hObj) _WinAPI_DeleteDC($hMemDC) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) For $i = 0 To UBound($aImages) - 1 _WinAPI_DeleteObject($aImages[$i]) Next GUIDelete($hGUI) EndFunc ;==>GDIPlus_ZoomImage Func MouseZoom() ;https://www.arduino.cc/reference/en/language/functions/math/map/ Local $iInput = MouseGetPos(1), $iInMin = 0, $iInMax = @DesktopHeight, $iOutMin = 1, $iOutMax = -1, $iStep = 0.025 Return (($iInput - $iInMin) * ($iOutMax - $iOutMin) / ($iInMax - $iInMin) + $iOutMin) * $iStep EndFunc ;MouseZoom() Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func CalcFPS() ;display FPS $iShowFPS = $iFPS $iFPS = 0 EndFunc ;==>CalcFPS Func Downloader() Local $sURL, $i For $i = 0 To 48 If Not FileExists(@ScriptDir & "\Images\Arkadia" & $i & ".jpg") Then If Not FileExists(@ScriptDir & "\Images") Then DirCreate(@ScriptDir & "\Images") $sURL = "http://arkadia.xyz/images/arkadia" & $i & ".jpg" ConsoleWrite("Downloading " & $sURL & ": " & InetGet($sURL, @ScriptDir & "\Images\Arkadia" & $i & ".jpg", 8) & " bytes" & @CRLF) ToolTip("Downloading images...Please wait! -> " & $i + 1 & " / " & $i, MouseGetPos(0), MouseGetPos(1)) EndIf Next ToolTip("") EndFunc ;==>Downloader The missing images will be download and saved to script dir in folder images. Due to internal integer format of the GDI functions the screen is little bit wobbling. Happy watching.5 points
-
Thanks @argumentum and @spudw2k for your contribution. As I'm still at holidays (will start tomorrow to work again after 4 weeks ) I was really lazy to implement these kind of additions. Code updated -> see post #1.2 points
-
Best practice for replacing string between specific characters
Earthshine reacted to czardas for a topic
Another function you might find useful is _StringBetween().1 point -
Best practice for replacing string between specific characters
Earthshine reacted to azkirak for a topic
Thank you, sir! I will give this a look1 point -
Exe To Au3 ?
VertigoRay reacted to JLogan3o13 for a topic
@VertigoRay as was stated, we do not support discussions on decompiling scripts; we have a zero tolerance policy on this subject.1 point -
Exit if statement
Earthshine reacted to LarsJ for a topic
If you need a While loop as in the first post, you go this way: While 1 While 1 If $x = 0 Then Do Stuff Else Do Stuff -- >I want to leave if statement if something doesn't work here to avoid Doing more stuff Doing more Stuff EndIf ExitLoop WEnd ; Do Stuff WEnd1 point -
Help with _IEHeadInsertEventScript..
XaelloNegative reacted to Danp2 for a topic
You can use _IEFormElementCheckBoxSelect to determine the checked state of a checkbox element.1 point -
Help with _IEHeadInsertEventScript..
XaelloNegative reacted to Danp2 for a topic
If you want further help, post the Scite output showing any errors that occurred. ;-)1 point -
Exit if statement
Earthshine reacted to LarsJ for a topic
You do it this way. Use ExitLoop to quit your If statement at any point: While 1 If $x = 0 Then Do Stuff Else Do Stuff -- >I want to leave if statement if something doesn't work here to avoid Doing more stuff Doing more Stuff EndIf ExitLoop WEnd1 point -
Stop fatal errors from crashing script run
Earthshine reacted to water for a topic
I get a litle bit confused by this thread and I fear the goal gets out of sight To sum it up: An Autoit script can only handle exceptions in the scope of the script. COM related exceptions can be handled AFTER they happened by a COM error handler. No need to check objecs in advance. Fatal errors crashing a script can NOT be handled by AutoIt A reproducer script (as small as possible) would greatly help.1 point -
Exit if statement
Earthshine reacted to ViciousXUSMC for a topic
If you only have 2 result conditions you do not need the 2nd IF just an Else. Because if its not true then by elimination it must be false. If $condition = True Then ;Do something Else ;Do something else EndIf When you have multiple conditions, that is often times when the Case/Switch syntax can be used.1 point -
Infinite Image Zoom Flight build 2018-01-10
spudw2k reacted to argumentum for a topic
Loading images from local disk... 49 images loaded in 582.10969654049 ms "G:\au3forum\191831-infinite-image-zoom-flight\Arkadia.au3" (117) : ==> Variable subscript badly formatted.: $a[$e] = $aImages[Mod(Floor($b) + $e, UBound($aImages))] $a[$e] = $aImages[^ ERROR going backwards gave me this error. Nice share1 point -
The function allows to copy/past from a source to a target. Source can be: An Excel range or the clipboard Target can be: An Excel range or the clipboard So _Excel_RangeCopyPaste($oWorkbook.ActiveSheet, "G4") copies cell "G4" to the clipboard. The next command should then copy the clipboard to the browser. To copy the clipboard data to the browser I suggest _ClipGet and _IEFormElementSetValue1 point
-
Very cool. I made a little function to control the zoom direction and speed based on the Mouse Y coordinate. $b += MouseZoom() Func MouseZoom() ;https://www.arduino.cc/reference/en/language/functions/math/map/ Local $iInput = MouseGetPos(1), $iInMin = 0, $iInMax = @DesktopHeight, $iOutMin = 1, $iOutMax = -1, $iStep = 0.025 Return (($iInput - $iInMin) * ($iOutMax - $iOutMin) / ($iInMax - $iInMin) + $iOutMin) * $iStep EndFunc1 point
-
Copy specific folder with prompt for a new folder name
Earthshine reacted to spudw2k for a topic
As @Earthshine inferred, your help file is your friend. Here are a couple of relevant functions to get you started (*you can click the function names I list to view the online help article for the function, but they are included with the helpfile installed with AutoIt.) InputBox() DirCopy() FileCreateShortcut()1 point -
Try this: $aSelected = _GUICtrlListBox_GetSelItems($hListBox) For $i = 1 To $aSelected[0] ConsoleWrite("Item " & $aSelected[$i] & " selected" & @CRLF) If FileExists(@ScriptDir & $requesteddirectory & $FileList[$aSelected[$i]]) Then MsgBox(0,0, @ScriptDir & $requesteddirectory & $FileList[$aSelected[$i]]) ;~ LoadIPA(@ScriptDir & $requesteddirectory & $FileList[$aSelected[$i]]) EndIf If FileExists(@ScriptDir & "\" & $FileList[$aSelected[$i]]) Then MsgBox(0,0, @ScriptDir & "\" & $FileList[$aSelected[$i]]) ;~ LoadIPA(@ScriptDir & "\" & $FileList[$aSelected[$i]]) EndIf ;~ Finishedyet() ;~ Sleep(10000) Next MsgBox(0, "Batch loading complete", "Success!") Exit which assumes that your listbox is populated via $fileList.1 point
-
Infinite Image Zoom Flight build 2018-01-10
UEZ reacted to argumentum for a topic
I have 2 monitors so I changed this: Local $aPos = WinGetPos("[TITLE:Program Manager;CLASS:Progman;]") Local Const $iW_Dt = $aPos[2], $iH_Dt = $aPos[3] ;Local Const $iW_Dt = @DesktopWidth, $iH_Dt = @DesktopHeight @UEZ, it's trippy ! Awesome, thanks1 point -
Copy specific folder with prompt for a new folder name
spudw2k reacted to Earthshine for a topic
Sure seems possible. Advice, pseudo code your algorithm. Then turn that into Code. Also please familiarize yourself with the help file. If you want help with code that isn’t working, please post your code so that we can see what’s going on and test it1 point -
Yeah, the subquery flattener of the query planner/optimizer isn't always smart enough to perform such (advanced?) optimization, mainly because there are potential dark corners where a seemingly clever optimization falls flat on its nose in another seemingly similar use case. Such remarks regularly pop up on the mailing list, but often enough, the proposed optimization made by people would work on their precise test case but have devastating effects on another large range of slightly different queries. SQLite main use base (in terms of number of devices) is for low-end devices having limited computing power and/or memory. So contrary to Oracle or MySQL and other RDBMS where massaging a query ad nauseam to choose the absolute best plan is both possible and beneficial, SQLite can't devote as much code and complexity. In case one of your queries takes longer than expected, try looking at what EXPLAIN QUERY PLAN <query> yields. The output often calls for a rewrite of the query and/or creation of a useful index. See http://www.sqlite.org/eqp.html1 point
-
You could do this. $fileContent = [IO.File]::ReadAllText("C:\Users\You\Desktop\Test.txt") $matches=[regex]::Matches($fileContent,'"name":"(.*?)"') For ($i=0; $i -lt $matches.Count; $i++) { Write-Host $matches[$i].Groups[1].Value } Saludos1 point
-
check box with $BS_PUSHLIKE - change button color?
AnonymousX reacted to JohnOne for a topic
When you post something like this, you should provide a runnable example code, which can be modified. Otherwise people might not have the time or patience to create a gui themselves, where they would offer help more quickly had they just have to modify existing code, or add a line of code. Doesent appear to work with your style of checkbox, you could just use a button. #include <GUIConstantsEx.au3> Example() Func Example() Local $msg GUICreate("My GUI background color") ; will create a dialog box that when displayed is centered ;$cb1 = GUICtrlCreateCheckbox("cb",30,35,18,18,8425760,-1) $cb1 = GUICtrlCreateButton("cb",30,35,18,18,8425760,-1) GUICtrlSetBkColor($cb1, 0x00ff00) ; Green GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example1 point -
Pass object property as a variable
SchneiMi reacted to RagsRevenge for a topic
Hi PsaltyDS, and thanks for your ongoing assistance. I'm still having problems assigning to a property/variable using Execute(). I've broken it down into the simplest code Global $sum = 0 ;doesn't work modify("$sum") func modify($var) Execute($var & " = 5") MsgBox(0,"", $sum) ;0 is displayed EndFunc ;End doesn't work ;works modifyWorking("sum") func modifyWorking($var) Assign($var, "5") MsgBox(0,"", $sum) ;5 is displayed EndFunc ;end works $a=1 $v=Execute("$a=2") MsgBox(0,"", $v) ;False is displayed because 1 <> 2, so the execute is doing a comparison rather than an assignment. #cs ;Example taken from code I am trying to achieve. $sPropertyToEdit = "Keywords" $sPropertyToAdd = "Test" $propToExecute = "$objFile.SummaryProperties." & $sPropertyToEdit Local $bool = Execute($propToExecute & " = " & $sPropertyToAdd) msgbox(0,"", @error) ;@error shows 1, $bool is blank #ce #cs Local $bool = Assign("objFile.SummaryProperties." & $sPropertyToEdit, $sPropertyToAdd) ;note missing dollar sign for objFile as per example in help msgbox(0,"", $bool) ;shows 1, but value hasn't been updated. #ce #cs Local $bool = Assign("$objFile.SummaryProperties." & $sPropertyToEdit, $sPropertyToAdd) msgbox(0,"", $bool) ;shows 1, but value hasn't been updated. #ce I would be delighted to get this working, but I don't have any experience with execute/eval/assign. Thanks, D1 point