Jump to content

Desktop Path


 Share

Recommended Posts

Hello this is my first AutoIT program that i am making

i made a button that will create a folder. I want to make that folder to the desktop ! but how?

Case $msg[0] = $okbutton

DirCreate("C:\Users\Dennis\Desktop\Runman")

This is for my Windows 7, but some other guy who will use this will not have "Dennis" on that spot..how can i make that default?

and one small question

Select

Case $msg[0] = $okbutton

DirCreate("C:\Runman")

MsgBox(0, "ScreenShot", "Made a Folder !")

Case $msg[0] = $Button_2

HotKeySet ("{PRINTSCREEN}", "gogoscreenshot")

Func gogoscreenshot()

DllCall("C:\Users\Dennis\Desktop\Runman\captdll.dll", "int", "CaptureScreen", "str", @MON & @MDAY & @YEAR & @HOUR & @MIN & @SEC & ".jpg", "int", 85)

EndFunc

Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $mainwindow

MsgBox(0, "Exiting", "See you next time <3")

ExitLoop

EndSelect

that small Hotkeyset button isnt working, it works for 1 time but then i get windows saying it will close AutoIT program bcs it isnt responding anymore?

thanks in advance

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>

$mainwindow = GUICreate("Runman's ScreenShot Service.", 225, 200)
GUICtrlCreateLabel("Welcome to Runman's Printscreen Service", 10, 10)

$tab = GUICtrlCreateTab(10, 35, 200, 100)

    $tab0 = GUICtrlCreateTabItem("Hello")
    GUICtrlCreateLabel("Welcome.                                 This is my first creation made by Dennis Anderson. ", 30, 70, 150, 80)


    $tab1 = GUICtrlCreateTabItem("Step 1")
    GUICtrlCreateLabel("How to use:                              1. Run the program, and click on the Make Folder button. This will make a Folder on your Desktop.", 30, 60, 150, 80)


    $tab2 = GUICtrlCreateTabItem("Step 2")
    GUICtrlCreateLabel("How to use:                              2. Press Run Auto Print Button this will activate the function ", 30, 60, 150, 80)

    $tab3 = GUICtrlCreateTabItem("Step 3")
    GUICtrlCreateLabel("How to use:             3. Now just press Printscreen button on your keyboard whenever you want! ", 30, 60, 150, 80)

    GUICtrlCreateTabItem("")    ; end tabitem definition
$okbutton = GUICtrlCreateButton("Make Folder", 10, 160, 100)
$Button_2 = GUICtrlCreateButton("Run Auto Print", 110, 160 , 100)


$dummywindow = GUICreate("Dummy window for testing ", 200, 100)

GUISwitch($mainwindow)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg(1)

  Select
  Case $msg[0] = $okbutton
      DirCreate("C:\Runman")
      MsgBox(0, "ScreenShot", "Made a Folder !")
    Case $msg[0] = $Button_2
      HotKeySet ("{PRINTSCREEN}", "gogoscreenshot")
        Func gogoscreenshot()
        DllCall("C:\Users\Dennis\Desktop\Runman\captdll.dll", "int", "CaptureScreen", "str", @MON & @MDAY & @YEAR & @HOUR & @MIN & @SEC & ".jpg", "int", 85)
        EndFunc
    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $mainwindow
      MsgBox(0, "Exiting", "See you next time <3")
      ExitLoop
  EndSelect

WEnd

This is my whole code script help me (L)

Link to comment
Share on other sites

You should take your function out of the While..Wend loop. I don't think having it there will cause any problems, it's just hard to follow your code the way it's written. Also, when you press button 2, all you're doing is SETTING the PrintScreen hotkey, you're not actually activating it. In fact unless you actually want the printscreen button to call the gogoprintscreen function you don't need to set it up in the first place. You could just hit the printscreen button, and then have button 2 call the gogoprintscreen function directly. It appears that you're attempting to do is use the PrintScreen button to take screenshot of your computer screen, and then using whatever your function does to print it, correct?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Yes u are right !

I want to use Button 2 to activate that script. This is my goal:

First Click on the button: Run Auto Print.

Now press Printscreen whenever you want and the Dll file will make a printscreen en send the pic to the map Runman I wanted to make with the first button.

but after i make 1 screenshot en the pic is sended to the folder, windows closes it :C

and thanks for the fast reply

If something isnt clear please say so ^^

Link to comment
Share on other sites

Goal:

1. Button Make Folder * makes folder on your Desktop *

2. Button Run auto Print ( must activate that if you press Printscreenbutton it will send the pic auto to the folder on the desktop *

3. I want it that you can press it as many times as you want.

Link to comment
Share on other sites

Your hotkey definitely calls the gogoprintscreen function as you wrote it. I put a consolewrite line in at the start of the function and it wrote it out, I think your call to the DLL may be in error.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

BrewManNH

Thank you very much it was indeed the DLL file !

now i inserted:

DllCall("captdll.dll", "int:cdecl", "CaptureScreen", "str", "DumpFile.jpg", "int", 85)

all works fine, screenshots are been made, one little small problem remains,

Everytime i press printscreen the pic names itself DumpFile.jpg, so it overwrite itself !

How can i make a default name that changes everytime? ;) if i fix that it will work !!!

Thank you in advance

Link to comment
Share on other sites

DllCall("captdll.dll", "int:cdecl", "CaptureScreen", "str", @MON & @MDAY & @YEAR & @HOUR & @MIN & @SEC & ".jpg", "int", 85)

Fixed it myself

I thank you all, you all are very kind for helping me and taking your time for me, the first Forum with so fast responce time and so friendly, one day i will become the guy who helps people out ^^

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...