21 posts in this topic
More reliable check for file
I'm trying to check for the existance of a file, on logon the file is there, then gets deleted and after a while recreated. I'm using this code:
Sleep(100) If not FileExists($sFile) Then Sleep(150) If FileExists($sFile) Then GUICtrlSendToDummy($iDummy) What happens is this:
User logs on, the file is present, or at least it usually is After about 10 seconds the file gets deleted Then after about 50 seconds the file gets created again, this is when I need the check, because now the process is finished. The above code is part of a pretty long do....until false loop running an animation.
The problem is that sometimes this code fails. Without the sleep statements it didn't work at all so I think this is a timing issue. Pretty primitive code I admit, there must be a better way...
array vs loop is this possible
i have a file flower.txt with the name of the flowers and there picture location and information about that kind of flower. i wana cerat a gui that will display the flower picture and it information
here is the script
#include <Misc.au3> #include <EditConstants.au3> #include <Constants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <GuiComboBox.au3> #include <GuiTab.au3> #include <file.au3> #include <array.au3> Global $sfPath = 'flowers.txt' Global $aFlowers _FileReadToArray($sfPath,$aFlowers,$FRTA_NOCOUNT,'|') _ArrayColDelete($aFlowers,0) ;row 0 has no data so deleting $Form1 = GUICreate("Search Flower Name",320, 480) $input = GUICtrlCreateInput("", 60, 360, 209, 25) $idss = GUICtrlCreateButton("Search", 130, 400, 73, 65) GUISetState(@SW_SHOW) Func Searchf() Global $Fname = GUICtrlRead($input) For $iNo = 0 To UBound($aFlowers) - 1 ; if $Fname = $aFlowers[$iNo] then MsgBox($MB_SYSTEMMODAL, "","Flower nfo", ""& $aFlowers[$iNo] &"") pic() EndIf Next EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $nMsg = $idss Searchf() EndSwitch WEnd func pic() For $iNo = 0 To UBound($aFlowers) - 1 GUICtrlCreatePic($aFlowers[$iNo], 20, 30, 280, 280) Next EndFunc here is the flower.txt file
|Hibiscus|Hibiscus is a hardy perennial which grows in variety of colors, sizes and fragrances. Actually they are tropical flowers which require ample sunlight and moisture to grow well. These flowers start blooming in late spring and continuously bloom through July and August.|C:\T-in\IMG\2.jpg |Lilies|There are different types of lily flowers which bloom in August including water lilies, tiger lilies and gold band lilies. Tiger lilies generate orange flowers having black spots. This lily blooms in delayed July and beginning of August. Gold band lily produce exotic white blooms. All varieties of lilies need enough space to grow and protection from summer sun.|C:\T-in\IMG\1.jpg |Turtlehead|Growing in humid areas, turtleheads are small flowers which bloom from July to September. They mostly produce flowers of white and pink color.|C:\T-in\IMG\3.jpg |Hydrangea|These are ever green bushes which produce flowers in different colors including white, purple, blue and pink. They are easy to grow bushes and can grow 3 to 10 feet tall. They require morning sun to grow but they should be protected from noon and afternoon sun.|C:\T-in\IMG\4.jpg |Dahlias|August proves to be the peak blooming season for dahlias. Dahlias come in colors like white, orange, yellow, red and purple. They can tolerate all types of soil and require full sun to grow.|C:\T-in\IMG\5.jpg am still trying to learn about how the ubound work and the _filereadtoarray
Hey everyone - I tried searching for this and had no luck - so sorry if it was already posted somewhere
Is it possible to have a message box / or something similar to a message box appear and when you press ok - the clicks runs a function ?
[Workaround] List of HotKeySets
I have written a programm offering me a lot of hotkeys to work with windows. All in all there are 40 hotkeys defined now.
Now I made a portable version of it. But in this there are a lot of hotkeys useless. So I had to change some things. But that's not my point.
Because of all these many hotkeys I sometimes know I made a hotkey but what were the keys I have to press.
So I want to make a little help GUI or html or whatever. Now I'm interested to automate my own list of hotkeys.
How can I collect all my hotkeys and necessary keys for this in a list?
[Solved] Calculate/Compare Functions speed ?
I've these two functions to do a base64 conversation , Is there any way to compare the exact speed of both of them ?
Func _Base64Encode($input) $input = Binary($input) Local $struct = DllStructCreate("byte[" & BinaryLen($input) & "]") DllStructSetData($struct, 1, $input) Local $strc = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", 0, _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call Then Return SetError(1, 0, "") ; error calculating the length of the buffer needed EndIf Local $a = DllStructCreate("char[" & DllStructGetData($strc, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call Then Return SetError(2, 0, ""); error encoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>_Base64Encode
Func _Base64Encode($sData) Local $oXml = ObjCreate("Msxml2.DOMDocument") If Not IsObj($oXml) Then SetError(1, 1, 0) EndIf Local $oElement = $oXml.createElement("b64") If Not IsObj($oElement) Then SetError(2, 2, 0) EndIf $oElement.dataType = "bin.base64" $oElement.nodeTypedValue = Binary($sData) Local $sReturn = $oElement.Text If StringLen($sReturn) = 0 Then SetError(3, 3, 0) EndIf Return $sReturn EndFunc ;==>_Base64Encode