unknown12 Posted April 3, 2007 Share Posted April 3, 2007 Is there anyway to detect the amount of images within a GUI, then loop through them all? I've got my image tiling sorted, but no idea what to do now to change the images with out restarting the application. Cheers. Link to comment Share on other sites More sharing options...
Uten Posted April 3, 2007 Share Posted April 3, 2007 You have created an application tiling the images and don't know how to reference them? I think you better post some code.. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
unknown12 Posted April 3, 2007 Author Share Posted April 3, 2007 lol, true Heres some code anyway: ;; Get the size of the jpg. $jpg_size = _ImageGetSize($taskbar_image) $image_horizontal = $desktop_width/$jpg_size[0] $image_horizontal = Ceiling($image_horizontal-1) $image_vertical = $taskbar_height/$jpg_size[1] $image_vertical = Ceiling($image_vertical-1) ;; Start to tile it horizontally, then vertically. $horizontal = 0 $vertical = 1 $img_num = 0 While $horizontal <= $image_horizontal $offset_hori = $horizontal*$jpg_size[0] $img_hori = GUICtrlCreatePic($taskbar_image,$offset_hori,0,$jpg_size[0],$jpg_size[1]) $img_num = $img_num+1 If $image_vertical > 0 Then While $vertical <= $image_vertical $offset_vert = $vertical*$jpg_size[1] $img_vert = GUICtrlCreatePic($taskbar_image,$offset_hori,$offset_vert,$jpg_size[0],$jpg_size[1]) $vertical = $vertical + 1 $img_num = $img_num+1 WEnd EndIf $vertical = 1 $horizontal = $horizontal + 1 WEnd Link to comment Share on other sites More sharing options...
Shevilie Posted April 3, 2007 Share Posted April 3, 2007 (edited) Can you provide some code ?? Edit: Memo to me remember to refresh the browser while using tabs Edited April 3, 2007 by Shevilie Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Slaiochi Posted April 3, 2007 Share Posted April 3, 2007 (edited) How about a limiter on the horizontal? If $horizontal=16 then $vertical += 1 EDIT: I do believe I missed the entire point, but cut me some slack it's 5:30 am Edited April 3, 2007 by Slaiochi Link to comment Share on other sites More sharing options...
unknown12 Posted April 3, 2007 Author Share Posted April 3, 2007 How about a limiter on the horizontal? If $horizontal=16 then $vertical += 1 EDIT: I do believe I missed the entire point, but cut me some slack it's 5:30 am Haha The tiling works fine, its just changing all of the images I'm having trouble with. I know how i'd do it in php, but autoIT doesn't work like that. I'd do $img_hori[$img_num] = createtheimage And then loop through them with a while loop when the tiles are all done, but autoIT doesn't support having a variable within a variable name (afaik). Link to comment Share on other sites More sharing options...
Shevilie Posted April 3, 2007 Share Posted April 3, 2007 (edited) Eval Return the value of the variable defined by an string. Eval ( string ) Dim $a_b = 12 $s = Eval("a" & "_" & "b") ; $s is set to 12 $s =Eval("c") ; $s = "" and @error = 1 Edited April 3, 2007 by Shevilie Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
unknown12 Posted April 3, 2007 Author Share Posted April 3, 2007 Thanks, but I can't see how that would help in this situation? Link to comment Share on other sites More sharing options...
Shevilie Posted April 3, 2007 Share Posted April 3, 2007 but autoIT doesn't support having a variable within a variable name (afaik). Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Slaiochi Posted April 3, 2007 Share Posted April 3, 2007 Might be better to load them into arrays, like pic[0] = "blahwhateverimage.jpg" then for i = 0 to 30 loadimage ("pic") I know i didn't even use correct syntax, but again, it's early Link to comment Share on other sites More sharing options...
unknown12 Posted April 3, 2007 Author Share Posted April 3, 2007 Can't do that. They're all the same picture, and I'd have to have a variable within the variable name. I still don't see how eval would help, because $a_b would need to be $a_$b. Link to comment Share on other sites More sharing options...
jvanegmond Posted April 3, 2007 Share Posted April 3, 2007 (edited) Haha The tiling works fine, its just changing all of the images I'm having trouble with. I know how i'd do it in php, but autoIT doesn't work like that. I'd do $img_hori[$img_num] = createtheimage And then loop through them with a while loop when the tiles are all done, but autoIT doesn't support having a variable within a variable name (afaik).Yes it does.. I use it all the time.. AutoIt and PHP are both built on C.. Edited April 3, 2007 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
unknown12 Posted April 3, 2007 Author Share Posted April 3, 2007 Yes it does.. I use it all the time..AutoIt and PHP are both built on C..Can you give an example? It didn't work when i tried it Link to comment Share on other sites More sharing options...
jvanegmond Posted April 3, 2007 Share Posted April 3, 2007 Hope this helps you... Dim $Button[5][5] GUICreate("Test GUI", 250, 250) For $x = 0 to 4 For $y = 0 to 4 $Button[$x][$y] = GUICtrlCreateButton("( " &$x&","&$y&" )",$x*50,$y*50,50,50) Next Next GUISetState() While 1 $nMsg = GUIGetMsg() If $nMsg = -3 Then ExitLoop For $x = 0 to 4 For $y = 0 to 4 If $nMsg = $Button[$x][$Y] Then MsgBox(0x40, "Test Data", "$x = " & $x & @CRLF & _ "$y = " & $y & @CRLF & _ "$Button[$x][$y] = " & $Button[$x][$Y]) EndIf Next Next WEnd github.com/jvanegmond Link to comment Share on other sites More sharing options...
unknown12 Posted April 3, 2007 Author Share Posted April 3, 2007 Cheers, works perfect! Didn't know that it had to be declared at the top (Dim $Button[5][5]) Link to comment Share on other sites More sharing options...
jvanegmond Posted April 3, 2007 Share Posted April 3, 2007 Cheers, works perfect! Didn't know that it had to be declared at the top (Dim $Button[5][5])Happy to help. github.com/jvanegmond Link to comment Share on other sites More sharing options...
unknown12 Posted April 3, 2007 Author Share Posted April 3, 2007 One more question, is it possible to delete GUI controls? Link to comment Share on other sites More sharing options...
jvanegmond Posted April 3, 2007 Share Posted April 3, 2007 GUICtrlDelete ?? github.com/jvanegmond Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now