Author Topic: why does SHELL _HIDE not work on this code  (Read 202 times)

purelifewater

  • Jr. Member
  • **
  • Posts: 74
why does SHELL _HIDE not work on this code
« on: January 10, 2017, 11:26:38 pm »
file$ = "checknofile\"
IF NOT _DIREXISTS(file$ + DATE$) THEN
    SHELL _HIDE "mkdir checknofile\" + DATE$
ELSE

END IF

waltersmind

  • QB64 Partner Site Owner
  • Hero Member
  • *
  • Posts: 621
  • TheJoyfulProgrammer.com
    • The Joyful Programmer
Re: why does SHELL _HIDE not work on this code
« Reply #1 on: January 11, 2017, 12:14:18 am »
PureLifeWater,

The snippet of code works for me, but I think I have an idea why you think it is not.

If you remove the "_HIDE" action from the code, you do see the command window open up, but immediately closes. With the _HIDE action is used, the console window never shows. I have tested your code and it works as I just mentioned.

What I think is going on, is that you see the main app window open, and could be confusing it with the console window. If you add "_SCREENHIDE" at the beginning of the demo, you will not see the main window, and the console window will never appear, that is if you use the _HIDE action. If you add the _SCREENHODE command and remove the _HIDE action, you will see the console window open up and then immediately close.

Does this help any?


Happy Coding!

Walter Whitman
The Joyful Programmer
www.TheJoyfulProgrammer.com
www.TheJoyfulProgrammer.com/qb64/forum/

Please visit my QB64 programming forum located at http://www.TheJoyfulProgrammer.com and my YouTube Channel: https://www.youtube.com/c/Thejoyfulprogrammer

purelifewater

  • Jr. Member
  • **
  • Posts: 74
Re: why does SHELL _HIDE not work on this code
« Reply #2 on: January 11, 2017, 03:02:29 am »
on mine I have to press enter before the screen closes. at the bottom it says press any key to close

Clippy

  • Hero Member
  • *****
  • Posts: 19336
  • I LOVE π = 4 * ATN(1)    Use the QB64 WIKI >>>
    • Pete's Qbasic Site
Re: why does SHELL _HIDE not work on this code
« Reply #3 on: January 11, 2017, 09:29:59 am »
Use SYSTEM at end of code to close window immediately
QB64 WIKI: Main Page
Download Q-Basics Demo: Q-Basics.zip
Download QB64 BAT, IconAdder and VBS shortcuts: QB64BAT.zip
QB64 SDL

Pete

  • Hero Member
  • *****
  • Posts: 7249
  • Cuz I sez so varmint!
Re: why does SHELL _HIDE not work on this code
« Reply #4 on: January 11, 2017, 10:48:40 am »
I haven't switched all my stuff to the latest version yet, but the GL one I used from last year has some funny SHELL anomalies. Sometimes it is a simple as _HIDE and _DONTWAIT not working together. I really should see if I can remember or find those instances and test them out to see if they were debugged in the latest version.

Your code seemed fine, so I tried it and it worked. You can remove _HIDE and put the $CONSOLE meta command at the top of your code to see what the command window is doing.

I run Windows and I don't know if Linux or Mac would have a separate issue with using SHELL. So if you are not running Windows, that could be the problem.

Pete
Give a man a program, and he does one thing for a day. Teach a man to program, and he does one thing for a lifetime.

SMcNeill

  • Moderator
  • Hero Member
  • *****
  • Posts: 5917
Re: why does SHELL _HIDE not work on this code
« Reply #5 on: January 11, 2017, 09:18:25 pm »
Another thing with SHELL is things not being parsed properly if spaces are involved.

SHELL "Do this.exe"  is not the same as SHELL CHR$(34) + "Do this.exe" + CHR$(34)

The first is parsed by the command line as two separate parameters -- "DO" with the  parameter "this.exe" as an optional tag along. 

Think of it as if you did something such as SHELL "compress thisfile.txt".  You would shell to the "COMPRESS" command, and try to compress "this file.txt", which is something much different than the text file called "compress thisfile.txt"....

The way the original code is written, I'd update it to make use of the CHR$(34) quotes to help prevent any issues with spaces in the file names.

 SHELL _HIDE "mkdir " + CHR$(34) + "checknofile\" + DATE$ + CHR$(34)

From my experience, 90% of all SHELL issues arises from issues with the command line not parsing what you sent it properly.
http://bit.ly/TextImage -- Library of QB64 code to manipulate text and images, as a BM library.

http://bit.ly/Color32 -- A set of color CONST for use in 32 bit mode, as a BI library.