For some reason this just doesnt work, help Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Kenzis
Posts: 15
Joined: 01 May 2020, 13:05

For some reason this just doesnt work, help

26 Feb 2023, 17:04

[Mod edit: Topic moved to v1 help.]

Code: Select all

#noenv
#warn
sendmode input
setworkingdir %a_scriptdir%
coordmode, mouse, screen
coordmode, pixel, screen

width := 1920 ; 1920 / 2400 / 2960

picc := 0 ; 0 / 1 check for whether or not the picture is on the screen, 1 is for yes and 0 is for nope
picl := 1 ; 0 / 1 check for whether or not the picture is on the screen, 1 is for yes and 0 is for nope
picr := 0 ; 0 / 1 check for whether or not the picture is on the screen, 1 is for yes and 0 is for nope

gui, background:new
gui, background:color, white
gui, background:show, w1920 h1080 center

   gui, startuje:new, -border -sysmenu -caption
   gui, startuje:add, picture,, %a_desktop%\5 noci kod braleta\data\all_doors_open.bmp
   gui, startuje:show, w%width% h1080 center
   gui, startuje:+parentbackground

repeater:
loop
{
 mousegetpos, x, y
 if picc := 1 and x >= 400 and x <= 1700
 goto, repeater
 else if picc := 0 and x >= 400 and x <= 1700
  {
   width := 2400
   gui, startuje:new, -border -sysmenu -caption
   gui, startuje:add, picture,, %a_desktop%\5 noci kod braleta\data\all_doors_open.bmp
   gui, startuje:show, w%width% h1080 center
   gui, startuje:+parentbackground
   picc := 1
   picl := 0
   picr := 0
  }
  else if x <= 400 and picl := 1
  goto, repeater
  else if x <= 400 and picl := 0
  {
   width := 1920
   gui, startuje:new, -border -sysmenu -caption
   gui, startuje:add, picture,, %a_desktop%\5 noci kod braleta\data\all_doors_open.bmp
   gui, startuje:show, w%width% h1080
   gui, startuje:+parentbackground
   picc := 0
   picl := 1
   picr := 0
  }
  else if x >= 1700 and picr := 1
  goto, repeater
  else if x >= 1700 and picr := 0
  {
   width := 2960
   gui, startuje:new, -border -sysmenu -caption
   gui, startuje:add, picture,, %a_desktop%\5 noci kod braleta\data\all_doors_open.bmp
   gui, startuje:show, w%width% h1080
   gui, startuje:+parentbackground
   picc := 0
   picl := 0
   picr := 1
  }
  goto, repeater
}
;Im trying to make an image on the screen depending on where the mouse is change it's width like its moving left or right.
;If the mouse is on the left the image width would be 1920, and if it was in the middle 2400, right it would be 2960.
;Im kind of trying to make a game of sorts, like fnaf but really bad and trolly., either way this just doesn't work fsm reason, i can't tell that's wrong other than if you put at the top like lets say picc := 1 and width := 2400 it will show the image in the center, and same goes for the other ones if you type them out correctly, but it doesn't change upon seeing that the mouse is in the correct spot fsm reason. Idk what's causing this.
Attachments
5 noci kod Braleta.ahk
thisjustnowork
(1.93 KiB) Downloaded 9 times
User avatar
mikeyww
Posts: 27361
Joined: 09 Sep 2014, 18:38

Re: For some reason this just doesnt work, help  Topic is solved

26 Feb 2023, 18:28

Welcome to this AutoHotkey forum!

Since this is a help forum, everyone needs help. Changing your thread subject to a brief description of the problem will help others understand the issue. See the forum board for examples.

Code: Select all

; This script changes the GUI width according to the mouse cursor position
#Requires AutoHotkey v1.1.33
image := A_ScriptDir "\test.jpg"
slice := A_ScreenWidth / nSlices := 3
Gui -DPIScale
Gui Margin, 0, 0
Gui Add, Picture, vpic, % image
SetTimer Check, 300
Check:
CoordMode Mouse
MouseGetPos x
GuiControl MoveDraw, pic, % "h600 w" width := Min(x // slice + 1, nSlices) * slice
Gui Show, % "x0 w" width, Picture
Return
If you are new to AutoHotkey, you might want to work with v2 instead of this older version.
Attachments
test.jpg
Test image
test.jpg (92.93 KiB) Viewed 269 times

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: CoffeeChaton and 121 guests