Jump to content

Search the Community

Showing results for tags 'Using variables?'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. Good evening! I have a very similar question to here, the only actual thread I found that was asking pretty much the same thing as I need to figure out: . In my case, got things to work out just fine when I used the code straight up in each line where it should go (i.e., when not trying to do this via variables at all): GUICtrlSetImage(-1, @SystemDir & "shell32.dll", 240, 0) GUISetIcon(@SystemDir & "shell32.dll", 133) [icons used above from the shell32.dll: #240 and #133] Here's where I run into trouble, though: since I like to re-use/recycle code a lot rather typing everything new all the time, I really love to use variables, and putting variables at the top in an easily identifiable, editable format. So I replaced the pertinent parts of GUICtrlSetImage and GUISetIcon as seen here below (showing here with incomplete, imperfectly-working @SystemDir and shell32.dll references with no icon numbers listed): ;================================================================== ; VARIABLES - without icon references as they don't work yet if I put icon numbers: $icon_for_GUI = @SystemDir & "\shell32.dll" $icon_for_CLEAR_button = @SystemDir & "\shell32.dll" ;================================================================== (This _doesn't_ work, and for obvious reasons. the ', 240' and ', 133' parts are by their lonesome!: $icon_for_GUI = @SystemDir & "shell32.dll", 240 $icon_for_CLEAR_button = @SystemDir & "shell32.dll", 133) and the rest of the code in the body, like this: GUICtrlSetImage(-1, $icon_for_CLEAR_button, 0) ... GUISetIcon($icon_for_GUI) The problem happens when I try to reference the 240 and 133 icons. I have to leave them out as the codes stands now as seen in the variables section above, otherwise I get errors. There must be a way to do something similar to the above but getting the icons we want to be displayed from the shell32.dll. Unfortunately, I tried everything I could think of - extra brackets, extra quotation marks, replacing quotes with apostrophes, all the usual things I tried but that didn't work this time to fix the parsing errors. When I put the @SystemDir & "shell32.dll" reference right in the body of the code with its ", 240" and ", 133" afterwards, no problem. But when I extract and put as a variable, I'm missing the key to encasing the actual icon reference within the variable so that it works. Right now, I have the GUI showing with the $icon_for_GUI and $icon_for_CLEAR_button variables without the icon numbers b/c at least it works that way. I get a generic icon, and I suspect that the code above makes the GUI just latch onto the first icon in shell32.dll. See, I've always made my GUIs referencing icons within the same folder and a @scriptdir path, but I'd like to make things cleaner, and especially for GUI scripts, would like to start referencing shell32.dll icons, instead of having icon files all over the place wherever there's a GUI au3 in a folder. If someone can help with the bit that I'm missing, that would be grand. (These were no help, either: https://www.autoitscript.com/autoit3/docs/functions/GUICtrlSetImage.htm, https://www.autoitscript.com/autoit3/docs/libfunctions/_GUICtrlButton_GetImage.htm, as the same problem persists. How to have right syntax in variables so one's icon choice is used at any given moment in a GUI script.) Thank you!
×
×
  • Create New...