Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/07/2024 in all areas

  1. Nine

    x64 bitwise operations

    I needed a very fast x64 unsigned shift right, and doing it through an AutoIt array was way too slow. So I decided to make a .dll to perform such a task. While I was there, why not include all the bitwise operators that I know of. And then why not make a UDF. This is a bit like my wife does, she buys some draperies and then I end up repainting the whole room because the colors do not match anymore. Anyway, hope it can be useful for you too. Let me know if you have enhancements or comments, I will be glad to incorporate them (if possible). Version 2024-12-07 ASM * Code optimization (elimination of redundancy) Version 2024-12-06 ASM Func BitAND64 Func BitOR64 Func BitXOR64 Func BitSHIFT64 Func BitROTATE64 Func BitNOT64 Version 2020-04-27 DLL Func _BitAND64 Func _BitOR64 Func _BitXOR64 Func _BitEQV64 Func _BitIMP64 Func _BitSHIFT64 Func _BitROTATE64 Func _BitNOT64 Func _x64CloseDLL Version 2020-04-27 Util Func _Hex2Dec x64_Ops.zip
    1 point
  2. As your script stands, I only see $sMasterEdlFile being used. You have declared $sSelectedPath as Global $selected Path = "" but you don't use it anywhere. in _BrowseForFolder() you have declared it as local. (not Global) in _MoveWavData($sSourceWavPath, $sSelectedPath) you pass it as an argument to the parameter $sSelectedPath (not Global) in _EnterSetName() you have declared it as local. (not Global) in _CreateFolder($sSourceWavPath, $sSelectedPath) you pass it as an argument to the parameter $sSelectedPath (not Global) So even if you delete it or rename it, it won't affect anything. exception is the function _SelectWavData() how will you overcome it? either you will set a path as default as start path or you will go to the suggestion I saw above to disable the button until the path is available Otherwise, how can you delete something that hasn't been specified? In my opinion, using a .ini file, (even though you didn't need it, since you don't have to store anything that you need the next time you start the script) just to avoid using a global variable, it's invalid It seems to me that you have globalphobia that you need to overcome. I'll use something I saw here and liked. "Who cares if we add a couple of global variables to our scripts, if it makes them more readable ? We shouldn't frown when a user adds a few global variables, when #include adds dozen & hundreds of them... " where you should focus is, at what point will you define them so that they are available and updated in your script e.g. don't call a function that uses it and it is not available and when I say available I don't mean it has the value="" And again, don't use global variable names as local variables or as parameters inside functions.
    1 point
  3. Concerning $sSelectedPath, you could declare it Local if you place your Main loop in a function, for example with the canvas below, which assigns the variable in _BrowseForFolder() and _EnterSetName() , then returns its value from both functions to Main() . Now you can pass the variable as a parameter in functions _DeleteTextListing() and _SelectWavData() Main() ; ----------------------------------------------- Func Main Local $sSelectedPath = "", $sMasterEdlFile = "" Local $hGUI, $_sCol3Row3, $_sCol3Row4, $_sCol3Row5, $_sCol3Row6, $_sCol3Row9 $hGUI = GUICreate(...) $_sCol3Row3 = GUICtrlCreateButton(...) $_sCol3Row4 = GUICtrlCreateButton(...) $_sCol3Row5 = GUICtrlCreateButton(...) $_sCol3Row6 = GUICtrlCreateButton(...) $_sCol3Row9 = GUICtrlCreateButton(...) GUISetState(@SW_SHOW, $hGUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $_sCol3Row3 $sSelectedPath = _BrowseForFolder() Case $_sCol3Row4 $sSelectedPath = _EnterSetName() Case $_sCol3Row5 _DeleteTextListing($sSelectedPath) Case $_sCol3Row6 _SelectWavData($sSelectedPath) Case $_sCol3Row9 _ExitMe() EndSwitch WEnd EndFunc ; ----------------------------------------------- Func _BrowseForFolder() Local $sSelectedPath = FileSelectFolder(...) ... Return $sSelectedPath EndFunc ; ----------------------------------------------- Func _EnterSetName() Local $sSelectedPath = InputBox(...) ... Return $sSelectedPath EndFunc ; ----------------------------------------------- Func _DeleteTextListing($sSelectedPath) ... EndFunc ; ----------------------------------------------- Func _SelectWavData($sSelectedPath) ... Return ; ----------------------------------------------- Func _ExitMe() Exit EndFunc ; ----------------------------------------------- Of course you'll have to check, at a moment or another, if $sSelectedPath is valid (e.g if it's not empty) for example in main loop (but not really user friendly) : Case $_sCol3Row5 If $sSelectedPath Then _DeleteTextListing($sSelectedPath) Or you can check if $sSelectedPath is valid from within the functions _DeleteTextListing() and _SelectWavData() and warn the user that $sSelectedPath has not been set yet. Another way could be to disable/enable both buttons $_sCol3Row5 (_DeleteTextListing) and $_sCol3Row6 (_SelectWavData) depending on the value of $sSelectedPath in functions _BrowseForFolder() and _EnterSetName() => * Disable the buttons if $sSelectedPath is empty * Enable them if $sSelectedPath is valid These are just quick ideas, untested, but well... you got the idea.
    1 point
  4. No, at least I can't . It looks like a typical XY problem to me - https://en.wikipedia.org/wiki/XY_problem
    1 point
×
×
  • Create New...