
HankHell
Active Members-
Posts
84 -
Joined
-
Last visited
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
HankHell's Achievements

Wayfarer (2/7)
10
Reputation
-
Musashi reacted to a post in a topic: Simple RGB Game
-
HankHell reacted to a post in a topic: Simple RGB Game
-
HankHell reacted to a post in a topic: Simple RGB Game
-
Gianni reacted to a post in a topic: Simple RGB Game
-
made this quite a while back and never bothered to post it... was having a discussion with a friend I was talking to about code and figured I might as well post it.... to win: click on the squares in the order of R, G, B. Game lasts 100 seconds. Score is deducted for pressing the wrong color #include <GUIConstants.au3> Global $button1 Global $button2 Global $time Global $counter = 1 Global $colorstate1 = 1 Global $colorstate2 = 1 Global $colorstate3 = 1 HotKeySet("{ESC}", "Close") Global $score = 0 $randomness1 = Random(1, 450) $randomnumber1 = Round($randomness1) $randomness2 = Random(1, 350) $randomnumber2 = Round($randomness2) $randomness3 = Random(1, 450) $randomnumber3 = Round($randomness3) $randomness4 = Random(1, 350) $randomnumber4 = Round($randomness4) $randomness5 = Random(1, 450) $randomnumber5 = Round($randomness5) $randomness6 = Random(1, 350) $randomnumber6 = Round($randomness6) Global $posx1 = $randomnumber1 Global $posy1 = $randomnumber2 Global $posx2 = $randomnumber3 Global $posy2 = $randomnumber4 Global $posx3 = $randomnumber5 Global $posy3 = $randomnumber6 GUICreate("random", 600, 500, @DesktopWidth / 4, @DesktopHeight / 4) $scorelabel = GUICtrlCreateLabel("Score: ", 150, 10) $scoregui = GUICtrlCreateLabel("", 200, 10, 100, 18) $timegui = GUICtrlCreateLabel("", 100, 450, 100, 18) GUICtrlSetColor($timegui, 0x085785) GUISetState(@SW_SHOW) $button1 = GUICtrlCreateButton("", $posx1, $posy1, 50, 50) $button2 = GUICtrlCreateButton("", $posx2, $posy2, 50, 50) $button3 = GUICtrlCreateButton("", $posx3, $posy3, 50, 50) GUICtrlSetBkColor($button1, 0x0000FF) GUICtrlSetBkColor($button2, 0x00FF00) GUICtrlSetBkColor($button3, 0xFF0000) While 1 If $counter = 1 Then Timer() EndIf SwitchCheck() WEnd Func Timer() $time += 1 GUICtrlSetData($timegui, $time) If $time = 10000 Then $counter = 0 GUICtrlSetState($button1, $GUI_DISABLE) GUICtrlSetState($button2, $GUI_DISABLE) GUICtrlSetState($button3, $GUI_DISABLE) GUICtrlCreateLabel("GAME OVER", 100, 435, 100, 15) EndIf EndFunc Func SwitchCheck() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button1 RandomFunc() $score -= 10 GUICtrlSetData($scoregui, $score) $colorstate1 += 1 If $colorstate1 = 1 Then GUICtrlSetBkColor($button1, 0x0000FF) EndIf If $colorstate1 = 2 Then GUICtrlSetBkColor($button1, 0xFF0000) EndIf If $colorstate1= 3 Then GUICtrlSetBkColor($button1, 0x00FF00) $colorstate1 = 0 EndIf $colorstate2 += 1 If $colorstate2 = 1 Then GUICtrlSetBkColor($button2, 0x00FF00) EndIf If $colorstate2 = 2 Then GUICtrlSetBkColor($button2, 0x0000FF) EndIf If $colorstate2 = 3 Then GUICtrlSetBkColor($button2, 0xFF0000) $colorstate2 = 0 EndIf $score += 3 GUICtrlSetData($scoregui, $score) $colorstate3 += 1 If $colorstate3 = 1 Then GUICtrlSetBkColor($button3, 0xFF0000) EndIf If $colorstate3 = 2 Then GUICtrlSetBkColor($button3, 0x00FF00) EndIf If $colorstate3 = 3 Then GUICtrlSetBkColor($button3, 0x0000FF) $colorstate3 = 0 EndIf Case $button2 RandomFunc() $score -= 20 GUICtrlSetData($scoregui, $score) $colorstate2 += 1 If $colorstate2 = 1 Then GUICtrlSetBkColor($button2, 0x00FF00) EndIf If $colorstate2 = 2 Then GUICtrlSetBkColor($button2, 0x0000FF) EndIf If $colorstate2 = 3 Then GUICtrlSetBkColor($button2, 0xFF0000) $colorstate2 = 0 EndIf $colorstate1 += 1 If $colorstate1 = 1 Then GUICtrlSetBkColor($button1, 0x0000FF) EndIf If $colorstate1 = 2 Then GUICtrlSetBkColor($button1, 0xFF0000) EndIf If $colorstate1= 3 Then GUICtrlSetBkColor($button1, 0x00FF00) $colorstate1 = 0 EndIf $score += 3 GUICtrlSetData($scoregui, $score) $colorstate3 += 1 If $colorstate3 = 1 Then GUICtrlSetBkColor($button3, 0xFF0000) EndIf If $colorstate3 = 2 Then GUICtrlSetBkColor($button3, 0x00FF00) EndIf If $colorstate3 = 3 Then GUICtrlSetBkColor($button3, 0x0000FF) $colorstate3 = 0 EndIf Case $button3 RandomFunc() $score += 3 GUICtrlSetData($scoregui, $score) $colorstate3 += 1 If $colorstate3 = 1 Then GUICtrlSetBkColor($button3, 0xFF0000) EndIf If $colorstate3 = 2 Then GUICtrlSetBkColor($button3, 0x00FF00) EndIf If $colorstate3 = 3 Then GUICtrlSetBkColor($button3, 0x0000FF) $colorstate3 = 0 EndIf $colorstate2 += 1 If $colorstate2 = 1 Then GUICtrlSetBkColor($button2, 0x00FF00) EndIf If $colorstate2 = 2 Then GUICtrlSetBkColor($button2, 0x0000FF) EndIf If $colorstate2 = 3 Then GUICtrlSetBkColor($button2, 0xFF0000) $colorstate2 = 0 EndIf $colorstate1 += 1 If $colorstate1 = 1 Then GUICtrlSetBkColor($button1, 0x0000FF) EndIf If $colorstate1 = 2 Then GUICtrlSetBkColor($button1, 0xFF0000) EndIf If $colorstate1= 3 Then GUICtrlSetBkColor($button1, 0x00FF00) $colorstate1 = 0 EndIf EndSwitch EndFunc Func RandomFunc() $RandomNumber = Random(1, 3) $RandomNumber = Round($RandomNumber) If $RandomNumber = 1 Then $randomness1 = Random(1, 450) $randomnumber1 = Round($randomness1) $randomness2 = Random(1, 350) $randomnumber2 = Round($randomness2) GUICtrlSetPos($button1, $randomnumber1, $randomnumber2) $Randomnumber = 2 EndIf If $RandomNumber = 2 Then $randomness1 = Random(1, 450) $randomnumber1 = Round($randomness1) $randomness2 = Random(1, 350) $randomnumber2 = Round($randomness2) GUICtrlSetPos($button2, $randomnumber1, $randomnumber2) $Randomnumber = 3 EndIf If $RandomNumber = 3 Then $randomness1 = Random(1, 450) $randomnumber1 = Round($randomness1) $randomness2 = Random(1, 350) $randomnumber2 = Round($randomness2) GUICtrlSetPos($button3, $randomnumber1, $randomnumber2) $Randomnumber = 1 EndIf ;--------------- If $RandomNumber = 1 Then $randomness1 = Random(1, 450) $randomnumber1 = Round($randomness1) $randomness2 = Random(1, 350) $randomnumber2 = Round($randomness2) GUICtrlSetPos($button1, $randomnumber1, $randomnumber2) $Randomnumber = 2 EndIf If $RandomNumber = 2 Then $randomness1 = Random(1, 450) $randomnumber1 = Round($randomness1) $randomness2 = Random(1, 350) $randomnumber2 = Round($randomness2) GUICtrlSetPos($button2, $randomnumber1, $randomnumber2) $Randomnumber = 3 EndIf EndFunc Func Close() Exit EndFunc
-
tyvm very helpful
-
HankHell reacted to a post in a topic: DL'ing From API
-
anyone know which commands I can use in autoit to download specific files from an api without having to download the entire directory? such as downloading from the THUMBNAILS section under each category; like this (python) import os import requests PRODUCT_URL = 'www.WEBSITE.com' SAVE_DIR = 'THUMBNAILS' def load_products(): return requests.get(PRODUCT_URL).json() def get_objects(products): for product in products: if 'THUMBNAILS' in product and 'url' in product['THUMBNAILS']: yield { 'url': product['THUMBNAILS']['url'], 'name': product['sku'], } def download_objects(objects): try: from tqdm import tqdm except ImportError: tqdm = None if tqdm: for obj in tqdm(objects): download_object(obj) else: for obj in objects: print('Downloading model for {name}'.format(name=obj['name'])) download_object(obj) def download_object(obj): file_name = os.path.join(SAVE_DIR, '{name}.obj'.format(name=obj['name'])) if os.path.isfile(file_name): print('ERROR file already Exists') return r = requests.get(obj['url'], stream=True) with open(file_name, 'wb') as f: for block in r.iter_content(1024): f.write(block) if __name__ == '__main__': try: os.mkdir(SAVE_DIR) except OSError: pass products = load_products() objects = get_objects(products) download_objects(objects)
-
HankHell reacted to a post in a topic: Simple Google Translate
-
huh... very cool... you guys get me kinda interested... here's with the gui setup, though unfinished... dunno if I'll work on it more, but it does work as-is (at least for the AF language anyways) this is designed to copy the source text and then translate multiple languages at once when set with the combobox(once you set the comboboxes up) #include <Array.au3> Global $FromCombo1 Global $ToCombo1 Global $FromComboData1 Global $ToComboData1 Global $aArray[5][2] = [["--English--", "EN"], ["(Afan) Oromo", "OM"], ["Abkhazian", "AB"], ["Afar", "AA"], ["Afrikaans", "AF"]] $sList = "" For $i = 0 To UBound($aArray,1) -1 $sList &= "|" & $aArray[$i][0] Next GUICreate("GUItest", 450, 300, @DesktopWidth/2, @DesktopHeight/2) GUICtrlCreateGroup("Source",7,1,85,285) GUICtrlCreateGroup("Output",232,1,85,285) $FromCombo1 = GUICtrlCreateCombo("--From-->", 95, 15, 65, 18) GUICtrlSetData($FromCombo1, $sList) $Source1 = GUICtrlCreateInput("",10,15,80,21) $ToCombo1 = GUICtrlCreateCombo("--To-->", 165, 15, 65, 18) GUICtrlSetData($ToCombo1, $sList) $Output1 = GUICtrlCreateInput("",235,15,80,21) $Go1 = GUICtrlCreateButton("Go", 320,14,25,23) GUICtrlSetTip($Go1, "Translate") $CopySource1 = GUICtrlCreateButton("Copy Source", 355,14,75,23) GUICtrlSetTip($CopySource1, "Transl. from the source, to all other sources by their respective languages") $2 = GUICtrlCreateInput("",10,50,80,18) $3 = GUICtrlCreateInput("",10,70,80,18) $4 = GUICtrlCreateInput("",10,90,80,18) $5 = GUICtrlCreateInput("",10,110,80,18) $6 = GUICtrlCreateInput("",10,130,80,18) $7 = GUICtrlCreateInput("",10,150,80,18) $8 = GUICtrlCreateInput("",10,170,80,18) $fLangLabel1 = GUICtrlCreateLabel("", 300, 80, 50, 20) $tLangLabel1 = GUICtrlCreateLabel("", 300, 100, 50, 20) ;GUICtrlCreateCombo ;GUICtrlCreateCombo GUISetState(@SW_SHOW) While 1 SwitchCheck() WEnd Func SwitchCheck() Switch GUIGetMsg() Case -3 Exit Case $FromCombo1 $sName = GUICtrlRead($FromCombo1) $iIndex = _ArraySearch($aArray, $sName) If Not @error Then GUICtrlSetData($fLangLabel1, $aArray[$iIndex][1]) $FromComboData1 = GUICtrlRead($fLangLabel1) EndIf Case $ToCombo1 $sName = GUICtrlRead($ToCombo1) $iIndex = _ArraySearch($aArray, $sName) If Not @error Then GUICtrlSetData($tLangLabel1, $aArray[$iIndex][1]) $ToComboData1 = GUICtrlRead($tLangLabel1) EndIf Case $Go1 $Translate1 = GUICtrlRead($Source1) $Url = "https://translate.googleapis.com/translate_a/single?client=gtx&sl=" & $FromComboData1 & "&tl=" & $ToComboData1 & "&dt=t&q=" & $Translate1 $URLData = BinaryToString(InetRead($Url), 4) $URLOutput1 = StringMid($URLData, 5, StringInStr($URLData, '","')-5) & @CRLF GUICtrlSetData($Output1, $URLOutput1) Case $CopySource1 $SourceRead1 = GUICtrlRead($Source1) GUICtrlSetData($2, $SourceRead1);temp GUICtrlSetData($3, $SourceRead1);temp GUICtrlSetData($4, $SourceRead1);temp GUICtrlSetData($5, $SourceRead1);temp GUICtrlSetData($6, $SourceRead1);temp GUICtrlSetData($7, $SourceRead1);temp GUICtrlSetData($8, $SourceRead1);temp GUISetState(@SW_SHOW) EndSwitch EndFunc ;---------------------------------------A ;(Afan) Oromo om ;Abkhazian ab ;Afar aa ;Afrikaans af ;Albanian sq ;Amharic am ;Arabic ar ;Armenian hy ;Assamese as ;Aymara ay ;Azerbaijani az ;---------------------------------------B ;Bashkir ba ;Basque eu ;Bengali bn ;Bhutani dz ;Bihari bh ;Bislama bi ;Breton br ;Bulgarian bg ;Burmese my ;Byelorussian be ;---------------------------------------C ;Cambodian km ;Catalan ca ;Chinese zh ;Corsican co ;Croatian hr ;Czech cs ;---------------------------------------D ;Danish da ;Dutch nl ;---------------------------------------E ;English en ;Esperanto eo ;Estonian et ;---------------------------------------F ;Faeroese fo ;Fiji fj ;Finnish fi ;French fr ;Frisian fy ;---------------------------------------G ;Galician gl ;Georgian ka ;German de ;Greek el ;Greenlandic kl ;Guarani gn ;Gujarati gu ;---------------------------------------H ;Hausa ha ;Hebrew (former iw) he ;Hindi hi ;Hungarian hu ;---------------------------------------I ;Icelandic is ;Indonesian (former in) id ;Interlingua ia ;Interlingue ie ;Inupiak ik ;Inuktitut (Eskimo) iu ;Irish ga ;Italian it ;---------------------------------------J ;Japanese ja ;Javanese jw ;---------------------------------------K ;Kannada kn ;Kashmiri ks ;Kazakh kk ;Kinyarwanda rw ;Kirghiz ky ;Kirundi rn ;Korean ko ;Kurdish ku ;---------------------------------------L ;Laothian lo ;Latin la ;Latvian, Lettish lv ;Lingala ln ;Lithuanian lt ;---------------------------------------M ;Macedonian mk ;Malagasy mg ;Malay ms ;Malayalam ml ;Maltese mt ;Maori mi ;Marathi mr ;Moldavian mo ;Mongolian mn ;---------------------------------------N ;Nauru na ;Nepali ne ;Norwegian no ;---------------------------------------O ;Occitan oc ;Oriya or ;---------------------------------------P ;Pashto, Pushto ps ;Persian fa ;Polish pl ;Portuguese pt ;Punjabi pa ;---------------------------------------Q ;Quechua qu ;---------------------------------------R ;Rhaeto-Romance rm ;Romanian ro ;Russian ru ;---------------------------------------S ;Samoan sm ;Sangro sg ;Sanskrit sa ;Scots Gaelic gd ;Serbian sr ;Serbo-Croatian sh ;Sesotho st ;Setswana tn ;Shona sn ;Sindhi sd ;Singhalese si ;Siswati ss ;Slovak sk ;Slovenian sl ;Somali so ;Spanish es ;Sudanese su ;Swahili sw ;Swedish sv ;---------------------------------------T ;Tagalog tl ;Tajik tg ;Tamil ta ;Tatar tt ;Tegulu te ;Thai th ;Tibetan bo ;Tigrinya ti ;Tonga to ;Tsonga ts ;Turkish tr ;Turkmen tk ;Twi tw ;---------------------------------------U ;Uigur ug ;Ukrainian uk ;Urdu ur ;Uzbek uz ;---------------------------------------V ;Vietnamese vi ;Volapuk vo ;---------------------------------------W ;Welch cy ;Wolof wo ;---------------------------------------X ;Xhosa xh ;---------------------------------------Y ;Yiddish (former ji) yi ;Yoruba yo ;---------------------------------------Z ;Zhuang za ;Zulu zu anyone know how to install languages for kanji and such? otherwise languages display as blank when translated anyways, feel free to use it.. just need to add a bunch more languages onto the array, and change the array to match how many sequences there are... Global $aArray[6][2] when adding one new language etc... counting them up is gonna be a pain lol just keep setting GUICtrlSetData($variable, $sList) per each new instance of GUICtrlCreateCombo. using arrays is way easier than making individual functions I'd love to know if you edit your original code, I'm sure it'll be awesome
-
I know in C++ it's like this... { ReadProcessMemory(handle, (PBYTE*)0x00REPLACEWITHMEMORYADDRESS, &readcurrentvalue, sizeof(readcurrentvalue), 0); cout << readcurrentvalue << end1; Sleep(1000); WriteProcessMemory(handle, (LPVOID)0x00REPLACEWITHMEMORYADDRESS, &writenewvalue, sizeof(writenewvalue), 0); } and so on and so-forth... it's really simple... and I could use #include with my C++ script... I'm just wondering if it's possible to do with only autoit...
-
made some code a while back to figure out what was running on a system and it got me curious... is there a UDF out there that you can determine cpu usage per each window somehow? anyways... as always, here's some code below: #include <MsgBoxConstants.au3> #include <GUIConstants.au3> GUICreate("handleview", 300, 600, @DesktopWidth/2, @DesktopHeight/2) $ListView = GUICtrlCreateListView("Program|HWND", 1, 1, 298, 598) ProgramFind() GUISetState(@SW_SHOW) While 1 Sleep(10) SwitchCheck() WEnd Func SwitchCheck() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch EndFunc Func ProgramFind() Local $List = WinList() For $i = 1 To $List[0][0] GUICtrlCreateListViewItem($List[$i][0]&"|"&$List[$i][1], $ListView) Next EndFunc kinda curious how you directly call the memory in autoit, like outputting the data of "0x00010000" to console or something, would be nice to know... been looking at the functions, but can't seem to output the data directly from a hex-specific memory address
-
ahmeddzcom reacted to a post in a topic: Resizable Screenshot
-
ahmeddzcom reacted to a post in a topic: ColorFinder, Hex,Dec,RGB
-
MarkIT reacted to a post in a topic: Resizable Screenshot
-
Skeletor reacted to a post in a topic: ColorFinder, Hex,Dec,RGB
-
Skeletor reacted to a post in a topic: Resizable Screenshot
-
Opens up a semi-transparent resizable GUI window, then takes a screenshot of the size and location with PrintScreen #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <ScreenCapture.au3> HotKeySet("{PRINTSCREEN}", "Takepic") $gui = GUICreate("gui", 100, 100, @DesktopWidth /2, @DesktopHeight /2, BitOR($WS_POPUP, $WS_THICKFRAME), $WS_EX_TOPMOST) GUICtrlCreateLabel("", 0, 0, 100, 100, -1, $GUI_WS_EX_PARENTDRAG) WinSetTrans($gui, "", 150) GUISetState(@SW_SHOW) While 1 Sleep(100) $winsize = WinGetClientSize($gui) $winpos = WinGetPos($gui) WEnd Func Takepic() WinSetTrans($gui, "", 0) Local $randomness = Random(0, 999999) $randomnumber = Round($randomness) _ScreenCapture_Capture($randomnumber&".jpg", $winpos[0]+7, $winpos[1]+7, ($winsize[0]+$winpos[0]+6), ($winsize[1]+$winpos[1]+6)) Exit EndFunc
-
Jury reacted to a post in a topic: ColorFinder, Hex,Dec,RGB
-
HankHell reacted to a post in a topic: ColorFinder, Hex,Dec,RGB
-
you're absolutely right, I changed the code a bit in accordance, it also works much better with _ispressed
-
Needed this for copying specific colors without the need for color lookup. Just figured it might be useful to someone. tracks your mouse and gives color feedback in realtime; in hex, dec, and rgb, as well as mouse coordinates F1 to toggle pause. up/down/left/right to move 1 pixel at a time. #include <GUIConstants.au3> #include <Color.au3> #include <WindowsConstants.au3> #include <Misc.au3> HotKeySet("{F1}", "Toggle") Global $Mpos_x Global $Mpos_y Global $ColorVar Global $iColor Global $Red, $Green, $Blue Global $ToggleState $GUI = GUICreate("Coords", 125, 195, 0, 0, $WS_POPUP) $bar = GUICtrlCreateLabel("", -5, -5, 135, 20) GUICtrlCreateInput("",-1,-1, 1, 1) GUICtrlSetBkColor($bar, 0x898989) GUICtrlSetState($bar, $GUI_DISABLE) $close = GUICtrlCreateLabel("", 110, -1, 15, 20) GUICtrlSetBkColor($close, 0xD9403B) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") $xylabel = GUICtrlCreateLabel("X=" & @CRLF & "Y=", 1, 20, 15, 30) $Label_x_value = GUICtrlCreateLabel("", 17, 20, 50, 11) $Label_y_value = GUICtrlCreateLabel("", 17, 35, 50, 11) GUICtrlCreateLabel("R,G,B", 65, 25, 35, 11) $RGB = GUICtrlCreateLabel("", 60, 40, 60, 11) $copyrgb = GUICtrlCreateButton("+", 97, 23, 25, 15) GUICtrlSetTip($copyrgb, "Copy RGB to clipboard") GUICtrlCreateLabel("Hex Color", 1, 55, 50, 11) $hextext = GUICtrlCreateLabel("", 1, 70, 55, 11) $copyhex = GUICtrlCreateButton("+", 55, 55, 15, 25) GUICtrlSetTip($copyhex, "Copy HEX to clipboard") GUICtrlCreateLabel("Dec Color", 1, 85, 55, 11) $dectext = GUICtrlCreateLabel("", 1, 100, 50, 11) $copydec = GUICtrlCreateButton("+", 55, 85, 15, 25) GUICtrlSetTip($copydec, "Copy DEC to clipboard") $buttoncolor = GUICtrlCreateButton("", 73, 55, 50, 57) $colorset1 = GUICtrlCreateButton("", 1, 115, 35, 35) $set1 = GUICtrlCreateButton("-", 1, 115, 15, 15) GUICtrlSetState($colorset1, $GUI_DISABLE) $colorset2 = GUICtrlCreateButton("", 43, 115, 35, 35) $set2 = GUICtrlCreateButton("-", 43, 115, 15, 15) GUICtrlSetState($colorset2, $GUI_DISABLE) $colorset3 = GUICtrlCreateButton("", 85, 115, 35, 35) $set3 = GUICtrlCreateButton("-", 85, 115, 15, 15) GUICtrlSetState($colorset3, $GUI_DISABLE) $colorset4 = GUICtrlCreateButton("", 1, 155, 35, 35) $set4 = GUICtrlCreateButton("-", 1, 155, 15, 15) GUICtrlSetState($colorset4, $GUI_DISABLE) $colorset5 = GUICtrlCreateButton("", 43, 155, 35, 35) $set5 = GUICtrlCreateButton("-", 43, 155, 15, 15) GUICtrlSetState($colorset5, $GUI_DISABLE) $colorset6 = GUICtrlCreateButton("", 85, 155, 35, 35) $set6 = GUICtrlCreateButton("-", 85, 155, 15, 15) GUICtrlSetState($colorset6, $GUI_DISABLE) GUISetState(@SW_SHOW) Toggle() While 1 Sleep(10) SwitchCheck() WEnd Func Toggle() $ToggleState = Not $ToggleState While $ToggleState Sleep(10) Get_Mouse_Pos() SwitchCheck() IfPressed() If Not $ToggleState Then Sleep(10) EndIf WEnd EndFunc Func SwitchCheck() $nMsg = GUIGetMsg() Switch $nMsg Case $close Exit Case $copyhex ClipPut($ColorVar) Case $copydec ClipPut($iColor) Case $copyrgb ClipPut($Red&","&$Green&","&$Blue) Case $set1 GUICtrlSetBkColor($colorset1, $ColorVar) Case $set2 GUICtrlSetBkColor($colorset2, $ColorVar) Case $set3 GUICtrlSetBkColor($colorset3, $ColorVar) Case $set4 GUICtrlSetBkColor($colorset4, $ColorVar) Case $set5 GUICtrlSetBkColor($colorset5, $ColorVar) Case $set6 GUICtrlSetBkColor($colorset6, $ColorVar) EndSwitch EndFunc Func Get_Mouse_Pos() GUISetState(@SW_SHOW) $Mpos = MouseGetPos() $Mpos_x = $Mpos[0] $Mpos_y = $Mpos[1] GUICtrlSetData($Label_x_value, $Mpos_x) GUICtrlSetData($Label_y_value, $Mpos_y) $iColor = PixelGetColor($Mpos[0], $Mpos[1]) $ColorVar = "0x" & Hex($iColor, 6) GUICtrlSetBkColor($buttoncolor, $ColorVar) GUICtrlSetData($hextext, $ColorVar) GUICtrlSetData($dectext, $iColor) $Red = _ColorGetRed($iColor) $Green = _ColorGetGreen($iColor) $Blue = _ColorGetBlue($iColor) GUICtrlSetData($RGB, $Red&","&$Green&","&$Blue) EndFunc Func IfPressed() If _IsPressed(26) Then Sleep(100) MouseMove(($Mpos_x + 0) , ($Mpos_y - 1), 0) EndIf If _IsPressed(28) Then Sleep(100) MouseMove(($Mpos_x + 0) , ($Mpos_y + 1), 0) EndIf If _IsPressed(25) Then Sleep(100) MouseMove(($Mpos_x - 1) , ($Mpos_y + 0), 0) EndIf If _IsPressed(27) Then Sleep(100) MouseMove(($Mpos_x + 1) , ($Mpos_y + 0), 0) EndIf EndFunc Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If $hWnd = $gui And $iMsg = $WM_NCHITTEST Then Return $HTCAPTION EndFunc
-
been messing with this for a while now trying to get leftclick to disable clicking on windows, but at the same time able to activate functions. Just a simple screenshot program... I know HotKeySet disables the key while in use. Trying to mimic it with _IsPressed though, is another story... #include <ScreenCapture.au3> #include <Misc.au3> ;click upper left to lower right HotKeySet("{ESC}", "End") Global $Mpos1_x Global $Mpos1_y Global $Mpos2_x Global $Mpos2_y Global $check = 0 FindCoords() Func FindCoords() While 1 If $check = 0 Then Get1() EndIf If $check = 1 Then Get2() EndIf WEnd EndFunc Func Get1() If _IsPressed("01") Then $check = 1 $Mpos1 = MouseGetPos() $Mpos1_x = $Mpos1[0] $Mpos1_y = $Mpos1[1] Sleep(150) EndIf EndFunc Func Get2() If _IsPressed("01") Then $check = 3 $Mpos2 = MouseGetPos() $Mpos2_x = $Mpos2[0] $Mpos2_y = $Mpos2[1] Sleep(150) Capture() EndIf EndFunc Func Capture() Local $randomness = Random(0, 999999) $randomnumber = Round($randomness) _ScreenCapture_Capture("V:\location\"&$randomnumber&".jpg", $Mpos1_x, $Mpos1_y, $Mpos2_x, $Mpos2_y) Exit EndFunc Func End() Exit EndFunc
-
nope, still getting random numbers, as in "54323 blast off"
-
yep, and it never said that End() was improper either, and it runs just fine on my end... I can press the button 5 times as expected, but I think some sort of weird race condition makes the text scrambled
-
I was playing with some functions here and there and ran into this bit of weirdness. I have heard before that it's not that great of an idea to do so, and was wondering why exactly. #include <MsgBoxConstants.au3> Global $input1 HotKeySet("{ESC}", "End") doit() Func doit() For $i = 5 To 1 Step -1 $nmsg = GUIGetMsg() Switch $nmsg Case $i = 5 GUICtrlSetData($input1, $i) MsgBox(0, "title", "5") Case $i = 4 GUICtrlSetData($input1, $i) MsgBox(0, "title", "4") Case $i = 3 GUICtrlSetData($input1, $i) MsgBox(0, "title", "3") Case $i = 2 GUICtrlSetData($input1, $i) MsgBox(0, "title", "2") Case $i = 1 GUICtrlSetData($input1, $i) MsgBox(0, "title", "1") EndSwitch Next MsgBox($MB_SYSTEMMODAL, "", "Blast Off!") EndFunc Func End() Exit EndFunc
-
Call Func located in .txt doc
HankHell replied to HankHell's topic in AutoIt General Help and Support
ohhh, gotchya, tyvm